Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: tools/perf/perf_tools/memory_benchmark.py

Issue 12221137: Telemetry / Memory benchmark fix: Separate histograms for different tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/util.py » ('j') | tools/telemetry/telemetry/util.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/perf_tools/memory_benchmark.py
diff --git a/tools/perf/perf_tools/memory_benchmark.py b/tools/perf/perf_tools/memory_benchmark.py
index 27405734b3ba28f3a0526a2c1ab236139d32bf91..7f2715203516c979cb4bf2f90e4614e1bcc5e61b 100644
--- a/tools/perf/perf_tools/memory_benchmark.py
+++ b/tools/perf/perf_tools/memory_benchmark.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import multi_page_benchmark
+from telemetry import util
MEMORY_HISTOGRAMS = [
{'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'},
@@ -15,6 +16,20 @@ BROWSER_MEMORY_HISTOGRAMS = [
class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark):
def __init__(self):
super(MemoryBenchmark, self).__init__('stress_memory')
+ self._baselines = dict()
+
+ def WillNavigateToPage(self, page, tab):
nduca 2013/02/12 18:33:15 not sure i'd call this baselines. The word 'Baseli
marja 2013/02/13 16:09:30 Done.
+ for histogram in MEMORY_HISTOGRAMS:
+ name = histogram['name']
nduca 2013/02/12 18:33:15 How about a histogram measurement object? Histogr
marja 2013/02/13 16:09:30 Done.
+ data = self._GetHistogramFromDomAutomation(tab, 'getHistogram', name)
+ if data:
+ self._baselines[page.url + name] = data
+ for histogram in BROWSER_MEMORY_HISTOGRAMS:
+ name = histogram['name']
+ data = self._GetHistogramFromDomAutomation(tab, 'getBrowserHistogram',
+ name)
+ if data:
+ self._baselines[page.url + name] = data
def CustomizeBrowserOptions(self, options):
options.AppendExtraBrowserArg('--dom-automation')
@@ -32,17 +47,26 @@ class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark):
def MeasurePage(self, page, tab, results):
for histogram in MEMORY_HISTOGRAMS:
- self._GetHistogramFromDomAutomation(tab, 'getHistogram', histogram,
- results)
+ name = histogram['name']
+ data = self._GetHistogramFromDomAutomation(tab, 'getHistogram', name)
+ self._AddHistogramResult(histogram, page, data, results)
for histogram in BROWSER_MEMORY_HISTOGRAMS:
- self._GetHistogramFromDomAutomation(tab, 'getBrowserHistogram', histogram,
- results)
+ name = histogram['name']
+ data = self._GetHistogramFromDomAutomation(tab, 'getBrowserHistogram',
+ name)
+ self._AddHistogramResult(histogram, page, data, results)
- def _GetHistogramFromDomAutomation(self, tab, func, histogram, results):
- name = histogram['name']
+ def _GetHistogramFromDomAutomation(self, tab, func, name):
js = ('window.domAutomationController.%s ? '
'window.domAutomationController.%s("%s") : ""' % (func, func, name))
- data = tab.EvaluateJavaScript(js)
- if data:
- results.Add(name.replace('.', '_'), histogram['units'], data,
- data_type='histogram')
+ return tab.EvaluateJavaScript(js)
+
+ def _AddHistogramResult(self, histogram, page, data, results):
+ if not data:
+ return
+ name = histogram['name']
+ if page.url + name not in self._baselines:
+ return
+ results.Add(name.replace('.', '_'), histogram['units'],
+ util.SubtractHistogram(data, self._baselines[page.url + name]),
+ data_type='histogram')
« no previous file with comments | « no previous file | tools/telemetry/telemetry/util.py » ('j') | tools/telemetry/telemetry/util.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698