Results 1 to 4 of 4

Thread: top vs ps - CPU Usage

  1. #1
    Join Date
    Sep 2006
    Beans
    279
    Distro
    Ubuntu 9.10 Karmic Koala

    top vs ps - CPU Usage

    Can someone explain as what is the difference between CPU% showed in top and in ps? I mean the way in which they are calculated. I can see each of these commands giving different numbers for the same process at the same instant.

  2. #2
    Join Date
    Sep 2009
    Beans
    8,874
    Distro
    Ubuntu Development Release

    Re: top vs ps - CPU Usage

    Quote Originally Posted by ittiam View Post
    Can someone explain as what is the difference between CPU% showed in top and in ps? I mean the way in which they are calculated. I can see each of these commands giving different numbers for the same process at the same instant.
    They are two different programs running at different intervals of read.

  3. #3
    Join Date
    Sep 2006
    Beans
    279
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: top vs ps - CPU Usage

    And I would assume top samples at a higher rate. top always shows me low CPU% compared to ps and the difference is quite big. For the process I tested with top showed around 1% whereas ps showed around 20% and the value showed by ps was exactly the same for 5 minutes I monitored whereas top was fluctuating between 0-2%.

    Why this big a difference? And how to interpret the CPU usage from ps compared to that of top?

  4. #4
    Join Date
    Apr 2008
    Location
    Viet Nam
    Beans
    189
    Distro
    Ubuntu

    Re: top vs ps - CPU Usage

    top is realtime.
    ps is the average CPU in an interval.
    Dell Inspiron 1464
    Intel Core-i3 @ 2.13Ghz | 4G 1066Mhz DDR3
    GMA HD | Intel SSD 80Gb |
    Running Ubuntu 12.04 "Precise"

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •