decaying average for %CPU

From: Albert Cahalan (albert_at_users.sf.net)
Date: 10/17/03

  • Next message: Nick Piggin: "Re: decaying average for %CPU"
    To: linux-kernel mailing list <linux-kernel@vger.kernel.org>
    Date:	16 Oct 2003 22:35:55 -0400
    
    

    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.

    Another OS uses a fixed-point decaying average,
    with this sort of representation:
    0x8000 is 100%
    0x2000 is 25%
    0x0000 is 0%

    Anybody have a version of the algorithm that...

    * works with traditional 100 HZ ticks
    * works with exact (TSC-based) accounting
    * lets a thread-group sum to well over 100%
    * doesn't require updates to idle processes

    ???

    I'm thinking it would be nice to have the
    binary point be between a pair of 32-bit ints.
    That might allow for great range w/o doing
    lots of "long long" operations, but I haven't
    worked out the details.

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Nick Piggin: "Re: decaying average for %CPU"

    Relevant Pages

    • Re: dynamic-hz
      ... > I had variable Hz in my tree for a while and found there was one solitary ... > purpose to setting Hz to 100; ... > because of the woefully inaccurate cpu usage calcuation at 100Hz. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Busy-wait delay in qmail 1.03 after upgrading to Linux 2.6
      ... >> upgrading to 2.6 was that disk intensive jobs, such as updating ... >> the slocate database, made ascpu report 100% CPU usage. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] cpufreq_ondemand
      ... > Alexander Clouter wrote: ... > I'd much prefer it shot up to 100% or else every time the cpu usage went ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Problem burning Audio CDs
      ... > I noticed that the CPU usage is alot higher in the caes where it fails ... Seems to work here running 2.6.9 using a NEC DVD writer. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Issues with INET sockets through loopback (lo)
      ... Athlon XP 1900+, using a self compiled 2.4.29 kernel. ... Far from full CPU usage. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)