Rate this page del.icio.us  Digg slashdot StumbleUpon

Tips and tricks: Why do the CPU stats vary with ps and top?

by the editorial team

The commands ps and top express CPU time differently. While ps calculates it by “total CPU time” divided by “time task is running”, top shows the value as a percentage of overall CPU time.

For ps, this means that the longer a process is running without a high CPU utilization the smaller the value of %cpugets (it converges to zero).

For top, this means that it displays this value as share of the CPU time since last screen update and is therefore more accurate in terms of “current CPU utilization”.

Red Hat’s customer service and support teams receive technical support questions from users all over the world. Red Hat technicians add the questions and answers to Red Hat Knowledgebase on a daily basis. Access to Red Hat Knowledgebase is free. Every month, Red Hat Magazine offers a preview into the Red Hat Knowledgebase by highlighting some of the most recent entries. The information provided in this article is for your information only. The origin of this information may be internal or external to Red Hat. While Red Hat attempts to verify the validity of this information before it is posted, Red Hat makes no express or implied claims to its validity.

One response to “Tips and tricks: Why do the CPU stats vary with ps and top?”

  1. Ritesh Khadgaray says:

    Hello

    http://kbase.redhat.com/faq/FAQ_75_12102 . Formatting seems to be off. rt# #512601 .

Leave a reply