diff options
author | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2005-12-15 17:22:37 +0000 |
---|---|---|
committer | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2005-12-15 17:22:37 +0000 |
commit | 30e23acea7365b32075ff36bc9648f8ac84170e0 (patch) | |
tree | f3d2ac60c83627f7c25d8642b65c531bacfa422a /perf | |
parent | 0d3a1a8d87cfcd14d2daaf1ae752984c4119086f (diff) |
Improvments to vg_perf:
- show percentage speedup over the first Valgrind when comparing multiple
Valgrind
- don't accept --reps < 0
- avoid div-by-zero if the runtime is measured as zero
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5348 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'perf')
-rw-r--r-- | perf/vg_perf.in | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/perf/vg_perf.in b/perf/vg_perf.in index 2e4b3520..887cc969 100644 --- a/perf/vg_perf.in +++ b/perf/vg_perf.in @@ -153,6 +153,7 @@ sub process_command_line() $alldirs = 1; } elsif ($arg =~ /^--reps=(\d+)$/) { $n_reps = $1; + if ($n_reps < 1) { die "bad --reps value: $n_reps\n"; } } elsif ($arg =~ /^--vg=(.+)$/) { # Make dir absolute if not already add_vgdir($1); @@ -255,7 +256,8 @@ sub time_prog($$) die "\n*** missing usertime in perf.stderr\n"; $tmin = $1 if ($1 < $tmin); } - return $tmin; + # Avoid divisions by zero! + return (0 == $tmin ? 0.01 : $tmin); } sub do_one_test($$) @@ -263,6 +265,8 @@ sub do_one_test($$) my ($dir, $vgperf) = @_; $vgperf =~ /^(.*)\.vgperf/; my $name = $1; + my %first_tTool; # For doing percentage speedups when comparing + # multiple Valgrinds read_vgperf_file($vgperf); @@ -307,7 +311,19 @@ sub do_one_test($$) . "$vgopts "; my $cmd = "$vgsetup $timecmd $vgcmd $prog $args"; my $tTool = time_prog($cmd, $n_reps); - printf("%4.1fs (%4.1fx) ", $tTool, $tTool/$tNative); + printf("%4.1fs (%4.1fx,", $tTool, $tTool/$tNative); + + # If it's the first timing for this tool on this benchmark, + # record the time so we can get the percentage speedup of the + # subsequent Valgrinds. Otherwise, compute and print + # the speedup. + if (not defined $first_tTool{$tool}) { + $first_tTool{$tool} = $tTool; + print(" -----) "); + } else { + my $speedup = 100 - (100 * $tTool / $first_tTool{$tool}); + printf("%5.1f%%) ", $speedup); + } $num_timings_done++; |