| 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..7179bf5563f0686e7028153b0502917ab4eaba3a 100644
|
| --- a/tools/perf/perf_tools/memory_benchmark.py
|
| +++ b/tools/perf/perf_tools/memory_benchmark.py
|
| @@ -1,6 +1,7 @@
|
| # Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
| +from perf_tools import histogram_measurement
|
| from telemetry import multi_page_benchmark
|
|
|
| MEMORY_HISTOGRAMS = [
|
| @@ -15,6 +16,17 @@ BROWSER_MEMORY_HISTOGRAMS = [
|
| class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark):
|
| def __init__(self):
|
| super(MemoryBenchmark, self).__init__('stress_memory')
|
| + self.histograms = (
|
| + [histogram_measurement.HistogramMeasurement(
|
| + h, histogram_measurement.RENDERER_HISTOGRAM)
|
| + for h in MEMORY_HISTOGRAMS] +
|
| + [histogram_measurement.HistogramMeasurement(
|
| + h, histogram_measurement.BROWSER_HISTOGRAM)
|
| + for h in BROWSER_MEMORY_HISTOGRAMS])
|
| +
|
| + def DidNavigateToPage(self, page, tab):
|
| + for h in self.histograms:
|
| + h.Start(page, tab)
|
|
|
| def CustomizeBrowserOptions(self, options):
|
| options.AppendExtraBrowserArg('--dom-automation')
|
| @@ -31,18 +43,5 @@ class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark):
|
| return hasattr(page, 'stress_memory')
|
|
|
| def MeasurePage(self, page, tab, results):
|
| - for histogram in MEMORY_HISTOGRAMS:
|
| - self._GetHistogramFromDomAutomation(tab, 'getHistogram', histogram,
|
| - results)
|
| - for histogram in BROWSER_MEMORY_HISTOGRAMS:
|
| - self._GetHistogramFromDomAutomation(tab, 'getBrowserHistogram', histogram,
|
| - results)
|
| -
|
| - def _GetHistogramFromDomAutomation(self, tab, func, histogram, results):
|
| - name = histogram['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')
|
| + for h in self.histograms:
|
| + h.GetValue(page, tab, results)
|
|
|