1

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.

Dumb admin
  • 127
  • 12

2 Answers2

1

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

Jan Garaj
  • 879
  • 1
  • 7
  • 15
1

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

John Mahowald
  • 32,050
  • 2
  • 19
  • 34
  • 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 05 '18 at 10:24
  • Interesting, nmon can be useful. Consider making that an answer to your own question. – John Mahowald Feb 05 '18 at 12:54