I need to track amount of processes that a single user invoked and how much CPU-time (or % ) these processes consumed for a given period of time.

The trick is that each of these processes normally runs for a split second and consume almost no CPU, but they are invoked lots of time per second. Therefore "ps -eo user,pid,pcpu,time,args" are not reliable.

In the end I wanted a report saying something like: "user foobar consumed xxx CPU-TIME/CPU% during the last xx seconds"

Does anyone has a light of how can I achieve it? The OS is a AIX7.1, but the question applies for Linux RHEL7 as well.

Thanks in advance.


On AIX, you can enable the accounting subsystem and use a combination of acctprc1 and prtacct commands to show CPU usage by user.

  • This is actually very near of what I am looking for. I kind of managed the situation using 'nmon fT' + nmon analyzer and checking the 'summary' tab. The data is not 100% accurate but serves the purpose. Thanks for the tip – Dumb admin Feb 5 '18 at 10:24
  • Interesting, nmon can be useful. Consider making that an answer to your own question. – John Mahowald Feb 5 '18 at 12:54

You can use (Linux) cgroups in the theory. You will create custom cgroup, where all user processes will be running. Then just watch the eye on the cgroup CPU ticks accounting (sum system&user time) and you will be able to calculate total %CPU usage for a selected time period from those values.

Doc: https://www.kernel.org/doc/Documentation/cgroup-v1/cpuacct.txt

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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