| Index: tools/perf/benchmarks/blink_perf.py
|
| diff --git a/tools/perf/benchmarks/blink_perf.py b/tools/perf/benchmarks/blink_perf.py
|
| index 3cf3d6550da30fffdbd7ab48a1d29e6c4bea75bc..dc41dc9bc1d6bcaaafa17e1632c688bac7d5127a 100644
|
| --- a/tools/perf/benchmarks/blink_perf.py
|
| +++ b/tools/perf/benchmarks/blink_perf.py
|
| @@ -3,6 +3,7 @@
|
| # found in the LICENSE file.
|
|
|
| import os
|
| +import re
|
|
|
| from core import path_util
|
| from core import perf_benchmark
|
| @@ -74,6 +75,12 @@ def CreateStorySetFromPath(path, skipped_file,
|
| class _BlinkPerfMeasurement(legacy_page_test.LegacyPageTest):
|
| """Tuns a blink performance test and reports the results."""
|
|
|
| + # The line with values has the following format:
|
| + # values optional_metric_name list_of_values unit.
|
| + # The metric name must start with a letter or '_' and may contain
|
| + # letters, digits, '-', '.', and '_'.
|
| + _VALUES_RE = re.compile(r'^values ([^\d\W][\w.\-]*)?(.*) (\S+)$')
|
| +
|
| def __init__(self):
|
| super(_BlinkPerfMeasurement, self).__init__()
|
| with open(os.path.join(os.path.dirname(__file__),
|
| @@ -101,21 +108,29 @@ class _BlinkPerfMeasurement(legacy_page_test.LegacyPageTest):
|
|
|
| log = tab.EvaluateJavaScript('document.getElementById("log").innerHTML')
|
|
|
| + unnamed_metric_count = 0
|
| +
|
| for line in log.splitlines():
|
| - if line.startswith("FATAL: "):
|
| + if line.startswith('FATAL: '):
|
| print line
|
| continue
|
| +
|
| if not line.startswith('values '):
|
| continue
|
| - parts = line.split()
|
| - values = [float(v.replace(',', '')) for v in parts[1:-1]]
|
| - units = parts[-1]
|
| - metric = page.display_name.split('.')[0].replace('/', '_')
|
| +
|
| + match = self._VALUES_RE.match(line)
|
| + assert match, ('invalid log line with values: %s' % line)
|
| +
|
| + metric = match.group(1)
|
| + if not metric:
|
| + metric = page.display_name.split('.')[0].replace('/', '_')
|
| + unnamed_metric_count += 1
|
| + assert unnamed_metric_count <= 1
|
| + values = [float(v.replace(',', '')) for v in match.group(2).split()]
|
| + units = match.group(3)
|
| results.AddValue(list_of_scalar_values.ListOfScalarValues(
|
| results.current_page, metric, units, values))
|
|
|
| - break
|
| -
|
| print log
|
|
|
|
|
| @@ -340,3 +355,16 @@ class BlinkPerfPywebsocket(perf_benchmark.PerfBenchmark):
|
| @classmethod
|
| def ShouldDisable(cls, possible_browser):
|
| return cls.IsSvelte(possible_browser) # http://crbug.com/551950
|
| +
|
| +
|
| +class BlinkHTMLToDOM(perf_benchmark.PerfBenchmark):
|
| + tag = 'html_to_dom'
|
| + test = _BlinkPerfMeasurement
|
| +
|
| + @classmethod
|
| + def Name(cls):
|
| + return 'blink_perf.html_to_dom'
|
| +
|
| + def CreateStorySet(self, options):
|
| + path = os.path.join(BLINK_PERF_BASE_DIR, 'HTMLToDOM')
|
| + return CreateStorySetFromPath(path, SKIPPED_FILE)
|
|
|