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

Alex Landau landau_alex at yahoo.com
Thu Nov 4 14:18:22 UTC 2010


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.

Regards,
Alex



----- Original Message ----
> From: Maksym Kryzhanovskyy <xmaks at email.cz>
> To: Denys Vlasenko <vda.linux at googlemail.com>
> Cc: busybox at busybox.net
> Sent: Thu, November 4, 2010 12:21:00 AM
> Subject: Re: [PATCH] powertop: code shrink -- more and more robust 
>process_timer_stats
> 
> Attached is a more robust patch for powertop. Sorry for the message  flood.
> 
> ------------------------------------------------------------------------------
> (add/remove:  0/0 grow/shrink: 2/3 up/down: 10/-342)          Total:  -332 
>bytes
>    text       data         bss        dec         hex    filename
>  743482        2107       9092     754681       b83f9    busybox_old
>  743150        2107       9092     754349       b82ad    busybox_unstripped
> 
> Max
> 
> > Hi  Denis,
> > 
> > attached is extended the previous patch for powertop.  Please review and 
>consider
> > usage.
> > 
> > 
> > !!! I did  not test it on Rob's Aboriginal Linux
> > ...
> >  
>------------------------------------------------------------------------------
> >  (add/remove: 0/0 grow/shrink: 2/3 up/down: 10/-304)           Total: -294 
>bytes
> >    text        data        bss         dec        hex    filename
> >   743482       2107        9092     754681      b83f9     busybox_old
> >  743188        2107       9092     754387       b82d3    busybox_unstripped
> > 
> > 
> >  Max
> > 
> > > Hi Denis,
> > > 
> > > attached is a  patch for powertop. Please review and consider usage.
> > > 
> > > 
> > > Max
> > > 
> > > 
> > 
> > 


      


More information about the busybox mailing list