Commit 1fa211c4 authored by Emily Hanley's avatar Emily Hanley Committed by Commit Bot

Convert dromaeo value system to histograms.

Dependent on crrev.com/c/1337454 landing.

Bug: 714231,902812
Change-Id: Idae1a45c02b2810a72c7725388014b1f1430b8bf
Reviewed-on: https://chromium-review.googlesource.com/c/1338171
Commit-Queue: Emily Hanley <eyaich@chromium.org>
Reviewed-by: default avatarBen Hayden <benjhayden@chromium.org>
Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Cr-Commit-Position: refs/heads/master@{#611143}
parent a077f61e
...@@ -29,17 +29,33 @@ class DualMetricMeasurement(story_test.StoryTest): ...@@ -29,17 +29,33 @@ 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):
for value in results.current_page.GetJavascriptMetricValues(): # There are four scenarios while we migrate the press benchmarks off of
results.AddValue(value) # the legacy value system
for value in results.current_page.GetJavascriptMetricSummaryValues(): # 1. Legacy Values that get converted with the call to PopulateHistogramSet
results.AddSummaryValue(value) # Note: this only works when there is one page in the sotry
# This call is necessary to convert the current ScalarValues to # 2. Legacy Values with TMBv2 values. Same note as #1
# histograms before more histograms are added. If we don't, # 3. Histograms added in the test. Diagnostics must be added to these so
# when histograms get added by TBM2 page_test_results will see those and # all histograms must be added through AddHistogram call.
# not convert any existing values because it assumes they are already # 4. Histograms added from the test as well as TBMv2 values.
# converted. Therefore, so the javascript metrics don't get dropped, we # Diagnostics will get added by the timeline based measurement and the
# have to convert them first. # call to AddHistograms.
results.PopulateHistogramSet() if len(results.current_page.GetJavascriptMetricHistograms()) > 0:
for histogram in results.current_page.GetJavascriptMetricHistograms():
results.AddHistogram(histogram)
else:
for value in results.current_page.GetJavascriptMetricValues():
results.AddValue(value)
for value in results.current_page.GetJavascriptMetricSummaryValues():
results.AddSummaryValue(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,7 @@ import json ...@@ -5,7 +5,7 @@ import json
import math import math
from telemetry import story from telemetry import story
from telemetry.value import scalar from tracing.value import histogram as histogram_module
from page_sets import press_story from page_sets import press_story
...@@ -61,14 +61,10 @@ class DromaeoStory(press_story.PressStory): ...@@ -61,14 +61,10 @@ class DromaeoStory(press_story.PressStory):
container[key]['count'] += 1 container[key]['count'] += 1
container[key]['sum'] += math.log(value) container[key]['sum'] += math.log(value)
suffix = self.url[self.url.index('?') + 1:]
def AddResult(name, value): def AddResult(name, value):
important = False hg = histogram_module.Histogram(Escape(name), "unitless_biggerIsBetter")
if name == suffix: hg.AddSample(value)
important = True self.AddJavascriptMetricHistogram(hg)
self.AddJavascriptMetricValue(scalar.ScalarValue(
self, Escape(name), 'runs/s', value, important))
aggregated = {} aggregated = {}
for data in score: for data in score:
......
...@@ -35,6 +35,7 @@ class PressStory(page_module.Page): ...@@ -35,6 +35,7 @@ class PressStory(page_module.Page):
name=self.NAME if self.NAME else self.URL) name=self.NAME if self.NAME else self.URL)
self._values = [] self._values = []
self._summary_values = [] self._summary_values = []
self._histogram_values = []
def GetJavascriptMetricValues(self): def GetJavascriptMetricValues(self):
return self._values return self._values
...@@ -48,6 +49,12 @@ class PressStory(page_module.Page): ...@@ -48,6 +49,12 @@ class PressStory(page_module.Page):
def AddJavascriptMetricSummaryValue(self, value): def AddJavascriptMetricSummaryValue(self, value):
self._summary_values.append(value) self._summary_values.append(value)
def GetJavascriptMetricHistograms(self):
return self._histogram_values
def AddJavascriptMetricHistogram(self, value):
self._histogram_values.append(value)
def ExecuteTest(self, action_runner): def ExecuteTest(self, action_runner):
pass pass
......
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