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 os | 5 import os |
6 | 6 |
7 from measurements import smoothness_controller | 7 from measurements import smoothness_controller |
8 from measurements import timeline_controller | 8 from measurements import timeline_controller |
9 from telemetry.core.platform import tracing_category_filter | 9 from telemetry.core.platform import tracing_category_filter |
10 from telemetry.core.platform import tracing_options | 10 from telemetry.core.platform import tracing_options |
11 from telemetry.page import page_test | 11 from telemetry.page import page_test |
12 from telemetry.page.actions import action_runner | 12 from telemetry.page.actions import action_runner |
13 from telemetry.timeline.model import TimelineModel | 13 from telemetry.timeline.model import TimelineModel |
14 from telemetry.util import statistics | 14 from telemetry.util import statistics |
| 15 from telemetry.value import improvement_direction |
15 from telemetry.value import list_of_scalar_values | 16 from telemetry.value import list_of_scalar_values |
16 from telemetry.value import scalar | 17 from telemetry.value import scalar |
17 from telemetry.value import trace | 18 from telemetry.value import trace |
18 | 19 |
19 | 20 |
20 _CR_RENDERER_MAIN = 'CrRendererMain' | 21 _CR_RENDERER_MAIN = 'CrRendererMain' |
21 _RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' | 22 _RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' |
22 _NAMES_TO_DUMP = ['oilpan_precise_mark', | 23 _NAMES_TO_DUMP = ['oilpan_precise_mark', |
23 'oilpan_precise_sweep', | 24 'oilpan_precise_sweep', |
24 'oilpan_conservative_mark', | 25 'oilpan_conservative_mark', |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if not gc_type is None and not forced: | 59 if not gc_type is None and not forced: |
59 values['oilpan_%s_mark' % gc_type].append(mark_time) | 60 values['oilpan_%s_mark' % gc_type].append(mark_time) |
60 values['oilpan_%s_sweep' % gc_type].append(sweep_time) | 61 values['oilpan_%s_sweep' % gc_type].append(sweep_time) |
61 | 62 |
62 # Dump | 63 # Dump |
63 page = results.current_page | 64 page = results.current_page |
64 unit = 'ms' | 65 unit = 'ms' |
65 for name in _NAMES_TO_DUMP: | 66 for name in _NAMES_TO_DUMP: |
66 if values[name]: | 67 if values[name]: |
67 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 68 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
68 page, name, unit, values[name])) | 69 page, name, unit, values[name], |
| 70 improvement_direction=improvement_direction.DOWN)) |
69 results.AddValue(scalar.ScalarValue( | 71 results.AddValue(scalar.ScalarValue( |
70 page, name + '_max', unit, max(values[name]))) | 72 page, name + '_max', unit, max(values[name]), |
| 73 improvement_direction=improvement_direction.DOWN)) |
71 results.AddValue(scalar.ScalarValue( | 74 results.AddValue(scalar.ScalarValue( |
72 page, name + '_total', unit, sum(values[name]))) | 75 page, name + '_total', unit, sum(values[name]), |
| 76 improvement_direction=improvement_direction.DOWN)) |
73 | 77 |
74 for do_type in ['mark', 'sweep']: | 78 for do_type in ['mark', 'sweep']: |
75 work_time = 0 | 79 work_time = 0 |
76 for gc_type in ['precise', 'conservative']: | 80 for gc_type in ['precise', 'conservative']: |
77 work_time += sum(values['oilpan_%s_%s' % (gc_type, do_type)]) | 81 work_time += sum(values['oilpan_%s_%s' % (gc_type, do_type)]) |
78 key = 'oilpan_%s' % do_type | 82 key = 'oilpan_%s' % do_type |
79 results.AddValue(scalar.ScalarValue(page, key, unit, work_time)) | 83 results.AddValue(scalar.ScalarValue(page, key, unit, work_time, |
| 84 improvement_direction=improvement_direction.DOWN)) |
80 | 85 |
81 gc_time = 0 | 86 gc_time = 0 |
82 for key in values: | 87 for key in values: |
83 gc_time += sum(values[key]) | 88 gc_time += sum(values[key]) |
84 results.AddValue(scalar.ScalarValue(page, 'oilpan_gc', unit, gc_time)) | 89 results.AddValue(scalar.ScalarValue( |
| 90 page, 'oilpan_gc', unit, gc_time, |
| 91 improvement_direction=improvement_direction.DOWN)) |
85 | 92 |
86 | 93 |
87 class _OilpanGCTimesBase(page_test.PageTest): | 94 class _OilpanGCTimesBase(page_test.PageTest): |
88 def __init__(self, action_name = ''): | 95 def __init__(self, action_name = ''): |
89 super(_OilpanGCTimesBase, self).__init__(action_name) | 96 super(_OilpanGCTimesBase, self).__init__(action_name) |
90 self._timeline_model = None | 97 self._timeline_model = None |
91 | 98 |
92 def WillNavigateToPage(self, page, tab): | 99 def WillNavigateToPage(self, page, tab): |
93 # FIXME: Remove webkit.console when blink.console lands in chromium and | 100 # FIXME: Remove webkit.console when blink.console lands in chromium and |
94 # the ref builds are updated. crbug.com/386847 | 101 # the ref builds are updated. crbug.com/386847 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 156 |
150 class OilpanGCTimesForInternals(_OilpanGCTimesBase): | 157 class OilpanGCTimesForInternals(_OilpanGCTimesBase): |
151 def __init__(self): | 158 def __init__(self): |
152 super(OilpanGCTimesForInternals, self).__init__() | 159 super(OilpanGCTimesForInternals, self).__init__() |
153 | 160 |
154 @classmethod | 161 @classmethod |
155 def CustomizeBrowserOptions(cls, options): | 162 def CustomizeBrowserOptions(cls, options): |
156 # 'expose-internals-for-testing' can be enabled on content shell. | 163 # 'expose-internals-for-testing' can be enabled on content shell. |
157 assert 'content-shell' in options.browser_type | 164 assert 'content-shell' in options.browser_type |
158 options.AppendExtraBrowserArgs('--expose-internals-for-testing') | 165 options.AppendExtraBrowserArgs('--expose-internals-for-testing') |
OLD | NEW |