[PATCH] powertop: code shrink -- more and more robust process_timer_stats

Denys Vlasenko vda.linux at googlemail.com
Thu Nov 4 22:23:29 UTC 2010


On Thursday 04 November 2010 15:18, Alex Landau wrote:
> Hi,
> 
> > -        nr = -1;
> > -        if (buf[0] != ' ' && !isdigit(buf[0])) {
> > -//TODO: optimize
> > -            if (strncmp(buf, "NMI:", 4) == 0)
> > -                nr = 20000;
> > -            if (strncmp(buf, "RES:", 4) == 0)
> > -                nr = 20001;
> > -            if (strncmp(buf, "CAL:", 4) == 0)
> > -                nr = 20002;
> > -            if (strncmp(buf, "TLB:", 4) == 0)
> > -                nr = 20003;
> > -            if (strncmp(buf, "TRM:", 4) == 0)
> > -                nr = 20004;
> > -            if (strncmp(buf, "THR:", 4) == 0)
> > -                nr = 20005;
> > -            if (strncmp(buf, "SPU:", 4) == 0)
> > -                nr = 20006;
> > +        nr = index_in_substrings("NMI\0RES\nCAL\0TLB\0TRM\0THR\0SPU\0", buf);
> > +        if (nr != -1) {
> > +            nr += 20000;
> 
> From a cursory look at the patch, it looks like it should be \0 instead of \n 
> between RES and CAL.

Thanks! Fixed.
-- 
vda


More information about the busybox mailing list