Path pieces are concatenated. D8 is always run with the suite's path as cwd.
"""
+from collections import OrderedDict
import json
import math
import optparse
"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"^\[([^\]]+)\]$")
+
def GeometricMean(values):
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())
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", "")