Compress cgroup names based on some heuristics#849
Conversation
e5cd41c to
f5f571e
Compare
f5f571e to
0aa187b
Compare
fasterit
left a comment
There was a problem hiding this comment.
Very quick review:
- s.buf is not always free'd
- N/A will never be output as the initial / (slash) remains in cgroup_short
- This works reasonably well and makes the column much more useful
- Consider making it a separate column (CCGROUP) or configurable or switching together with
m(merge command line). Rationale: it is a heuristic and it will have error cases. So the user should have choice / a fallback option. Making it a separate column would allow the other CGROUP column to be also insanely wide so it becomes at least useful. - Please add a section to the htop man file for it including the cases it handles (systemd cgroup hierarchy, systemd nspawn, LXC as of now)
- (for a v2) colors would be nice!
Can you give a rough hint which case you noticed? Edit: Okay, I found one place (successful return branch in
hmmm,
This aligns with the initial feedback I got from @lucaswerkmeister who provided me with the test cases for In the final patch I'll probably go to have this column 40 chars wide, as even with this compression there's still quite a few processes where this ain't enough. Though with #854 on its way there could be another route …
Sounds like a good idea. Switching this together with command line merging is probably not a good choice though, as those features are too unrelated. But with two columns the user can choose the way to go. That aside, there's one fix we have to do for the column display anyway (namely the
Will do. Proposals for wording always welcome. ;-)
Actually this shouldn't be too hard to implement given I already have the output code provided as a callback. Thus basically adding in another parameter for the color for the callback function and replacing |
0aa187b to
cae865c
Compare
cae865c to
914fd36
Compare
914fd36 to
12fd2b1
Compare
cbc4237 to
5c3cf78
Compare
This is some WIP for #216. The current implementation handles most common cgroup namespace patterns encountered for system/user/machine slices, shortens scope identifiers, trims service names and handles both LXC and systemd-nspawn (SNC) containers.
The code probably doesn't win a beauty contest yet, but should suffice as a preview.
Points to clean/optimize: