dalance / procs

A modern replacement for ps written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FR] add cgroup column

beelze opened this issue · comments

Thanks for the great tool - nice replacement for good old ps!
Though, It would be nice to have an ability to add cgroup column to output. htop implemented a good approach for it – «raw» and «compact» values:

CGROUP
Which cgroup the process is in. For a shortened view see the CCGROUP column below.
CCGROUP
Shortened view of the cgroup name that the process is in. This performs some pattern-based replacements 
to shorten the displayed string and thus condense the information.

/*.slice is shortened to /[*] (exceptions below)
/system.slice is shortened to /[S]
/user.slice is shortened to /[U]
/user-*.slice is shortened to /[U:*] (directly preceding /[U] before dropped)
/machine.slice is shortened to /[M]
/machine-*.scope is shortened to /[SNC:*] (SNC: systemd nspawn
container), uppercase for the monitor
/lxc.monitor.* is shortened to /[LXC:*]
/lxc.payload.* is shortened to /[lxc:*]
/*.scope is shortened to /!*
/*.service is shortened to /* (suffix removed)

Encountered escape sequences (e.g. from systemd) inside the cgroup name are not decoded.

Thank you for your suggestion!
I added cgroup and ccgroup column.

Thanks!
But tried to build 0.14.2 I got errors like:

error[E0658]: use of unstable library feature 'local_key_cell_methods'
  --> src/./columns/group.rs:42:46
   |
42 |             if let Some(group) = USERS_CACHE.with_borrow_mut(|x| x.get_group_by_gid(gid)) {
   |                                              ^^^^^^^^^^^^^^^
   |
   = note: see issue #92122 <https://github.com/rust-lang/rust/issues/92122> for more information

procs v0.14.2 requires Rust 1.73.
I released v0.14.3 which can be built on Rust 1.67.

Sorry, missed the dependency. Successfully built with Rust 1.73, works like a charm. Thanks!