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):
self._tbm_test.WillRunStory(platform)
def Measure(self, platform, results):
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.
results.PopulateHistogramSet()
# There are four scenarios while we migrate the press benchmarks off of
# the legacy value system
# 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.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:
self._tbm_test.Measure(platform, results)
......
......@@ -5,7 +5,7 @@ import json
import math
from telemetry import story
from telemetry.value import scalar
from tracing.value import histogram as histogram_module
from page_sets import press_story
......@@ -61,14 +61,10 @@ class DromaeoStory(press_story.PressStory):
container[key]['count'] += 1
container[key]['sum'] += math.log(value)
suffix = self.url[self.url.index('?') + 1:]
def AddResult(name, value):
important = False
if name == suffix:
important = True
self.AddJavascriptMetricValue(scalar.ScalarValue(
self, Escape(name), 'runs/s', value, important))
hg = histogram_module.Histogram(Escape(name), "unitless_biggerIsBetter")
hg.AddSample(value)
self.AddJavascriptMetricHistogram(hg)
aggregated = {}
for data in score:
......
......@@ -35,6 +35,7 @@ class PressStory(page_module.Page):
name=self.NAME if self.NAME else self.URL)
self._values = []
self._summary_values = []
self._histogram_values = []
def GetJavascriptMetricValues(self):
return self._values
......@@ -48,6 +49,12 @@ class PressStory(page_module.Page):
def AddJavascriptMetricSummaryValue(self, 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):
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