From 2d23b84499cb2862f011b091ff3b3300d458337d Mon Sep 17 00:00:00 2001 From: Ivo Raisr Date: Sat, 22 Jul 2017 05:10:05 +0000 Subject: [PATCH] New command line option "--terse" for vg_perf. Fixes BZ#382407. Produces the following terse output: -- bigcode1 -- vanilla : no: ----- me: ----- ca: ----- he: ----- ca: ----- dr: ----- ma: ----- ra3-005 : no: 0.0% me: -4.7% ca: 0.2% he: -1.1% ca: -1.5% dr: -0.6% ma: 0.0% ra3-005-J : no: 0.0% me: 0.4% ca: 0.3% he: -0.5% ca: -0.9% dr: 0.0% ma: 0.6% ra3-006 : no: 0.0% me: 0.4% ca: 0.2% he: -0.0% ca: -1.2% dr: 0.0% ma: 0.0% ra3-007 : no: 0.0% me: 0.7% ca: 0.5% he: -0.5% ca: -0.6% dr: 0.0% ma: 1.2% instead the full output (when the option is not used): -- bigcode1 -- bigcode1 vanilla:0.09s no: 1.6s (18.0x, -----) me: 3.1s (35.0x, -----) ca:12.7s (140.8x, -----) he: 2.0s (22.8x, -----) ca: 3.7s (41.2x, -----) dr: 2.0s (22.2x, -----) ma: 1.9s (20.7x, -----) bigcode1 ra3-005:0.09s no: 1.6s (17.8x, 1.2%) me: 3.0s (33.3x, 4.8%) ca:12.7s (140.7x, 0.1%) he: 2.0s (22.2x, 2.4%) ca: 3.6s (40.2x, 2.4%) dr: 1.9s (21.7x, 2.5%) ma: 1.9s (20.7x, 0.0%) git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16461 --- NEWS | 1 + perf/vg_perf.in | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 1c33d6581d..47ddc77ba1 100644 --- a/NEWS +++ b/NEWS @@ -43,6 +43,7 @@ where XXXXXX is the bug number as listed below. 381769 Use ucontext_t instead of struct ucontext 381805 arm32 needs ld.so index hardwire for new glibc security fixes 382256 gz compiler flag test doesn't work for gold +382407 vg_perf needs "--terse" command line option Release 3.13.0 (15 June 2017) diff --git a/perf/vg_perf.in b/perf/vg_perf.in index 727857f2d4..d3e8ce9270 100644 --- a/perf/vg_perf.in +++ b/perf/vg_perf.in @@ -67,6 +67,8 @@ usage: vg_perf [options] [files or dirs] [Valgrind in the current directory, i.e. --vg=.] Can be specified multiple times. The "in-place" build is used. + --terse: terse output. Prints only program name and speedup's for specified + tools. --outer-valgrind: run these Valgrind(s) under the given outer valgrind. These Valgrind(s) must be configured with --enable-inner. @@ -92,6 +94,7 @@ my $cleanup; # cleanup command to run my $n_reps = 1; # Run each test $n_reps times and choose the best one. my @vgdirs; # Dirs of the various Valgrinds being measured. my @tools = ("none", "memcheck"); # tools being measured +my $terse = 0; # Terse output. # Outer valgrind to use, and args to use for it. # If this is set, --valgrind should be set to the installed inner valgrind, @@ -158,6 +161,8 @@ sub process_command_line() add_vgdir($1); } elsif ($arg =~ /^--tools=(.+)$/) { @tools = split(/,/, $1); + } elsif ($arg =~ /^--terse$/) { + $terse = 1; } elsif ($arg =~ /^--outer-valgrind=(.*)$/) { $outer_valgrind = $1; } elsif ($arg =~ /^--outer-tool=(.*)$/) { @@ -307,15 +312,19 @@ sub do_one_test($$) foreach my $vgdir (@vgdirs) { # Benchmark name - printf("%-8s ", $name); + if (!$terse) { + printf("%-8s ", $name); + } # Print the Valgrind version if we are measuring more than one. my $vgdirname = $vgdir; chomp($vgdirname = `basename $vgdir`); printf("%-10s:", $vgdirname); - + # Native execution time - printf("%4.2fs", $tNative); + if (!$terse) { + printf("%4.2fs", $tNative); + } foreach my $tool (@tools) { # First two chars of toolname for abbreviation @@ -371,7 +380,9 @@ sub do_one_test($$) } my $cmd = "$vgsetup $timecmd $vgcmd $prog $args"; my $tTool = time_prog($cmd, $n_reps); - printf("%4.1fs (%4.1fx,", $tTool, $tTool/$tNative); + if (!$terse) { + 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 @@ -379,10 +390,13 @@ sub do_one_test($$) # the speedup. if (not defined $first_tTool{$tool}) { $first_tTool{$tool} = $tTool; - print(" -----)"); + print(" -----"); } else { my $speedup = 100 - (100 * $tTool / $first_tTool{$tool}); - printf("%5.1f%%)", $speedup); + printf("%5.1f%%", $speedup); + } + if (!$terse) { + print(")"); } $num_timings_done++; -- 2.47.2