Chromium Code Reviews| 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 import benchmark | 9 from telemetry import benchmark |
| 10 from telemetry.core.platform import tracing_category_filter | 10 from telemetry.core.platform import tracing_category_filter |
| 11 from telemetry.core.platform import tracing_options | 11 from telemetry.core.platform import tracing_options |
| 12 from telemetry.page import action_runner | 12 from telemetry.page import action_runner |
| 13 from telemetry.page import page_test | 13 from telemetry.page import page_test |
| 14 from telemetry.results import results_options | 14 from telemetry.results import results_options |
| 15 from telemetry.timeline.model import TimelineModel | 15 from telemetry.timeline.model import TimelineModel |
| 16 from telemetry.util import statistics | 16 from telemetry.util import statistics |
| 17 from telemetry.value import list_of_scalar_values | 17 from telemetry.value import list_of_scalar_values |
| 18 from telemetry.value import scalar | 18 from telemetry.value import scalar |
| 19 from telemetry.value import trace | 19 from telemetry.value import trace |
| 20 | 20 |
| 21 | 21 |
| 22 _CR_RENDERER_MAIN = 'CrRendererMain' | 22 _CR_RENDERER_MAIN = 'CrRendererMain' |
| 23 _RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' | 23 _RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' |
| 24 _GC_REASONS = ['precise', 'conservative', 'idle', 'forced'] | |
| 25 _GC_STAGES = ['mark', 'lazy_sweep', 'complete_sweep'] | |
| 26 | |
| 27 | |
| 28 def _GetGcReason(args): | |
| 29 # Old style | |
| 30 if 'precise' in args: | |
| 31 if args['forced']: | |
| 32 return 'forced' | |
| 33 return 'precise' if args['precise'] else 'conservative' | |
| 34 | |
| 35 if args['gcReason'] == 'ConservativeGC': | |
| 36 return 'conservative' | |
| 37 if args['gcReason'] == 'PreciseGC': | |
| 38 return 'precise' | |
| 39 if args['gcReason'] == 'ForcedGCForTesting': | |
| 40 return 'forced' | |
| 41 if args['gcReason'] == 'IdleGC': | |
| 42 return 'idle' | |
| 43 return None # Unknown | |
| 44 | 24 |
| 45 | 25 |
| 46 def _AddTracingResults(events, results): | 26 def _AddTracingResults(events, results): |
| 27 _GC_REASONS = ['precise', 'conservative', 'idle', 'forced'] | |
| 28 _GC_STAGES = ['mark', 'lazy_sweep', 'complete_sweep'] | |
| 29 | |
| 30 def GetGcReason(args): | |
| 31 # Old format | |
| 32 if 'precise' in args: | |
| 33 if args['forced']: | |
| 34 return 'forced' | |
| 35 return 'precise' if args['precise'] else 'conservative' | |
| 36 | |
| 37 if args['gcReason'] == 'ConservativeGC': | |
| 38 return 'conservative' | |
| 39 if args['gcReason'] == 'PreciseGC': | |
| 40 return 'precise' | |
| 41 if args['gcReason'] == 'ForcedGCForTesting': | |
| 42 return 'forced' | |
| 43 if args['gcReason'] == 'IdleGC': | |
| 44 return 'idle' | |
| 45 return None # Unknown | |
| 46 | |
| 47 def DumpMetric(page, name, values, unit, results): | 47 def DumpMetric(page, name, values, unit, results): |
| 48 if values[name]: | 48 if values[name]: |
| 49 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 49 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
| 50 page, name, unit, values[name])) | 50 page, name, unit, values[name])) |
| 51 results.AddValue(scalar.ScalarValue( | 51 results.AddValue(scalar.ScalarValue( |
| 52 page, name + '_max', unit, max(values[name]))) | 52 page, name + '_max', unit, max(values[name]))) |
| 53 results.AddValue(scalar.ScalarValue( | 53 results.AddValue(scalar.ScalarValue( |
| 54 page, name + '_total', unit, sum(values[name]))) | 54 page, name + '_total', unit, sum(values[name]))) |
| 55 | 55 |
| 56 # Prepare | 56 # Prepare |
| 57 values = {'oilpan_coalesce': []} | 57 values = {'oilpan_coalesce': []} |
| 58 for reason in _GC_REASONS: | 58 for reason in _GC_REASONS: |
| 59 for stage in _GC_STAGES: | 59 for stage in _GC_STAGES: |
| 60 values['oilpan_%s_%s' % (reason, stage)] = [] | 60 values['oilpan_%s_%s' % (reason, stage)] = [] |
| 61 | 61 |
| 62 # Parse in time line | 62 # Parse tarce events |
|
keishi
2015/04/06 07:00:08
nit: /tarce/trace/
peria
2015/04/06 07:06:01
Done.
| |
| 63 reason = None | 63 reason = None |
| 64 mark_time = 0 | 64 mark_time = 0 |
| 65 lazy_sweep_time = 0 | 65 lazy_sweep_time = 0 |
| 66 complete_sweep_time = 0 | 66 complete_sweep_time = 0 |
| 67 for event in events: | 67 for event in events: |
| 68 duration = event.thread_duration or event.duration | 68 duration = event.thread_duration or event.duration |
| 69 if event.name == 'ThreadHeap::coalesce': | 69 if event.name == 'ThreadHeap::coalesce': |
| 70 values['oilpan_coalesce'].append(duration) | 70 values['oilpan_coalesce'].append(duration) |
| 71 continue | 71 continue |
| 72 if event.name == 'Heap::collectGarbage': | 72 if event.name == 'Heap::collectGarbage': |
| 73 if reason is not None: | 73 if reason is not None: |
| 74 values['oilpan_%s_mark' % reason].append(mark_time) | 74 values['oilpan_%s_mark' % reason].append(mark_time) |
| 75 values['oilpan_%s_lazy_sweep' % reason].append(lazy_sweep_time) | 75 values['oilpan_%s_lazy_sweep' % reason].append(lazy_sweep_time) |
| 76 values['oilpan_%s_complete_sweep' % reason].append(complete_sweep_time) | 76 values['oilpan_%s_complete_sweep' % reason].append(complete_sweep_time) |
| 77 | 77 |
| 78 reason = _GetGcReason(event.args) | 78 reason = GetGcReason(event.args) |
| 79 mark_time = duration | 79 mark_time = duration |
| 80 lazy_sweep_time = 0 | 80 lazy_sweep_time = 0 |
| 81 complete_sweep_time = 0 | 81 complete_sweep_time = 0 |
| 82 continue | 82 continue |
| 83 if event.name == 'ThreadHeap::lazySweepPages': | 83 if event.name == 'ThreadHeap::lazySweepPages': |
| 84 lazy_sweep_time += duration | 84 lazy_sweep_time += duration |
| 85 continue | 85 continue |
| 86 if event.name == 'ThreadState::completeSweep': | 86 if event.name == 'ThreadState::completeSweep': |
| 87 complete_sweep_time += duration | 87 complete_sweep_time += duration |
| 88 continue | 88 continue |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 class OilpanGCTimesForInternals(_OilpanGCTimesBase): | 192 class OilpanGCTimesForInternals(_OilpanGCTimesBase): |
| 193 def __init__(self): | 193 def __init__(self): |
| 194 super(OilpanGCTimesForInternals, self).__init__() | 194 super(OilpanGCTimesForInternals, self).__init__() |
| 195 | 195 |
| 196 @classmethod | 196 @classmethod |
| 197 def CustomizeBrowserOptions(cls, options): | 197 def CustomizeBrowserOptions(cls, options): |
| 198 # 'expose-internals-for-testing' can be enabled on content shell. | 198 # 'expose-internals-for-testing' can be enabled on content shell. |
| 199 assert 'content-shell' in options.browser_type | 199 assert 'content-shell' in options.browser_type |
| 200 options.AppendExtraBrowserArgs(['--expose-internals-for-testing', | 200 options.AppendExtraBrowserArgs(['--expose-internals-for-testing', |
| 201 '--js-flags=--expose-gc']) | 201 '--js-flags=--expose-gc']) |
| OLD | NEW |