Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from collections import defaultdict | 4 from collections import defaultdict |
| 5 import os | 5 import os |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 from chrome_remote_control import page_test | 8 from chrome_remote_control import page_test |
| 9 | 9 |
| 10 # Get build/android/pylib scripts into our path. | 10 # Get build/android/pylib scripts into our path. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 | 78 |
| 79 row = [self._page.url] | 79 row = [self._page.url] |
| 80 for name in self.field_names: | 80 for name in self.field_names: |
| 81 value = self._page_values[name] | 81 value = self._page_values[name] |
| 82 row.append(value) | 82 row.append(value) |
| 83 self._results_writer.writerow(row) | 83 self._results_writer.writerow(row) |
| 84 | 84 |
| 85 def PrintSummary(self, trace_tag): | 85 def PrintSummary(self, trace_tag): |
| 86 for measurement_units, values in self.results_summary.iteritems(): | 86 for measurement_units, values in self.results_summary.iteritems(): |
| 87 measurement, units = measurement_units | 87 measurement, units = measurement_units |
| 88 trace = measurement + (trace_tag or '') | 88 if '.' in measurement: |
|
nduca
2012/11/04 19:53:30
what is this '.'? Can we make this less hacky feel
tonyg
2012/11/05 23:02:01
The perfbots support a chart and a trace as the "k
| |
| 89 measurement, trace = measurement.split('.', 1) | |
| 90 trace += (trace_tag or '') | |
| 91 else: | |
| 92 trace = measurement + (trace_tag or '') | |
| 89 PrintPerfResult(measurement, trace, values, units) | 93 PrintPerfResult(measurement, trace, values, units) |
| 90 | 94 |
| 91 | 95 |
| 92 # TODO(nduca): Rename to page_benchmark | 96 # TODO(nduca): Rename to page_benchmark |
| 93 class MultiPageBenchmark(page_test.PageTest): | 97 class MultiPageBenchmark(page_test.PageTest): |
| 94 """Glue code for running a benchmark across a set of pages. | 98 """Glue code for running a benchmark across a set of pages. |
| 95 | 99 |
| 96 To use this, subclass from the benchmark and override MeasurePage. For | 100 To use this, subclass from the benchmark and override MeasurePage. For |
| 97 example: | 101 example: |
| 98 | 102 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 | 147 |
| 144 Put together: | 148 Put together: |
| 145 | 149 |
| 146 def MeasurePage(self, page, tab, results): | 150 def MeasurePage(self, page, tab, results): |
| 147 res = tab.runtime.Evaluate('2+2') | 151 res = tab.runtime.Evaluate('2+2') |
| 148 if res != 4: | 152 if res != 4: |
| 149 raise Exception('Oh, wow.') | 153 raise Exception('Oh, wow.') |
| 150 results.Add('two_plus_two', 'count', res) | 154 results.Add('two_plus_two', 'count', res) |
| 151 """ | 155 """ |
| 152 raise NotImplementedError() | 156 raise NotImplementedError() |
| OLD | NEW |