htop
htop copied to clipboard
Allow summing-collapse of a process/thread tree
I often want to see the total memory and CPU usage for some process and its subprocess (e.g. Firefox, Chromium). I can htop to consider all threads of a process together (although even that is a global setting) - but I can't do that for processes. I wish that, in tree view, when I collapse a node (with the - key) - I will see the sum of the memory usage percentage, CPU usage percentage etc of its entire subtree.
Now, I realize that for some columns, summation may not be obvious (e.g. if a process started T seconds ago and runs N subprocesses after T/2 seconds, it's not clear whether the time is (N+1)*T/2 or T), or not relevant, but any reasonable default will do AFAIAC. Plus people can always file other bugs about that later on...
You can collapse a tree branch with - (minus key).
This will - however - not "sum" memory or CPU usages at the moment.
@fasterit : Rephrasing to emphasize the main request.
Is this request substantially different from #301 / #303?
@fasterit : #303 is about global merging, with no option of expansion. #301 is also global, and would not be affected by collapsing; also, it involves merging more than is currently being merged, while my proposal is orthogonal of that. That being said - if #301 were implemented I would not bother to file this issue.
@fasterit This feature request is different from #301. This is more about usability improvement for tree view when a process/thread "subtree" is collapsed.
- When a process group is collapsed this way, the CPU time and memory usage should sum up and display the total for the group, perhaps with a different text color to indicate it's a summary result.
- The "state" / "S" flag might also need to be updated for the summary. I.e. when a child process in a group is Running, the whole collapsed process subtree should show "R" in its state despite the parent process Sleeping.
- For "user" column a collapsed subtree might need to show "(multi)" if there are child process owned by multiple users.
i want this feature so much i could create PR but my main lang is Java, not C COULD SOMEBODY SUMMON C ENGINEER!?
I would also love it if the default behavior was changed so that the percentages were cumulative! 🙏🏻
I want this too.
Chance of this getting implemented in the next six months?
There are many situations in which this would be helpful such as ascertaining total CPU usage of a bash script that spawns multiple background processes:
Chance of this getting implemented in the next six months?
That depends on how many pull-requests we get for this feature.