top and ps
Hello
I am monitoring clamd (clamAV antivirus usage) . If I use top I receive this 28562 root 25 0 381m 317m 2076 R 100 8.0 0:41.35 clamd 100% cpu usage due to clamd If in the same time I execute this ps command ps aux | grep "clamd" root 28562 6.1 8.1 392088 330376 ? Ssl 02:07 0:41 /usr/sbin/clamd 6.1% cpu usage used by clamd Which is correct , ps which is reporting 6.1% or top which is reporting 100% ? I have an Intel Xeon E5430 @ 2.66GHz with 8 cores . Thank you Graziano |
I assume top displays 100% of one core, ps displays 6.1% of the full capacity.
|
They are both correct.
Understand what you are measuring before even considering comparing the results. Top, when run interactively, displays interval usage - "ps" displays usage since process start. Potentially vastly different - especially on multi-cores. |
Quote:
|
Yes - it is not normalized.
For multi-threaded apps, it is not uncommon to see several hundred percent reported. |
see man top:
k: %CPU -- CPU usage The task's share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time. In a true SMP environment, if 'Irix mode' is Off, top will operate in 'Solaris mode' where a task's cpu usage will be divided by the total number of CPUs. You toggle 'Irix/Solaris' modes with the 'I' interactive command. |
Quote:
|
Quote:
BTW I was thinking top was doing this automatically . |
Quote:
do you think possible to receive current usage (not from the start) using ps ? |
man ps see NOTES:
CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process. This is not ideal, and it does not conform to the standards that ps otherwise conforms to. CPU usage is unlikely to add up to exactly 100%. but unfortunately it may slightly differ on some linux. |
Quote:
do you think possible to toggle Irix/Solaris when the interactive mode is off for example # top -n1 | grep "clamd" however I would have Irix |
Quote:
Startup Defaults The following startup defaults assume no configuration file, thus no user customizations. Even so, items shown with an asterisk ('*') could be overridden through the command-line. Global_defaults 'A' - Alt display Off (full-screen) * 'd' - Delay time 3.0 seconds 'I' - Irix mode On (no, 'solaris' smp) * 'p' - PID monitoring Off * 's' ... I can be only toggled using interactive mode |
All times are GMT -5. The time now is 01:41 PM. |