Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: tools/run_perf.py

Issue 1915303002: [tools] Specify affinity and raise priority when benchmarking (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/run_perf.py
diff --git a/tools/run_perf.py b/tools/run_perf.py
index db4245f499fc07c3a32f435a78ec08d5f06f58a3..f2c881e7e463eb733d6d919f00263b3f76aa4938 100755
--- a/tools/run_perf.py
+++ b/tools/run_perf.py
@@ -612,6 +612,19 @@ class Platform(object):
class DesktopPlatform(Platform):
def __init__(self, options):
super(DesktopPlatform, self).__init__(options)
+ self.command_prefix = []
+ if options.prioritize or options.affinitize != None:
+ self.command_prefix = ["sudo", "schedtool"]
+ if options.prioritize:
+ self.command_prefix += ["-p", "-20"]
Michael Achenbach 2016/04/27 14:55:00 My documentation says: -p STATIC_PRIORITY u
Mircea Trofin 2016/04/27 15:56:35 Ugh. should be -n, not -p. Thanks.
+ if options.affinitize != None:
+ # schedtool expects a bit pattern when setting affinity, where each
+ # bit set to '1' corresponds to a core where the process may run on.
+ # 0 corresponds to CPU 0. Since the 'affinitize' parameter is a core number, we need
+ # to map to said bit pattern.
+ core = (1 << int(options.affinitize)) - 1
+ self.command_prefix += ["-a", str(core)]
Michael Achenbach 2016/04/27 14:55:00 So if options.affinitize == 2, this is set to "-a
Mircea Trofin 2016/04/27 15:56:35 Oh, that's a bug, indeed. It should be core = if
Michael Achenbach 2016/04/27 17:23:29 Could you add in a comment an example of how this
Mircea Trofin 2016/04/28 02:07:24 Done.
+ self.command_prefix += ["-e"]
def PreExecution(self):
pass
@@ -627,10 +640,11 @@ class DesktopPlatform(Platform):
suffix = ' - without patch' if no_patch else ''
shell_dir = self.shell_dir_no_patch if no_patch else self.shell_dir
title = ">>> %%s (#%d)%s:" % ((count + 1), suffix)
+ command = self.command_prefix + runnable.GetCommand(shell_dir, self.extra_flags)
try:
output = commands.Execute(
- runnable.GetCommand(shell_dir, self.extra_flags),
- timeout=runnable.timeout,
+ command,
+ timeout=runnable.timeout,
)
except OSError as e: # pragma: no cover
print title % "OSError"
@@ -822,6 +836,14 @@ def Main(args):
help="JavaScript engine binary. By default, d8 under "
"architecture-specific build dir. "
"Not supported in conjunction with outdir-no-patch.")
+ parser.add_option("--prioritize",
+ help="Raise the priority to nice -20 for the benchmarking process."
+ "Requires Linux, schedtool, and sudo privileges.",
+ default=False, action="store_true")
+ parser.add_option("--affinitize",
+ help="Run benchmarking process on the specified core."
+ "Requires Linux, schedtool, and sudo privileges.",
+ default=None)
(options, args) = parser.parse_args(args)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698