Add a useful --tools option to vg_perf, which lets you override the "tools"
line in the .vgperf files from the command line.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6363 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/perf/vg_perf.in b/perf/vg_perf.in
index 64e4e7c..c9d6d95 100644
--- a/perf/vg_perf.in
+++ b/perf/vg_perf.in
@@ -63,7 +63,8 @@
   options for the user, with defaults in [ ], are:
     -h --help             show this message
     --all                 run all tests under this directory
-    --reps                number of repeats for each program [3]
+    --reps=<n>            number of repeats for each program [1]
+    --tools=<t1,t2,t3>    tools to run (overrides .vgperf "tools" line)
     --vg                  Valgrind(s) to measure (can be specified multiple
                             times).  The "in-place" build is used.
                             [Valgrind in the current directory]
@@ -79,8 +80,9 @@
 my @tools;              # which tools are we measuring the program with
 
 # Command line options
-my $n_reps = 1;     # Run each program $n_reps times and choose the best one.
-my @vgdirs;         # Dirs of the various Valgrinds being measured.
+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_specified = 0; # Indicates if --tools was given.
 
 my $num_tests_done   = 0;
 my $num_timings_done = 0;
@@ -149,6 +151,9 @@
             } elsif ($arg =~ /^--vg=(.+)$/) {
                 # Make dir absolute if not already
                 add_vgdir($1);
+            } elsif ($arg =~ /^--tools=(.+)$/) {
+                @tools = split(/,/, $1);
+                $tools_specified = 1
             } else {
                 die $usage;
             }
@@ -195,7 +200,10 @@
         } elsif ($line =~ /^\s*prog:\s*(.*)$/) {
             $prog = validate_program(".", $1, 1, 1);
         } elsif ($line =~ /^\s*tools:\s*(.*)$/) {
-            @tools = validate_tools($1);
+            # Only use the "tools:" line if --tools wasn't specified.
+            if ($tools_specified == 0) {
+                @tools = validate_tools($1);
+            }
         } elsif ($line =~ /^\s*args:\s*(.*)$/) {
             $args = $1;
         } elsif ($line =~ /^\s*prereq:\s*(.*)$/) {