pcp
[Top] [All Lists]

Re: [pcp] proc/interrupts parsing fix for large CPU counts

To: Arthur Kepner <akepner@xxxxxxx>
Subject: Re: [pcp] proc/interrupts parsing fix for large CPU counts
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Thu, 27 Jan 2011 09:48:07 +1100
Cc: pcp@xxxxxxxxxxx
In-reply-to: <20110126213328.GB10691@xxxxxxx>
References: <20110126213328.GB10691@xxxxxxx>
Reply-to: kenj@xxxxxxxxxxxxxxxx
Thanks Arthur ... I'll commit this patch.

But, can some who's familiar with the code in this area please cast an
eye over the proc_interrupts->syscall[cpu] and is_syscall code in this
same source file.

a) the is_syscall logic does not seem right compared to
the /proc/interrupts contents on my local system, and

b) proc_interrupts->syscall[cpu] is set but never returned in a
fetch ... which is why the apparent error in a) has not been noticed?

These oddities are independent of the other interrupts metrics that
Arthur's patch accommodates.

On Wed, 2011-01-26 at 13:33 -0800, Arthur Kepner wrote:
> The linux pmda assumes that /proc/interrupts contains lines formatted 
> like so:
> 
> 123:   1    2   3   .....
> 
> i.e., the interrupt number is precisely 3 characters wide. It's 
> usually 4 characters wide on larger systems.
> 
> This fixes it.
> 
> --- 
> diff --git a/src/pmdas/linux/proc_interrupts.c 
> b/src/pmdas/linux/proc_interrupts.c
> index 63045c2..5b13a0b 100644
> --- a/src/pmdas/linux/proc_interrupts.c
> +++ b/src/pmdas/linux/proc_interrupts.c
> @@ -73,9 +73,9 @@ refresh_proc_interrupts(proc_interrupts_t *proc_interrupts)
>      }
>  
>      while (fgets(buf, sizeof(buf), fp) != NULL) {
> -     if (buf[3] != ':')
> +     s = strchr(buf, ':');
> +     if (s == NULL)
>           continue;
> -     s = buf + 3;
>       is_syscall = 0;
>  
>       if (sscanf(buf, "%u:", &intr) != 1) {
> 
> _______________________________________________
> pcp mailing list
> pcp@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/pcp


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