All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <piggin@cyberone.com.au>
To: Albert Cahalan <albert@users.sourceforge.net>
Cc: linux-kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: decaying average for %CPU
Date: Fri, 17 Oct 2003 13:21:04 +1000	[thread overview]
Message-ID: <3F8F6020.2040206@cyberone.com.au> (raw)
In-Reply-To: <1066359629.15920.161.camel@cube>



Albert Cahalan wrote:

>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
>

But your userspace program can calculate deltas in the total
CPU statistics. Yep, its in /proc/stat.

>
>>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
>

load average is not CPU load though



  reply	other threads:[~2003-10-17  3:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-17  2:35 decaying average for %CPU Albert Cahalan
2003-10-17  2:56 ` Nick Piggin
2003-10-17  3:00   ` Albert Cahalan
2003-10-17  3:21     ` Nick Piggin [this message]
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=3F8F6020.2040206@cyberone.com.au \
    --to=piggin@cyberone.com.au \
    --cc=albert@users.sourceforge.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.