pcp
[Top] [All Lists]

Re: [PATCH] Fix Linux PMDA CPU time metrics

To: Michael Newton <kimbrr@xxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH] Fix Linux PMDA CPU time metrics
From: Nathan Scott <nscott@xxxxxxxxxx>
Date: Thu, 08 Feb 2007 13:30:05 +1100
Cc: Mark Goodwin <markgw@xxxxxxx>, pcp@xxxxxxxxxxx, Daniel Moore <dxm@xxxxxxxxxxxxxxxxx>
In-reply-to: <Pine.SGI.4.58.0702081203400.116155503@snort.melbourne.sgi.com>
Organization: Aconex
References: <1164090739.4695.301.camel@edge> <Pine.SGI.4.58.0702081203400.116155503@snort.melbourne.sgi.com>
Reply-to: nscott@xxxxxxxxxx
Sender: pcp-bounce@xxxxxxxxxxx
Hi Michael,

On Thu, 2007-02-08 at 12:10 +1100, Michael Newton wrote:
> ...
> Looks to me like your "else if" clause will never happen.. aren't you
> missing a variable to contain the 3rd element of the release number
> (major.minor.missing) ? Only thing im not sure on is, did linux
> kernel release nums always have 3 components, or do we have to handle
> the possibility that earlier ones may have only 2?

Right you are - good catch.  I've written a little test program
(attached) to test out a few combinations, and a fixed patch is
also attached.  I'm not sure if there were early releases (pre-
2.6) that had only two release numbers, but the code now handles
it just in case (done with just the one sscanf, so no noticable
extra complexity in handling it)...

13:15 nathans@edge ~ 894> cc x.c
13:15 nathans@edge ~ 895> ./a.out 2.4
i=2 major=2 minor=4 release=0
13:15 nathans@edge ~ 896> ./a.out 2.4.2
i=3 major=2 minor=4 release=2
13:18 nathans@edge ~ 897> 

> PS: im not sure if you got the news Daniel is now my (immediate) boss

Nope, hadn't heard (though I did hear about mini-dxm, congratulations!).

cheers.

-- 
Nathan

Attachment: x.c
Description: Text Data

Attachment: fix-linux-percpu-metrics
Description: Text Data

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