Commit 5365d3dc authored by Juan Antonio Navarro Perez's avatar Juan Antonio Navarro Perez Committed by Commit Bot

[tools/perf] Migrate press benchmarks to measurements

This CL migrates the final few press benchmarks (dromaeo and
speedometer2) which were still directly writing histograms to use the
measurements system instead.

Also, stop calling PopulateHistogramSet. This is no longer needed
since the measurements to histograms translation is now handled by
results processor.

Bug: 999484
Change-Id: Ieb7b88aedddae731c029eb9954119479a783d2c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869008Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Commit-Queue: Juan Antonio Navarro Pérez <perezju@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708108}
parent 8d478224
...@@ -27,31 +27,8 @@ class DualMetricMeasurement(story_test.StoryTest): ...@@ -27,31 +27,8 @@ class DualMetricMeasurement(story_test.StoryTest):
self._tbm_test.WillRunStory(platform) self._tbm_test.WillRunStory(platform)
def Measure(self, platform, results): def Measure(self, platform, results):
# There are four scenarios while we migrate the press benchmarks off of for value in results.current_story.GetMeasurements():
# the legacy value system results.AddMeasurement(**value)
# 1. Legacy Values that get converted with the call to PopulateHistogramSet
# Note: this only works when there is one page in the sotry
# 2. Legacy Values with TMBv2 values. Same note as #1
# 3. Histograms added in the test. Diagnostics must be added to these so
# all histograms must be added through AddHistogram call.
# 4. Histograms added from the test as well as TBMv2 values.
# Diagnostics will get added by the timeline based measurement and the
# call to AddHistograms.
if len(results.current_page.GetJavascriptMetricHistograms()) > 0:
for histogram in results.current_page.GetJavascriptMetricHistograms():
results.AddHistogram(histogram)
else:
for value in results.current_page.GetMeasurements():
results.AddMeasurement(**value)
# This call is necessary to convert the current ScalarValues to
# histograms before more histograms are added. If we don't,
# when histograms get added by TBM2 page_test_results will see those and
# not convert any existing values because it assumes they are already
# converted. Therefore, so the javascript metrics don't get dropped, we
# have to convert them first.
# NOTE: this does not work if there is more than one page in this story.
# It will drop results from all subsequent pages. See crbug.com/902812.
results.PopulateHistogramSet()
if self._enable_tracing: if self._enable_tracing:
self._tbm_test.Measure(platform, results) self._tbm_test.Measure(platform, results)
......
...@@ -5,7 +5,6 @@ import json ...@@ -5,7 +5,6 @@ import json
import math import math
from telemetry import story from telemetry import story
from tracing.value import histogram as histogram_module
from page_sets import press_story from page_sets import press_story
...@@ -62,9 +61,7 @@ class DromaeoStory(press_story.PressStory): ...@@ -62,9 +61,7 @@ class DromaeoStory(press_story.PressStory):
container[key]['sum'] += math.log(value) container[key]['sum'] += math.log(value)
def AddResult(name, value): def AddResult(name, value):
hg = histogram_module.Histogram(Escape(name), "unitless_biggerIsBetter") self.AddMeasurement(Escape(name), 'unitless_biggerIsBetter', [value])
hg.AddSample(value)
self.AddJavascriptMetricHistogram(hg)
aggregated = {} aggregated = {}
for data in score: for data in score:
......
...@@ -36,7 +36,6 @@ class PressStory(page_module.Page): ...@@ -36,7 +36,6 @@ class PressStory(page_module.Page):
make_javascript_deterministic=self.DETERMINISTIC_JS, make_javascript_deterministic=self.DETERMINISTIC_JS,
name=self.NAME if self.NAME else self.URL) name=self.NAME if self.NAME else self.URL)
self._measurements = [] self._measurements = []
self._histogram_values = []
self._action_runner = None self._action_runner = None
def AddMeasurement(self, name, unit, samples, description=None): def AddMeasurement(self, name, unit, samples, description=None):
...@@ -82,14 +81,6 @@ class PressStory(page_module.Page): ...@@ -82,14 +81,6 @@ class PressStory(page_module.Page):
def GetMeasurements(self): def GetMeasurements(self):
return self._measurements return self._measurements
def GetJavascriptMetricHistograms(self):
"""DEPRECATED: Use measurements instead."""
return self._histogram_values
def AddJavascriptMetricHistogram(self, value):
"""DEPRECATED: Use measurements instead."""
self._histogram_values.append(value)
def ExecuteTest(self, action_runner): def ExecuteTest(self, action_runner):
pass pass
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
""" """
import re import re
from tracing.value import histogram as histogram_module
from page_sets import press_story from page_sets import press_story
_SPEEDOMETER_SUITE_NAME_BASE = '{0}-TodoMVC' _SPEEDOMETER_SUITE_NAME_BASE = '{0}-TodoMVC'
...@@ -30,6 +28,7 @@ _SPEEDOMETER_SUITES = [ ...@@ -30,6 +28,7 @@ _SPEEDOMETER_SUITES = [
'Flight' 'Flight'
] ]
class Speedometer2Story(press_story.PressStory): class Speedometer2Story(press_story.PressStory):
URL = 'file://InteractiveRunner.html' URL = 'file://InteractiveRunner.html'
NAME = 'Speedometer2' NAME = 'Speedometer2'
...@@ -100,36 +99,24 @@ class Speedometer2Story(press_story.PressStory): ...@@ -100,36 +99,24 @@ class Speedometer2Story(press_story.PressStory):
count=iterationCount) count=iterationCount)
action_runner.WaitForJavaScriptCondition('testDone', timeout=600) action_runner.WaitForJavaScriptCondition('testDone', timeout=600)
def ParseTestResults(self, action_runner): def ParseTestResults(self, action_runner):
if not self._should_filter_suites: if not self._should_filter_suites:
total_hg = histogram_module.Histogram("Total", "ms_smallerIsBetter") self.AddJavaScriptMeasurement(
total_samples = action_runner.EvaluateJavaScript( 'Total', 'ms_smallerIsBetter', 'suiteValues.map(each => each.total)')
'suiteValues.map(each => each.total)') self.AddJavaScriptMeasurement(
for s in total_samples: 'RunsPerMinute', 'unitless_biggerIsBetter',
total_hg.AddSample(s)
self.AddJavascriptMetricHistogram(total_hg)
runs_hg = histogram_module.Histogram("RunsPerMinute",
"unitless_biggerIsBetter")
runs_samples = action_runner.EvaluateJavaScript(
'suiteValues.map(each => each.score)') 'suiteValues.map(each => each.score)')
for s in runs_samples:
runs_hg.AddSample(s)
self.AddJavascriptMetricHistogram(runs_hg)
# Extract the timings for each suite # Extract the timings for each suite
for suite_name in self._enabled_suites: for suite_name in self._enabled_suites:
suite_hg = histogram_module.Histogram(suite_name, "ms_smallerIsBetter") self.AddJavaScriptMeasurement(
samples = action_runner.EvaluateJavaScript(""" suite_name, 'ms_smallerIsBetter',
var suite_times = []; """
for(var i = 0; i < iterationCount; i++) { var suite_times = [];
suite_times.push( for(var i = 0; i < iterationCount; i++) {
suiteValues[i].tests[{{ key }}].total); suite_times.push(
}; suiteValues[i].tests[{{ key }}].total);
suite_times; };
""", suite_times;
key=suite_name) """,
for s in samples: key=suite_name)
suite_hg.AddSample(s)
self.AddJavascriptMetricHistogram(suite_hg)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment