diff options
author | Tom Zanussi <tzanussi@gmail.com> | 2010-05-10 00:46:55 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-05-10 18:50:57 -0400 |
commit | e366728d57cb8c708f76b282ae194c6044355b5f (patch) | |
tree | 0a9229172640214241a5b69c49b5655709b204d8 /tools/perf/scripts | |
parent | e88a4bfbcda440b1c6b9d5a31a554a6ad9686182 (diff) |
perf/trace/scripting: wakeup-latency script cleanup
Some minor fixes for the wakeup-latency script:
- Fix nuisance 'use of uninitialized value' warnings
- Avoid divide-by-zero error
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1273466820-9330-5-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts')
-rw-r--r-- | tools/perf/scripts/perl/wakeup-latency.pl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/perf/scripts/perl/wakeup-latency.pl b/tools/perf/scripts/perl/wakeup-latency.pl index ed58ef284e23..d9143dcec6c6 100644 --- a/tools/perf/scripts/perl/wakeup-latency.pl +++ b/tools/perf/scripts/perl/wakeup-latency.pl | |||
@@ -22,8 +22,8 @@ my %last_wakeup; | |||
22 | 22 | ||
23 | my $max_wakeup_latency; | 23 | my $max_wakeup_latency; |
24 | my $min_wakeup_latency; | 24 | my $min_wakeup_latency; |
25 | my $total_wakeup_latency; | 25 | my $total_wakeup_latency = 0; |
26 | my $total_wakeups; | 26 | my $total_wakeups = 0; |
27 | 27 | ||
28 | sub sched::sched_switch | 28 | sub sched::sched_switch |
29 | { | 29 | { |
@@ -67,8 +67,12 @@ sub trace_end | |||
67 | { | 67 | { |
68 | printf("wakeup_latency stats:\n\n"); | 68 | printf("wakeup_latency stats:\n\n"); |
69 | print "total_wakeups: $total_wakeups\n"; | 69 | print "total_wakeups: $total_wakeups\n"; |
70 | printf("avg_wakeup_latency (ns): %u\n", | 70 | if ($total_wakeups) { |
71 | avg($total_wakeup_latency, $total_wakeups)); | 71 | printf("avg_wakeup_latency (ns): %u\n", |
72 | avg($total_wakeup_latency, $total_wakeups)); | ||
73 | } else { | ||
74 | printf("avg_wakeup_latency (ns): N/A\n"); | ||
75 | } | ||
72 | printf("min_wakeup_latency (ns): %u\n", $min_wakeup_latency); | 76 | printf("min_wakeup_latency (ns): %u\n", $min_wakeup_latency); |
73 | printf("max_wakeup_latency (ns): %u\n", $max_wakeup_latency); | 77 | printf("max_wakeup_latency (ns): %u\n", $max_wakeup_latency); |
74 | 78 | ||