diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 20:44:32 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 20:44:32 +0000 |
commit | 27c521a7610b9e49d1de4895f54813131b452ebc (patch) | |
tree | f65c605aafe47ed7272406f1a62449973de4a933 /tools/perf | |
parent | 97e47956aca7291f0861707ef4d1bc0c2940efd9 (diff) | |
download | chromium_src-27c521a7610b9e49d1de4895f54813131b452ebc.zip chromium_src-27c521a7610b9e49d1de4895f54813131b452ebc.tar.gz chromium_src-27c521a7610b9e49d1de4895f54813131b452ebc.tar.bz2 |
Collect tab timing information for use in telementry-based startup tests
Motivation: Data collection exposed in this CL is needed by upcoming startup tests we're writing using Telemtry.
Expose a new window.statsCollectionController object to JS and move existing histogram reading code into it since that seemed misplaced in DOMAutomationController.
Add a new --enable-stats-collection-bindings to activate said object.
Example usage in telemtry:
with browser.Create() as b:
b.tabs[0].Navigate("http://www.google.com")
b.tabs[0].WaitForDocumentReadyStateToBeComplete()
print b.tabs[0].EvaluateJavaScript('statsCollectionController.tabLoadTiming()')
BUG=None
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=202620
Review URL: https://chromiumcodereview.appspot.com/12389073
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/perf_tools/histogram_metric.py | 9 | ||||
-rw-r--r-- | tools/perf/perf_tools/memory_measurement.py | 10 | ||||
-rw-r--r-- | tools/perf/perf_tools/page_cycler.py | 5 | ||||
-rw-r--r-- | tools/perf/perf_tools/startup_measurement.py | 16 |
4 files changed, 32 insertions, 8 deletions
diff --git a/tools/perf/perf_tools/histogram_metric.py b/tools/perf/perf_tools/histogram_metric.py index d05394e..1df7257 100644 --- a/tools/perf/perf_tools/histogram_metric.py +++ b/tools/perf/perf_tools/histogram_metric.py @@ -36,7 +36,10 @@ class HistogramMetric(object): return 'getHistogram' def _GetHistogramFromDomAutomation(self, tab): - js = ('window.domAutomationController.%s ? ' - 'window.domAutomationController.%s("%s") : ""' % - (self.histogram_function, self.histogram_function, self.name)) + # TODO(jeremy): Remove references to + # domAutomationController when we update the reference builds. + js = ('(window.statsCollectionController ? ' + 'statsCollectionController : ' + 'domAutomationController).%s("%s")' % + (self.histogram_function, self.name)) return tab.EvaluateJavaScript(js) diff --git a/tools/perf/perf_tools/memory_measurement.py b/tools/perf/perf_tools/memory_measurement.py index 37e14a2..3fd89db 100644 --- a/tools/perf/perf_tools/memory_measurement.py +++ b/tools/perf/perf_tools/memory_measurement.py @@ -29,7 +29,7 @@ class MemoryMeasurement(page_measurement.PageMeasurement): h.Start(page, tab) def CustomizeBrowserOptions(self, options): - options.AppendExtraBrowserArg('--dom-automation') + options.AppendExtraBrowserArg('--enable-stats-collection-bindings') # For a hard-coded set of Google pages (such as GMail), we produce custom # memory histograms (V8.Something_gmail) instead of the generic histograms # (V8.Something), if we detect that a renderer is only rendering this page @@ -38,7 +38,13 @@ class MemoryMeasurement(page_measurement.PageMeasurement): # pages. options.AppendExtraBrowserArg('--disable-histogram-customizer') options.AppendExtraBrowserArg('--memory-metrics') - options.AppendExtraBrowserArg('--reduce-security-for-dom-automation-tests') + options.AppendExtraBrowserArg( + '--reduce-security-for-stats-collection-tests') + + # Old commandline flags used for reference builds. + options.AppendExtraBrowserArg('--dom-automation') + options.AppendExtraBrowserArg( + '--reduce-security-for-dom-automation-tests') def CanRunForPage(self, page): return hasattr(page, 'stress_memory') diff --git a/tools/perf/perf_tools/page_cycler.py b/tools/perf/perf_tools/page_cycler.py index 6c5d1da..d10adcd 100644 --- a/tools/perf/perf_tools/page_cycler.py +++ b/tools/perf/perf_tools/page_cycler.py @@ -62,10 +62,13 @@ class PageCycler(page_measurement.PageMeasurement): h.Start(page, tab) def CustomizeBrowserOptions(self, options): - options.AppendExtraBrowserArg('--dom-automation') + options.AppendExtraBrowserArg('--enable-stats-collection-bindings') options.AppendExtraBrowserArg('--js-flags=--expose_gc') options.AppendExtraBrowserArg('--no-sandbox') + # Old commandline flags used for reference builds. + options.AppendExtraBrowserArg('--dom-automation') + # Temporarily disable typical_25 page set on mac. if sys.platform == 'darwin' and sys.argv[-1].endswith('/typical_25.json'): print 'typical_25 is currently disabled on mac. Skipping test.' diff --git a/tools/perf/perf_tools/startup_measurement.py b/tools/perf/perf_tools/startup_measurement.py index 0c4284f..f115090 100644 --- a/tools/perf/perf_tools/startup_measurement.py +++ b/tools/perf/perf_tools/startup_measurement.py @@ -19,11 +19,23 @@ class PerfWarm(page_measurement.PageMeasurement): discard_first_result=True) def CustomizeBrowserOptions(self, options): + options.AppendExtraBrowserArg('--enable-stats-collection-bindings') + options.AppendExtraBrowserArg( + '--reduce-security-for-stats-collection-tests') + + # Old commandline flags used for reference builds. options.AppendExtraBrowserArg('--dom-automation') - options.AppendExtraBrowserArg('--reduce-security-for-dom-automation-tests') + options.AppendExtraBrowserArg( + '--reduce-security-for-dom-automation-tests') def MeasurePage(self, page, tab, results): - get_histogram_js = "domAutomationController.getBrowserHistogram(\"%s\")" + # TODO(jeremy): Remove references to + # domAutomationController.getBrowserHistogram when we update the reference + # builds. + get_histogram_js = ('(window.statsCollectionController ?' + 'statsCollectionController :' + 'domAutomationController).getBrowserHistogram("%s")') + for display_name, histogram_name in self.HISTOGRAMS_TO_RECORD.iteritems(): result = tab.EvaluateJavaScript(get_histogram_js % histogram_name) |