Skip to content

Commit

Permalink
perf/trace/scripting: wakeup-latency script cleanup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tom Zanussi authored and Arnaldo Carvalho de Melo committed May 10, 2010
1 parent e88a4bf commit e366728
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/perf/scripts/perl/wakeup-latency.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

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
{
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit e366728

Please sign in to comment.