[lkml]   [2003]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: decaying average for %CPU
    On Thu, 2003-10-16 at 22:56, Nick Piggin wrote:
    > Albert Cahalan wrote:
    > >The UNIX standard requires that Linux provide
    > >some measure of a process's "recent" CPU usage.
    > >Right now, it isn't provided. You might run a
    > >CPU hog for a year, stop it ("kill -STOP 42")
    > >for a few hours, and see that "ps" is still
    > >reporting 99.9% CPU usage. This is because the
    > >kernel does not provide a decaying average.
    > I think the kernel provides enough info for userspace to do
    > the job, doesn't it?

    I'm pretty sure not. Linux provides:

    per-process start time
    current time
    per-process total (lifetime) CPU usage
    units of time measurement (awkwardly)
    boot time

    >From that you can compute %CPU over the whole
    life of the process. This does not meet the
    requirements of the UNIX standard.

    What we do for load average is about right,
    except that per-process values can't all get
    updated at the same time. So the algorithm
    needs to be adjusted a bit to allow for that

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:58    [W:0.020 / U:30.260 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site