All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Cahalan <albert@users.sf.net>
To: linux-kernel mailing list <linux-kernel@vger.kernel.org>
Subject: decaying average for %CPU
Date: 16 Oct 2003 22:35:55 -0400	[thread overview]
Message-ID: <1066358155.15931.145.camel@cube> (raw)

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.



             reply	other threads:[~2003-10-17  2:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-17  2:35 Albert Cahalan [this message]
2003-10-17  2:56 ` decaying average for %CPU Nick Piggin
2003-10-17  3:00   ` Albert Cahalan
2003-10-17  3:21     ` Nick Piggin
2003-10-17  4:17       ` Albert Cahalan
2003-10-17 22:48         ` Nick Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1066358155.15931.145.camel@cube \
    --to=albert@users.sf.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.