LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   some problem of using the top command (https://www.linuxquestions.org/questions/linux-software-2/some-problem-of-using-the-top-command-4175448834/)

jeff.xue 02-06-2013 03:07 AM

some problem of using the top command
 
i have wirte some script to monitor some process and record the data.
but when i run my script that i found the record of the CPU whitch is over 100% .For example:

the %CPU = 577.3 ,i don't know how to conver to the real value.

PID USER PR NI VIRT RES SHR S %CPU %ME MTIME+ COMMAND
16280 wacos 20 0 10.7g 2.3g 12m S 577.3 7.3 42:00.41 java

PS: running in redhat6.2 (i have runned the same script in solaris ,which is normal)

syg00 02-06-2013 03:23 AM

That implies you have multiple threads running on multiple cores.

RHEL comes with sysstat - you might be better served to make use of that. See "man sar".

druuna 02-06-2013 03:28 AM

Out of the box top shows a cumulative value for the total of cpu's (if one has 2 core's/cpu's running each at 90 procent the value shown will be 180%).

Use 1 when running top to show value's for each separate cpu. If you want to make this the default behaviour press W enter to create a configuration file.

Top might not be the best choice to use when used in a script. sar comes to mind.


All times are GMT -5. The time now is 03:59 AM.