OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 collections | 5 import collections |
6 import page_sets | 6 import page_sets |
7 import re | 7 import re |
8 | 8 |
9 from measurements import timeline_controller | 9 from measurements import timeline_controller |
10 from metrics import speedindex | 10 from metrics import speedindex |
(...skipping 11 matching lines...) Expand all Loading... |
22 for counter_name, counter in process.counters.iteritems(): | 22 for counter_name, counter in process.counters.iteritems(): |
23 if not counter_filter.search(counter_name): | 23 if not counter_filter.search(counter_name): |
24 continue | 24 continue |
25 | 25 |
26 total = sum(counter.totals) | 26 total = sum(counter.totals) |
27 | 27 |
28 # Results objects cannot contain the '.' character, so remove that here. | 28 # Results objects cannot contain the '.' character, so remove that here. |
29 sanitized_counter_name = counter_name.replace('.', '_') | 29 sanitized_counter_name = counter_name.replace('.', '_') |
30 | 30 |
31 results.AddValue(scalar.ScalarValue( | 31 results.AddValue(scalar.ScalarValue( |
32 results.current_page, sanitized_counter_name, 'count', total)) | 32 results.current_page, sanitized_counter_name, 'count', total, |
| 33 higher_is_better=False)) |
33 results.AddValue(scalar.ScalarValue( | 34 results.AddValue(scalar.ScalarValue( |
34 results.current_page, sanitized_counter_name + '_avg', 'count', | 35 results.current_page, sanitized_counter_name + '_avg', 'count', |
35 total / float(len(counter.totals)))) | 36 total / float(len(counter.totals)), higher_is_better=False)) |
36 | 37 |
37 def AddResultsOfEvents( | 38 def AddResultsOfEvents( |
38 self, process, thread_regex_string, event_regex_string, results): | 39 self, process, thread_regex_string, event_regex_string, results): |
39 thread_filter = re.compile(thread_regex_string) | 40 thread_filter = re.compile(thread_regex_string) |
40 event_filter = re.compile(event_regex_string) | 41 event_filter = re.compile(event_regex_string) |
41 | 42 |
42 for thread in process.threads.itervalues(): | 43 for thread in process.threads.itervalues(): |
43 thread_name = thread.name.replace('/', '_') | 44 thread_name = thread.name.replace('/', '_') |
44 if not thread_filter.search(thread_name): | 45 if not thread_filter.search(thread_name): |
45 continue | 46 continue |
(...skipping 22 matching lines...) Expand all Loading... |
68 | 69 |
69 def _AddResultOfEvent(self, thread_name, event_name, times, results): | 70 def _AddResultOfEvent(self, thread_name, event_name, times, results): |
70 total = sum(times) | 71 total = sum(times) |
71 biggest_jank = max(times) | 72 biggest_jank = max(times) |
72 | 73 |
73 # Results objects cannot contain the '.' character, so remove that here. | 74 # Results objects cannot contain the '.' character, so remove that here. |
74 sanitized_event_name = event_name.replace('.', '_') | 75 sanitized_event_name = event_name.replace('.', '_') |
75 | 76 |
76 full_name = thread_name + '|' + sanitized_event_name | 77 full_name = thread_name + '|' + sanitized_event_name |
77 results.AddValue(scalar.ScalarValue( | 78 results.AddValue(scalar.ScalarValue( |
78 results.current_page, full_name, 'ms', total)) | 79 results.current_page, full_name, 'ms', total, higher_is_better=False)) |
79 results.AddValue(scalar.ScalarValue( | 80 results.AddValue(scalar.ScalarValue( |
80 results.current_page, full_name + '_max', 'ms', biggest_jank)) | 81 results.current_page, full_name + '_max', 'ms', biggest_jank, |
| 82 higher_is_better=False)) |
81 results.AddValue(scalar.ScalarValue( | 83 results.AddValue(scalar.ScalarValue( |
82 results.current_page, full_name + '_avg', 'ms', total / len(times))) | 84 results.current_page, full_name + '_avg', 'ms', total / len(times), |
| 85 higher_is_better=False)) |
83 | 86 |
84 | 87 |
85 class _ServiceWorkerMeasurement(page_test.PageTest): | 88 class _ServiceWorkerMeasurement(page_test.PageTest): |
86 """Measure Speed Index and TRACE_EVENTs""" | 89 """Measure Speed Index and TRACE_EVENTs""" |
87 | 90 |
88 def __init__(self, *args, **kwargs): | 91 def __init__(self, *args, **kwargs): |
89 super(_ServiceWorkerMeasurement, self).__init__(*args, **kwargs) | 92 super(_ServiceWorkerMeasurement, self).__init__(*args, **kwargs) |
90 self._timeline_controller = timeline_controller.TimelineController() | 93 self._timeline_controller = timeline_controller.TimelineController() |
91 self._speed_index = speedindex.SpeedIndexMetric() | 94 self._speed_index = speedindex.SpeedIndexMetric() |
92 self._page_open_times = collections.defaultdict(int) | 95 self._page_open_times = collections.defaultdict(int) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 test = _ServiceWorkerMeasurement | 181 test = _ServiceWorkerMeasurement |
179 page_set = page_sets.ServiceWorkerPageSet | 182 page_set = page_sets.ServiceWorkerPageSet |
180 | 183 |
181 | 184 |
182 # Disabled due to redness on the tree. crbug.com/442752 | 185 # Disabled due to redness on the tree. crbug.com/442752 |
183 @benchmark.Disabled('reference') | 186 @benchmark.Disabled('reference') |
184 class ServiceWorkerMicroBenchmarkPerfTest(benchmark.Benchmark): | 187 class ServiceWorkerMicroBenchmarkPerfTest(benchmark.Benchmark): |
185 """Service Worker performance test using a micro benchmark page set""" | 188 """Service Worker performance test using a micro benchmark page set""" |
186 test = _ServiceWorkerMicroBenchmarkMeasurement | 189 test = _ServiceWorkerMicroBenchmarkMeasurement |
187 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet | 190 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet |
OLD | NEW |