Index: tools/run_perf.py |
diff --git a/tools/run_perf.py b/tools/run_perf.py |
index 20a6537990ac8330b87c65a27841ad087e220088..501aacedbbc05fe8582a65349cd34662a5649231 100755 |
--- a/tools/run_perf.py |
+++ b/tools/run_perf.py |
@@ -310,13 +310,14 @@ class Runnable(Graph): |
bench_dir = os.path.normpath(os.path.join(*self.path)) |
os.chdir(os.path.join(suite_dir, bench_dir)) |
- def GetCommandFlags(self): |
+ def GetCommandFlags(self, extra_flags=None): |
suffix = ["--"] + self.test_flags if self.test_flags else [] |
- return self.flags + [self.main] + suffix |
+ return self.flags + (extra_flags or []) + [self.main] + suffix |
- def GetCommand(self, shell_dir): |
+ def GetCommand(self, shell_dir, extra_flags=None): |
# TODO(machenbach): This requires +.exe if run on windows. |
- return [os.path.join(shell_dir, self.binary)] + self.GetCommandFlags() |
+ cmd = [os.path.join(shell_dir, self.binary)] |
+ return cmd + self.GetCommandFlags(extra_flags=extra_flags) |
kjellander_chromium
2015/05/13 13:23:55
Do you have to pass them into GetCommandFlags beca
Michael Achenbach
2015/05/13 13:49:43
Yes they have to come before suffix as it contains
|
def Run(self, runner): |
"""Iterates over several runs and handles the output for all traces.""" |
@@ -474,6 +475,7 @@ class Platform(object): |
class DesktopPlatform(Platform): |
def __init__(self, options): |
self.shell_dir = options.shell_dir |
+ self.extra_flags = options.extra_flags.split() |
kjellander_chromium
2015/05/13 13:23:55
Move this whole constructor to Platform class to r
Michael Achenbach
2015/05/13 13:49:43
Will do. Followup coming...
|
def PreExecution(self): |
pass |
@@ -487,8 +489,10 @@ class DesktopPlatform(Platform): |
def Run(self, runnable, count): |
try: |
- output = commands.Execute(runnable.GetCommand(self.shell_dir), |
- timeout=runnable.timeout) |
+ output = commands.Execute( |
+ runnable.GetCommand(self.shell_dir, self.extra_flags), |
+ timeout=runnable.timeout, |
+ ) |
except OSError as e: |
print ">>> OSError (#%d):" % (count + 1) |
print e |
@@ -509,6 +513,7 @@ class AndroidPlatform(Platform): # pragma: no cover |
def __init__(self, options): |
self.shell_dir = options.shell_dir |
+ self.extra_flags = options.extra_flags.split() |
LoadAndroidBuildTools(options.android_build_tools) |
kjellander_chromium
2015/05/13 13:23:55
Then this would just invoke the superclass constru
|
if not options.device: |
@@ -596,7 +601,7 @@ class AndroidPlatform(Platform): # pragma: no cover |
cache = cache_control.CacheControl(self.device) |
cache.DropRamCaches() |
binary_on_device = AndroidPlatform.DEVICE_DIR + runnable.binary |
- cmd = [binary_on_device] + runnable.GetCommandFlags() |
+ cmd = [binary_on_device] + runnable.GetCommandFlags(self.extra_flags) |
# Relative path to benchmark directory. |
if runnable.path: |
@@ -636,6 +641,9 @@ def Main(args): |
parser.add_option("--device", |
help="The device ID to run Android tests on. If not given " |
"it will be autodetected.") |
+ parser.add_option("--extra-flags", |
+ help="Additional flags to pass to the test executable", |
+ default="") |
parser.add_option("--json-test-results", |
help="Path to a file for storing json results.") |
parser.add_option("--outdir", help="Base directory with compile output", |