Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Aggregate child process values in tree mode #598

Closed
magneticflux- opened this issue Aug 20, 2023 · 3 comments · Fixed by #618
Closed

[REQUEST] Aggregate child process values in tree mode #598

magneticflux- opened this issue Aug 20, 2023 · 3 comments · Fixed by #618
Assignees
Labels
enhancement New feature or request

Comments

@magneticflux-
Copy link

Is your feature request related to a problem? Please describe.
I'd like to view the process tree, but also sort by total child CPU usage so that (non-collapsed) subtrees with a lot of resource usage appear higher.

Describe the solution you'd like
An option to report aggregate statistics about child processes regardless of the nodes being collapsed or not.

Describe alternatives you've considered
Introduce another toggle like per-core called aggregate?

Additional context
This seems mostly-implemented already since collapsed nodes already sum their values, I'd just like to see the sums while also seeing the child processes.

@magneticflux- magneticflux- added the enhancement New feature or request label Aug 20, 2023
@imwints
Copy link
Contributor

imwints commented Aug 20, 2023

I've implemented this in https://github.com/nobounce/btop/tree/aggregate-child-processes, but I find this hardly distinguishable from the normal per-process statistics. Any idea how this could be made visible that this is the combined resource usage so user won't freak out if they are not aware of this and see for example /sbin/init using 5 gigs of memory?

Also maybe have a look add my wording of this setting, might not describe this feature as you've intended it.

@magneticflux-
Copy link
Author

Awesome that works perfectly! It makes a huge difference when there's deeply-nested trees and I want to show the most "active" ones first, like compiling a bunch of packages in NixOS.

Details

image

Overriding the btop package in Nix to use this branch:

(btop.overrideAttrs (prev: {
  name = "btop/aggregate-child-processes";
  src = pkgs.fetchFromGitHub {
    owner = "nobounce";
    repo = "btop";
    rev = "aggregate-child-processes";
    hash = "sha256-wWpcqnZXBH4nIE/EzWWooFyzM0odX2ewAHq1fIuX5M8=";
  };
}))

Before this, the systemd/sshd/nixos-rebuild tree wasn't guaranteed to be at the top because random background services with 2% CPU usage got sorted above sshd with 1%, even though the tree was a lot more active.


To make it explicitly clear to users, you could split the display of values into "self" and "child" parts, so something like /sbin/init spawning a child with 5G memory would look like 1.6M + 5G. The downside is that it's much wider than the original.

In my opinion, having the aggregate stats option default to off and making the description really clear is a good approach if you're concerned about confusion. I suggest the description be:

In tree-view, include all child resources with the parent even while expanded.

@imwints
Copy link
Contributor

imwints commented Sep 14, 2023

I just realized that if we show both memory values we would also want to show all of the other resources twice, but that would take up to much space (or I just can't imagine a nicer way of doing things)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants