8000 Add jobs field in compile section to specify make -j param (#236) · python/pyperformance@c457e5b · GitHub
[go: up one dir, main page]

Skip to content

Commit c457e5b

Browse files
authored
Add jobs field in compile section to specify make -j param (#236)
This helps reduce compilation time on multi core machines.
1 parent 864c3d9 commit c457e5b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

doc/benchmark.conf.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ affinity =
7979
# disabled.
8080
upload = False
8181

82+
# Specify '-j' parameter in 'make' command
83+
jobs = 8
84+
8285

8386
# Configuration to upload results to a Codespeed website
8487
[upload]

pyperformance/compile.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,13 @@ def compile(self):
298298
configure = os.path.join(self.conf.repo_dir, 'configure')
299299
self.run(configure, *config_args)
300300

301+
argv = ['make']
301302
if self.conf.pgo:
302303
# FIXME: use taskset (isolated CPUs) for PGO?
303-
self.run('make', 'profile-opt')
304-
else:
305-
self.run('make')
304+
argv.append('profile-opt')
305+
if self.conf.jobs:
306+
argv.append('-j%d' % self.conf.jobs)
307+
self.run(*argv)
306308

307309
def install_python(self):
308310
program, _ = resolve_python(
@@ -778,6 +780,9 @@ def getboolean(section, key, default):
778780
except KeyError:
779781
return default
780782

783+
def getint(section, key, default=None):
784+
return int(getstr(section, key, default))
785+
781786
# [config]
782787
conf.json_dir = getfile('config', 'json_dir')
783788
conf.json_patch_dir = os.path.join(conf.json_dir, 'patch')
@@ -796,6 +801,10 @@ def getboolean(section, key, default):
796801
conf.pgo = getboolean('compile', 'pgo', True)
797802
conf.install = getboolean('compile', 'install', True)
798803
conf.pkg_only = getstr('compile', 'pkg_only', '').split()
804+
try:
805+
conf.jobs = getint('compile', 'jobs')
806+
except KeyError:
807+
conf.jobs = None
799808

800809
# [run_benchmark]
801810
conf.system_tune = getboolean('run_benchmark', 'system_tune', True)

0 commit comments

Comments
 (0)
0