| 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 from telemetry.core.platform import tracing_category_filter | 5 from telemetry.core.platform import tracing_category_filter |
| 6 from telemetry.core.platform import tracing_options | 6 from telemetry.core.platform import tracing_options |
| 7 from telemetry.timeline.model import TimelineModel | 7 from telemetry.timeline.model import TimelineModel |
| 8 from telemetry.page import page_test | 8 from telemetry.page import page_test |
| 9 from telemetry.util import statistics | 9 from telemetry.util import statistics |
| 10 from telemetry.value import improvement_direction |
| 10 from telemetry.value import scalar | 11 from telemetry.value import scalar |
| 11 | 12 |
| 12 _CATEGORIES = ['webkit.console', | 13 _CATEGORIES = ['webkit.console', |
| 13 'blink.console', | 14 'blink.console', |
| 14 'benchmark', | 15 'benchmark', |
| 15 'toplevel', | 16 'toplevel', |
| 16 'blink', | 17 'blink', |
| 17 'blink_gc', | 18 'blink_gc', |
| 18 'cc', | 19 'cc', |
| 19 'v8'] | 20 'v8'] |
| (...skipping 29 matching lines...) Expand all Loading... |
| 49 | 50 |
| 50 sorted_tasks = sorted(tasks, | 51 sorted_tasks = sorted(tasks, |
| 51 key=lambda slice: slice.median_self_duration, reverse=True) | 52 key=lambda slice: slice.median_self_duration, reverse=True) |
| 52 | 53 |
| 53 for task in sorted_tasks[:self.GetExpectedResultCount()]: | 54 for task in sorted_tasks[:self.GetExpectedResultCount()]: |
| 54 results.AddValue(scalar.ScalarValue( | 55 results.AddValue(scalar.ScalarValue( |
| 55 results.current_page, | 56 results.current_page, |
| 56 task.key, | 57 task.key, |
| 57 'ms', | 58 'ms', |
| 58 task.median_self_duration, | 59 task.median_self_duration, |
| 59 description = 'Slowest tasks')) | 60 description = 'Slowest tasks', |
| 61 improvement_direction=improvement_direction.DOWN)) |
| 60 | 62 |
| 61 @staticmethod | 63 @staticmethod |
| 62 def GetTasks(process): | 64 def GetTasks(process): |
| 63 task_dictionary = {} | 65 task_dictionary = {} |
| 64 depth = 1 | 66 depth = 1 |
| 65 for parent, task_slice in enumerate( | 67 for parent, task_slice in enumerate( |
| 66 process.IterAllSlicesOfName('MessageLoop::RunTask')): | 68 process.IterAllSlicesOfName('MessageLoop::RunTask')): |
| 67 ProcessTasksForSlice(task_dictionary, task_slice, depth, parent) | 69 ProcessTasksForSlice(task_dictionary, task_slice, depth, parent) |
| 68 # Return dictionary flattened into a list | 70 # Return dictionary flattened into a list |
| 69 return task_dictionary.values() | 71 return task_dictionary.values() |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if key in dictionary: | 119 if key in dictionary: |
| 118 dictionary[key].Update( | 120 dictionary[key].Update( |
| 119 self_duration, total_duration, depth, parent) | 121 self_duration, total_duration, depth, parent) |
| 120 else: | 122 else: |
| 121 dictionary[key] = SliceData( | 123 dictionary[key] = SliceData( |
| 122 key, self_duration, total_duration, depth, parent) | 124 key, self_duration, total_duration, depth, parent) |
| 123 | 125 |
| 124 # Process sub slices recursively | 126 # Process sub slices recursively |
| 125 for sub_slice in task_slice.sub_slices: | 127 for sub_slice in task_slice.sub_slices: |
| 126 ProcessTasksForSlice(dictionary, sub_slice, depth + 1, parent) | 128 ProcessTasksForSlice(dictionary, sub_slice, depth + 1, parent) |
| OLD | NEW |