| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 def MeasurePage(self, page, tab, results): | 45 def MeasurePage(self, page, tab, results): |
| 46 try: | 46 try: |
| 47 def _IsDone(): | 47 def _IsDone(): |
| 48 return tab.GetCookieByName('__domperf_finished') == '1' | 48 return tab.GetCookieByName('__domperf_finished') == '1' |
| 49 util.WaitFor(_IsDone, 600) | 49 util.WaitFor(_IsDone, 600) |
| 50 | 50 |
| 51 data = json.loads(tab.EvaluateJavaScript('__domperf_result')) | 51 data = json.loads(tab.EvaluateJavaScript('__domperf_result')) |
| 52 for suite in data['BenchmarkSuites']: | 52 for suite in data['BenchmarkSuites']: |
| 53 # Skip benchmarks that we didn't actually run this time around. | 53 # Skip benchmarks that we didn't actually run this time around. |
| 54 if len(suite['Benchmarks']) or suite['score']: | 54 if len(suite['Benchmarks']) or suite['score']: |
| 55 results.Add(SCORE_TRACE_NAME, SCORE_UNIT, | 55 results.AddValue(scalar.ScalarValue( |
| 56 suite['score'], suite['name'], 'unimportant') | 56 results.current_page, '%s.%s' % (suite['name'], SCORE_TRACE_NAME), |
| 57 SCORE_UNIT, suite['score'], important=False)) |
| 57 finally: | 58 finally: |
| 58 tab.EvaluateJavaScript('document.cookie = "__domperf_finished=0"') | 59 tab.EvaluateJavaScript('document.cookie = "__domperf_finished=0"') |
| 59 | 60 |
| 60 def DidRunTest(self, browser, results): | 61 def DidRunTest(self, browser, results): |
| 61 # Now give the geometric mean as the total for the combined runs. | 62 # Now give the geometric mean as the total for the combined runs. |
| 62 combined = merge_values.MergeLikeValuesFromDifferentPages( | 63 combined = merge_values.MergeLikeValuesFromDifferentPages( |
| 63 results.all_page_specific_values, | 64 results.all_page_specific_values, |
| 64 group_by_name_suffix=True) | 65 group_by_name_suffix=True) |
| 65 combined_score = [x for x in combined if x.name == SCORE_TRACE_NAME][0] | 66 combined_score = [x for x in combined if x.name == SCORE_TRACE_NAME][0] |
| 66 total = _GeometricMean(combined_score.values) | 67 total = _GeometricMean(combined_score.values) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 90 'Events', | 91 'Events', |
| 91 'Get+Elements', | 92 'Get+Elements', |
| 92 'GridSort', | 93 'GridSort', |
| 93 'Template' | 94 'Template' |
| 94 ] | 95 ] |
| 95 ps = page_set.PageSet(file_path=dom_perf_dir) | 96 ps = page_set.PageSet(file_path=dom_perf_dir) |
| 96 for param in run_params: | 97 for param in run_params: |
| 97 ps.AddPageWithDefaultRunNavigate( | 98 ps.AddPageWithDefaultRunNavigate( |
| 98 'file://run.html?reportInJS=1&run=%s' % param) | 99 'file://run.html?reportInJS=1&run=%s' % param) |
| 99 return ps | 100 return ps |
| OLD | NEW |