OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import json | 5 import json |
6 import math | 6 import math |
7 import os | 7 import os |
8 | 8 |
9 from telemetry import benchmark | 9 from telemetry import benchmark |
10 from telemetry.core import util | 10 from telemetry.core import util |
(...skipping 20 matching lines...) Expand all Loading... |
31 mean = math.pow(math.e, (log_sum / len(new_values))) | 31 mean = math.pow(math.e, (log_sum / len(new_values))) |
32 # Return the rounded mean. | 32 # Return the rounded mean. |
33 return int(round(mean)) | 33 return int(round(mean)) |
34 | 34 |
35 | 35 |
36 SCORE_UNIT = 'score (bigger is better)' | 36 SCORE_UNIT = 'score (bigger is better)' |
37 SCORE_TRACE_NAME = 'score' | 37 SCORE_TRACE_NAME = 'score' |
38 | 38 |
39 | 39 |
40 class _DomPerfMeasurement(page_measurement.PageMeasurement): | 40 class _DomPerfMeasurement(page_measurement.PageMeasurement): |
41 @property | |
42 def results_are_the_same_on_every_page(self): | |
43 return False | |
44 | |
45 def MeasurePage(self, page, tab, results): | 41 def MeasurePage(self, page, tab, results): |
46 try: | 42 try: |
47 def _IsDone(): | 43 def _IsDone(): |
48 return tab.GetCookieByName('__domperf_finished') == '1' | 44 return tab.GetCookieByName('__domperf_finished') == '1' |
49 util.WaitFor(_IsDone, 600) | 45 util.WaitFor(_IsDone, 600) |
50 | 46 |
51 data = json.loads(tab.EvaluateJavaScript('__domperf_result')) | 47 data = json.loads(tab.EvaluateJavaScript('__domperf_result')) |
52 for suite in data['BenchmarkSuites']: | 48 for suite in data['BenchmarkSuites']: |
53 # Skip benchmarks that we didn't actually run this time around. | 49 # Skip benchmarks that we didn't actually run this time around. |
54 if len(suite['Benchmarks']) or suite['score']: | 50 if len(suite['Benchmarks']) or suite['score']: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 'Events', | 87 'Events', |
92 'Get+Elements', | 88 'Get+Elements', |
93 'GridSort', | 89 'GridSort', |
94 'Template' | 90 'Template' |
95 ] | 91 ] |
96 ps = page_set.PageSet(file_path=dom_perf_dir) | 92 ps = page_set.PageSet(file_path=dom_perf_dir) |
97 for param in run_params: | 93 for param in run_params: |
98 ps.AddPageWithDefaultRunNavigate( | 94 ps.AddPageWithDefaultRunNavigate( |
99 'file://run.html?reportInJS=1&run=%s' % param) | 95 'file://run.html?reportInJS=1&run=%s' % param) |
100 return ps | 96 return ps |
OLD | NEW |