Skip to content
Snippets Groups Projects
Commit ebb202040808 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

benchmark: split the method running method from the perf extension in two

We split the part responsible for running the actual command from the part
responsible for processing it. This will be useful to introduce a new method
relying on json output instead of parsing textual output.
parent b57b4a68feea
No related branches found
No related tags found
No related merge requests found
......@@ -228,8 +228,8 @@
raise
raise
def perfext(self, command, *args, **kwargs):
"""Use contrib/perf.py extension from mercurial to get a benchmark result"""
def _perfext(self, command, *args, **kwargs):
"""Use contrib/perf.py extension from mercurial to get data"""
perfpath = os.path.join(self.project_dir, 'contrib', 'perf.py')
kwargs.setdefault('stderr', subprocess.STDOUT)
try:
......@@ -233,9 +233,9 @@
perfpath = os.path.join(self.project_dir, 'contrib', 'perf.py')
kwargs.setdefault('stderr', subprocess.STDOUT)
try:
output = self.safe_hg(
return self.safe_hg(
[command, '--config', 'extensions.perf={0}'.format(perfpath)],
*args, **kwargs)
except SkipResult:
# command does not exist for this version of perf.py
# return NaN which is a "n/a" status for asv
......@@ -237,8 +237,14 @@
[command, '--config', 'extensions.perf={0}'.format(perfpath)],
*args, **kwargs)
except SkipResult:
# command does not exist for this version of perf.py
# return NaN which is a "n/a" status for asv
return None
def perfext(self, command, *args, **kwargs):
"""Use contrib/perf.py extension from mercurial to get a benchmark result"""
output = self._perfext(command, *args, **kwargs)
if output is None:
return float('nan')
match = PERF_RE.search(output)
if not match:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment