Reviewers: Benedikt Meurer,
Message:
PTAL
Description:
Make benchmark runner understand chromium perf output.
BUG=406405
LOG=n
TEST=python -m unittest run_benchmarks_test
Please review this at https://codereview.chromium.org/498163002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+41, -15 lines):
M tools/run_benchmarks.py
M tools/unittests/run_benchmarks_test.py
Index: tools/run_benchmarks.py
diff --git a/tools/run_benchmarks.py b/tools/run_benchmarks.py
index
b74f3588f360e2ed869ab76cbf2fcb543df69559..9be37532fcec246265eb60d386380f5ae52f3e63
100755
--- a/tools/run_benchmarks.py
+++ b/tools/run_benchmarks.py
@@ -91,6 +91,7 @@ Full example (suite with several runners):
Path pieces are concatenated. D8 is always run with the suite's path as
cwd.
"""
+from collections import OrderedDict
import json
import optparse
import os
@@ -113,8 +114,10 @@ SUPPORTED_ARCHS = ["android_arm",
"x64",
"arm64"]
-GENERIC_RESULTS_RE = re.compile(
- r"^Trace\(([^\)]+)\), Result\(([^\)]+)\), StdDev\(([^\)]+)\)$")
+GENERIC_RESULTS_RE = re.compile(r"^RESULT ([^:]+): ([^=]+)= ([^ ]+) ([^
]*)$")
+RESULT_STDDEV_RE = re.compile(r"^\{([^\}]+)\}$")
+RESULT_LIST_RE = re.compile(r"^\[([^\]]+)\]$")
+
class Results(object):
"""Place holder for result traces."""
@@ -298,21 +301,33 @@ class RunnableGeneric(Runnable):
def Run(self, runner):
"""Iterates over several runs and handles the output."""
- traces = {}
+ traces = OrderedDict()
for stdout in runner():
for line in stdout.strip().splitlines():
match = GENERIC_RESULTS_RE.match(line)
if match:
- trace = match.group(1)
- result = match.group(2)
- stddev = match.group(3)
+ stddev = ""
+ graph = match.group(1)
+ trace = match.group(2)
+ body = match.group(3)
+ units = match.group(4)
+ match_stddev = RESULT_STDDEV_RE.match(body)
+ match_list = RESULT_LIST_RE.match(body)
+ if match_stddev:
+ result, stddev = map(str.strip,
match_stddev.group(1).split(","))
+ results = [result]
+ elif match_list:
+ results = map(str.strip, match_list.group(1).split(","))
+ else:
+ results = [body.strip()]
+
trace_result = traces.setdefault(trace, Results([{
- "graphs": self.graphs + [trace],
- "units": self.units,
+ "graphs": self.graphs + [graph, trace],
+ "units": (units or self.units).strip(),
"results": [],
"stddev": "",
}], []))
- trace_result.traces[0]["results"].append(result)
+ trace_result.traces[0]["results"].extend(results)
trace_result.traces[0]["stddev"] = stddev
return reduce(lambda r, t: r + t, traces.itervalues(), Results())
Index: tools/unittests/run_benchmarks_test.py
diff --git a/tools/unittests/run_benchmarks_test.py
b/tools/unittests/run_benchmarks_test.py
index
054522091ed1738143ac30cb686b808eed0af2aa..0d33c94897412d3b15588caaa9a3aa2d3edfe823
100644
--- a/tools/unittests/run_benchmarks_test.py
+++ b/tools/unittests/run_benchmarks_test.py
@@ -309,12 +309,23 @@ class BenchmarksTest(unittest.TestCase):
test_input = dict(V8_GENERIC_JSON)
self._WriteTestInput(test_input)
self._MockCommand(["."], [
- "Trace(Test1), Result(1.234), StdDev(0.23)\n"
- "Trace(Test2), Result(10657567), StdDev(106)\n"])
+ "RESULT Infra: Constant1= 11 count\n"
+ "RESULT Infra: Constant2= [10,5,10,15] count\n"
+ "RESULT Infra: Constant3= {12,1.2} count\n"])
self.assertEquals(0, self._CallMain())
- self._VerifyResults("test", "ms", [
- {"name": "Test1", "results": ["1.234"], "stddev": "0.23"},
- {"name": "Test2", "results": ["10657567"], "stddev": "106"},
- ])
+ self.assertEquals([
+ {"units": "count",
+ "graphs": ["test", "Infra", "Constant1"],
+ "results": ["11"],
+ "stddev": ""},
+ {"units": "count",
+ "graphs": ["test", "Infra", "Constant2"],
+ "results": ["10", "5", "10", "15"],
+ "stddev": ""},
+ {"units": "count",
+ "graphs": ["test", "Infra", "Constant3"],
+ "results": ["12"],
+ "stddev": "1.2"},
+ ], self._LoadResults()["traces"])
self._VerifyErrors([])
self._VerifyMock(path.join("out", "x64.release", "cc"), "--flag", "")
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.