pcp
[Top] [All Lists]

Re: kernel.all.uptime units

To: <kenmcd@xxxxxxx>
Subject: Re: kernel.all.uptime units
From: "Mike Mason" <mmlnx@xxxxxxxxxx>
Date: Fri, 4 Jan 2002 17:48:52 -0800
Cc: <pcp@xxxxxxxxxxx>
References: <Pine.SGI.4.40.0201050626430.962756-100000@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: owner-pcp@xxxxxxxxxxx
On Fri, 4 Jan 2002, Ken McDonell wrote:

>> I'm looking into converting "top" to use PCP.  Top
>> displays uptime in days, hours and minutes, but I can't get an accurate
>> minute count out of PCP.  Can kernel.all.uptime be changed to minute units
>> or do I need to add another uptime metric for that?
>
>Unless someone can contribute a good reason, I'd suggest just change it
>and send us the patch.

OK, here's a patch that changes the units for kernel.all.uptime from
hours to seconds.  It applies against pcp-2.2.2.

Regards,
Mike

--- src/pmdas/linux/pmda.c.orig Fri Jan  4 17:01:43 2002
+++ src/pmdas/linux/pmda.c      Fri Jan  4 16:21:24 2002
@@ -427,7 +427,7 @@
 /* kernel.all.uptime */
     { NULL,
       { PMDA_PMID(CLUSTER_STAT,49), PM_TYPE_U32, PM_INDOM_NULL, 
PM_SEM_INSTANT, 
-      PMDA_PMUNITS(0,1,1,0,PM_TIME_HOUR,PM_COUNT_ONE) }, },
+      PMDA_PMUNITS(0,1,1,0,PM_TIME_SEC,PM_COUNT_ONE) }, },
 
 
 /*
@@ -2641,10 +2641,10 @@
 
            case 49:
                /*
-                * kernel.all.uptime in hours
+                * kernel.all.uptime in seconds
                 * contributed by 'gilly' <gilly@xxxxxxxxxx>
                 */
-               atom->ul = (u_long)(times(NULL)) / (proc_stat.hz * 60 * 60);
+               atom->ul = (u_long)(times(NULL)) / (proc_stat.hz);
                break;
 
            default:

---
Mike Mason
Software Engineer
IBM Linux Technology Center, RAS Group
Beaverton, Oregon, USA
phone: (503) 578-4123    tie line: 775-4123
mmlnx@xxxxxxxxxx         fax: (503) 578-4700



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