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

Pidstat return CPU > 100% for a process even after -I switch is used #149

Open
couponinvent opened this issue May 17, 2017 · 6 comments
Open

Comments

@couponinvent
Copy link

I am using pidstat (sysstat) to calculate %cpu on my amazon ec2 machine(Debian 8) for performance monitoring. There are 2 issues with it:

  1. For most cpu consuming process pidstat -u results into more cpu(even more than the total %cpu consumed by the machine)
  2. It also reports cpu more than 100% for a processor even after i have used -I switch.
10:56:51 AM   UID       PID    %usr %system  %guest    %CPU   CPU  Command  
10:56:52 AM     0       922   39.00   18.00    0.00    9.42     2  xxx   
10:56:52 AM     0       924    2.00    0.00    0.00    0.33     0  xxx    
10:56:52 AM     0       927  554.00   68.00    0.00  102.81     2  xxx  
@couponinvent
Copy link
Author

@sysstat Can you please help me with this

@sysstat
Copy link
Owner

sysstat commented May 22, 2017

Please could you give more details (like the version of pidstat you are using)?

@couponinvent
Copy link
Author

@sysstat It is the latest version, i installed sysstat using apt-get install sysstat.

@sysstat
Copy link
Owner

sysstat commented Jun 2, 2017

Please tell me the exact version (output of pidstat -V).

@delta160
Copy link

pidstat and multithreaded processes
I contend that the CPU usage for the process ought to be the sum of CPU usage for all threads
[omex_sys_hkex@pgencng106 ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)
[omex_sys_hkex@pgencng106 ~]$ rpm -qa | grep sysstat
sysstat-10.1.5-11.el7.x86_64
[omex_sys_hkex@pgencng106 ~]$ pidstat -V
sysstat version 10.1.5
(C) Sebastien Godard (sysstat orange.fr)
[omex_sys_hkex@pgencng106 ~]$ pidstat -h -u -t -p 8677 1 2
Linux 3.10.0-514.10.2.el7.x86_64 (pgencng106) 12/11/17 x86_64 (16 CPU)

Time UID TGID TID %usr %system %guest %CPU CPU Command

1512983762 20200 8677 0 100.00 36.00 0.00 100.00 13 dsf_processor
1512983762 20200 0 8677 83.00 18.00 0.00 100.00 13 |__dsf_processor
1512983762 20200 0 8682 1.00 0.00 0.00 1.00 8 |__dsf_processor
1512983762 20200 0 8683 0.00 0.00 0.00 0.00 0 |__dsf_processor
1512983762 20200 0 8684 82.00 17.00 0.00 99.00 12 |__dsf_processor

Time UID TGID TID %usr %system %guest %CPU CPU Command

1512983763 20200 8677 0 100.00 35.00 0.00 100.00 13 dsf_processor
1512983763 20200 0 8677 83.00 17.00 0.00 100.00 13 |__dsf_processor
1512983763 20200 0 8682 0.00 1.00 0.00 1.00 8 |__dsf_processor
1512983763 20200 0 8683 0.00 0.00 0.00 0.00 0 |__dsf_processor
1512983763 20200 0 8684 83.00 18.00 0.00 100.00 12 |__dsf_processor

Now it seems that the process is only "charged" for what the first thread is using ( this program has two threads intentionally spinning 100% ) I would like to se 201% as %CPU for the process, unless -I is specified , when it should be 201/16 % in this case

@sysstat
Copy link
Owner

sysstat commented Mar 31, 2018

Please also refer to #73.

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

No branches or pull requests

3 participants