pcp
[Top] [All Lists]

Re: linux pmda

To: kenmcd@xxxxxxx
Subject: Re: linux pmda
From: Mark Goodwin <markgw@xxxxxxx>
Date: Tue, 31 Jul 2001 13:05:30 +1000 (EST)
Cc: gilly@xxxxxxxxxx, pcp@xxxxxxxxxxx
In-reply-to: <Pine.SGI.4.32.0107270350210.2500674-100000@rattle.melbourne.sgi.com>
Sender: owner-pcp@xxxxxxxxxxx
On Mon, 30 Jul 2001, Ken McDonell wrote:

> From: "gilly" <gilly@xxxxxxxxxx>
> To: <pcp@xxxxxxxxxxx>
> Subject: linux pmda
> Date: Thu, 26 Jul 2001 20:31:39 +0200
> 
>  Hi
> 1. There might be a bug in the linux pmda concerning the cpu utilization
> statistics.
> In the pmda.c file the calculations for kernel.all.cpu.* metrics are
> calculated 'dangerously', the 'user' stat for example -
> "atom->ul = 1000 * proc_stat.user / proc_stat.hz" - multiplying by 1000
> might be bigger than u_int and the result is wrong.
> attached a patch.
> 
> thanks in advance,
> gilly
> ----------
> 
> 1. Does look like a bug and Mark Goodwin will investigate as time permits.
>    The only good thing is that when the premature overflow does occur you
>    get one bogus value, and there after the _rate_ of change is probably
>    goinf to be correct, at least until the next premature overflow.

Gilly, I have looked at your proposed fix, and applied a similar change
to that proposed for the kernel.all.cpu.* and kernel.percpu.cpu.* metrics,
as follows:

Original (overflow problems) :
    atom->ul = 1000 * proc_stat.user / proc_stat.hz;

Your proposed fix (avoids overflow, but looses precision) :
    atom->ul = (double)((proc_stat.user / proc_stat.hz)) * 1000;

Final fix: (avoids overflow and preserves precision) :
    atom->ul = 1000 * (double)proc_stat.user / proc_stat.hz;


> 2. How can I add a new metric to the linux pmda?
> I would like to add 'uptime' metric (under kernel.all) to show the time the
> system is running.
> I'm not sure how to add this metric to the linux pmda, it seems I can't use
> the pmnsadd / pmnsmerge / pmnsdel utilities because 'root_linux' is not in a
> fit format.
> Am I supposed to build a new default PMNS?
> 

Ken already answered your general questions. In any case, I noticed
the file you attached had some of the work done for the new metric
kernel.all.uptime, so I finished it off, with due acknowledgement.
The new metric is a count of the number of hours since boot, with
instantaneous semantics (i.e. not counter).

sherman 46% pminfo -h sandpit -fmdt kernel.all.uptime

kernel.all.uptime PMID: 60.0.49 [time the current kernel has been running]
    Data Type: 32-bit unsigned int  InDom: PM_INDOM_NULL 0xffffffff
    Semantics: instant  Units: hour count
    value 356

Does this sound reasonable? Would people prefer minutes or seconds? Or
would that only be relevant for a Windows PMDA? ;-)

Which reminds me, was someone attempting a win32/cygwin port? Any progress?

thanks
-- Mark

ps: in the future, please send patches like the one attached
rather than whole files. The latter overflows the mail server
at oss.sgi.com, resulting in bounced meesages.

Attachment: patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>