On Tue, 11 Sep 2012 20:53:07 -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <a...@redhat.com>
>
> So that we can remove all the globals.
>
> Before:
>
>    text          data     bss     dec     hex filename
> 1586833        110368 1438600 3135801  2fd939 /tmp/oldperf
>
> After:
>
>    text          data     bss     dec     hex filename
> 1629329         93568  848328 2571225  273bd9 /root/bin/perf
>

Just a nitpick below.

[snip]
> -static void print_bad_events(void)
> +static void print_bad_events(struct perf_sched *sched)
>  {
> -     if (nr_unordered_timestamps && nr_timestamps) {
> +     if (sched->nr_unordered_timestamps && sched->nr_timestamps) {
>               printf("  INFO: %.3f%% unordered timestamps (%ld out of %ld)\n",
> -                     
> (double)nr_unordered_timestamps/(double)nr_timestamps*100.0,
> -                     nr_unordered_timestamps, nr_timestamps);
> +                     
> (double)sched->nr_unordered_timestamps/(double)sched->nr_timestamps*100.0,

Isn't it sufficient to use this?

                        100.0 * sched->nr_unordered_timestamps / 
sched->nr_timestamps;

Ditto for belows.

Thanks,
Namhyung


> +                     sched->nr_unordered_timestamps, sched->nr_timestamps);
>       }
> -     if (nr_lost_events && nr_events) {
> +     if (sched->nr_lost_events && sched->nr_events) {
>               printf("  INFO: %.3f%% lost events (%ld out of %ld, in %ld 
> chunks)\n",
> -                     (double)nr_lost_events/(double)nr_events*100.0,
> -                     nr_lost_events, nr_events, nr_lost_chunks);
> +                     (double)sched->nr_lost_events/(double)sched->nr_events 
> * 100.0,
> +                     sched->nr_lost_events, sched->nr_events, 
> sched->nr_lost_chunks);
>       }
> -     if (nr_state_machine_bugs && nr_timestamps) {
> +     if (sched->nr_state_machine_bugs && sched->nr_timestamps) {
>               printf("  INFO: %.3f%% state machine bugs (%ld out of %ld)",
> -                     
> (double)nr_state_machine_bugs/(double)nr_timestamps*100.0,
> -                     nr_state_machine_bugs, nr_timestamps);
> -             if (nr_lost_events)
> +                     
> (double)sched->nr_state_machine_bugs/(double)sched->nr_timestamps*100.0,
> +                     sched->nr_state_machine_bugs, sched->nr_timestamps);
> +             if (sched->nr_lost_events)
>                       printf(" (due to lost events?)");
>               printf("\n");
>       }
> -     if (nr_context_switch_bugs && nr_timestamps) {
> +     if (sched->nr_context_switch_bugs && sched->nr_timestamps) {
>               printf("  INFO: %.3f%% context switch bugs (%ld out of %ld)",
> -                     
> (double)nr_context_switch_bugs/(double)nr_timestamps*100.0,
> -                     nr_context_switch_bugs, nr_timestamps);
> -             if (nr_lost_events)
> +                     
> (double)sched->nr_context_switch_bugs/(double)sched->nr_timestamps*100.0,
> +                     sched->nr_context_switch_bugs, sched->nr_timestamps);
> +             if (sched->nr_lost_events)
>                       printf(" (due to lost events?)");
>               printf("\n");
>       }
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to