Merge branch 'bkl/procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic...
[linux-2.6-block.git] / tools / perf / scripts / perl / wakeup-latency.pl
index ed58ef284e235a31ac7e4731418ec34eb9cba4d0..d9143dcec6c601c3b544fbc3a87fe7c1f29d4e70 100644 (file)
@@ -22,8 +22,8 @@ my %last_wakeup;
 
 my $max_wakeup_latency;
 my $min_wakeup_latency;
-my $total_wakeup_latency;
-my $total_wakeups;
+my $total_wakeup_latency = 0;
+my $total_wakeups = 0;
 
 sub sched::sched_switch
 {
@@ -67,8 +67,12 @@ sub trace_end
 {
     printf("wakeup_latency stats:\n\n");
     print "total_wakeups: $total_wakeups\n";
-    printf("avg_wakeup_latency (ns): %u\n",
-          avg($total_wakeup_latency, $total_wakeups));
+    if ($total_wakeups) {
+       printf("avg_wakeup_latency (ns): %u\n",
+              avg($total_wakeup_latency, $total_wakeups));
+    } else {
+       printf("avg_wakeup_latency (ns): N/A\n");
+    }
     printf("min_wakeup_latency (ns): %u\n", $min_wakeup_latency);
     printf("max_wakeup_latency (ns): %u\n", $max_wakeup_latency);