lkml.org 
[lkml]   [2012]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 15/18] perf sched: Use perf_tool as ancestor
Date
On Tue, 11 Sep 2012 20:53:07 -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@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");
> }
> }


\
 
 \ /
  Last update: 2012-09-12 04:01    [W:0.108 / U:26.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site