5

I want to see the full load MS teams creates, which has plenty of threads.

I already tried the tree view but the values from (1) are not added up in (2)

htop1 Can this be seen in htop or another nice tool?

Edit With "H" hotkey it still does not sum up everything

htop2

5
  • 1
    Does this help you? unix.stackexchange.com/a/471925
    – Daniel
    Mar 5 at 8:32
  • @Daniel thanks, I edited my question
    – Alex
    Mar 5 at 8:42
  • A few Qs for context :1.) Does the ubuntu instance that is pictured have multiple sessions? (2.) If so, would more than one acct have an associated Teams process running? (3.) What app is making the process? Is it Teams or a VS Code ext?
    – Nate T
    Sep 16 at 0:27
  • The reason I am asking is because process list/action type CLI programs like ps, top, htop, pgrep/pkill, etc. usually will not show processes owned by other users, except for root-owned application processes, even if they launch with 'sudo' or from root acct (in other words, user A cannot see processes owned by user B, even if user A is root user). Not sure if htop is like this or not. If so, it will likely be documented in the htop man-page(s). I am fuzzy on the details myself atm, Just wanted to mention it so as to give you a new direction in which to look for an answer.
    – Nate T
    Sep 16 at 0:54
  • The Ubuntu instance has only one Gnome session. I am running teams as a single user, but I am also okay with using sudo to find more information. VS code is not in use.
    – Alex
    Sep 16 at 5:29
3
+100

If you need a tool that does this, and frequently updates the info as htop, there might be no answer. But if you are ok with executing a command and getting the result, as a snapshot, there are a few options.

One way is by processing the output of "the basic command" ps

$ ps -eo user,pid,ppid,pcpu,command

There are two ways to process the information.

The simple method

grep all lines with a given command, and sum pcpu usage. E.g., for firefox with this simple version (you don't need pid,ppid)

$ ps -eo pcpu,command --sort -pcpu | grep firefox | awk '{p=$1 ; sum +=p} END {print sum}'

This method could give a result that might be off the actual target, due to:

  1. Two separate processes with the same name, overestimating the actual result. Sometimes you may know if you are in one such case, and if so this might not be an issue.
  2. Child processes not grepped (I am not certain this could ever happen), underestimating the actual result.

The method below takes care of both potential issues.

The complete method

Navigate the process tree, starting with the PID (process ID, say, 10000) of your target process of interest. You would then grep all other processes which have PPID (parent process ID) 10000, and record their PIDs. Recursively obtain the whole tree, and add all values of pcpu.

You would have to write a small program for this. I am not certain some items included in this sum would not be included in the simple way above.

Notes on "the basic command":

  1. It is important to list command (or cmd, args). Column comm lists the process name, which may be different (see this). For instance, firefox launches many Web Content processes, and this teases the excellent tool atop + P, e.g.
  2. For other interesting analyses you could add ,size,%mem as columns to show and process. See also below.

The memory-side of resources usage

There is an extensive "discussion" here, which applies to memory usage. I am not sure if any of the claims there apply in any similar way (even considering the differences cpu usage vs. memory usage) here.

Related:

  1. https://unix.stackexchange.com/questions/209689/sum-the-memory-usages-of-all-the-processes-of-a-program
  2. https://unix.stackexchange.com/questions/55148/top-htop-group-process-by-command/471925#471925
  3. https://www.networkworld.com/article/3516319/showing-memory-usage-in-linux-by-process-and-user.html
0

Based on sancho.s answer this is fair enough for me:

watch -n 1 'ps -eo pcpu,command --sort -pcpu | grep teams | awk "{p=\$1 ; sum +=p} END {print sum}"'

It prints the CPU load of all teams processes every secound (side note: for me it's always around 78%, even idle, which is crazy, but off topic here)

Or we can produce a log of the CPU load over time:

while sleep 1; do echo -n `date +"%H:%M:%S;" `; ps -eo pcpu,command --sort -pcpu | grep teams | awk "{p=\$1 ; sum +=p} END {print sum}"; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.