| 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 scalar | 10 from telemetry.value import scalar |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 sorted_tasks = sorted(tasks, | 50 sorted_tasks = sorted(tasks, |
| 51 key=lambda slice: slice.median_self_duration, reverse=True) | 51 key=lambda slice: slice.median_self_duration, reverse=True) |
| 52 | 52 |
| 53 for task in sorted_tasks[:self.GetExpectedResultCount()]: | 53 for task in sorted_tasks[:self.GetExpectedResultCount()]: |
| 54 results.AddValue(scalar.ScalarValue( | 54 results.AddValue(scalar.ScalarValue( |
| 55 results.current_page, | 55 results.current_page, |
| 56 task.key, | 56 task.key, |
| 57 'ms', | 57 'ms', |
| 58 task.median_self_duration, | 58 task.median_self_duration, |
| 59 description = 'Slowest tasks')) | 59 description = 'Slowest tasks', |
| 60 higher_is_better=False)) |
| 60 | 61 |
| 61 @staticmethod | 62 @staticmethod |
| 62 def GetTasks(process): | 63 def GetTasks(process): |
| 63 task_dictionary = {} | 64 task_dictionary = {} |
| 64 depth = 1 | 65 depth = 1 |
| 65 for parent, task_slice in enumerate( | 66 for parent, task_slice in enumerate( |
| 66 process.IterAllSlicesOfName('MessageLoop::RunTask')): | 67 process.IterAllSlicesOfName('MessageLoop::RunTask')): |
| 67 ProcessTasksForSlice(task_dictionary, task_slice, depth, parent) | 68 ProcessTasksForSlice(task_dictionary, task_slice, depth, parent) |
| 68 # Return dictionary flattened into a list | 69 # Return dictionary flattened into a list |
| 69 return task_dictionary.values() | 70 return task_dictionary.values() |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if key in dictionary: | 118 if key in dictionary: |
| 118 dictionary[key].Update( | 119 dictionary[key].Update( |
| 119 self_duration, total_duration, depth, parent) | 120 self_duration, total_duration, depth, parent) |
| 120 else: | 121 else: |
| 121 dictionary[key] = SliceData( | 122 dictionary[key] = SliceData( |
| 122 key, self_duration, total_duration, depth, parent) | 123 key, self_duration, total_duration, depth, parent) |
| 123 | 124 |
| 124 # Process sub slices recursively | 125 # Process sub slices recursively |
| 125 for sub_slice in task_slice.sub_slices: | 126 for sub_slice in task_slice.sub_slices: |
| 126 ProcessTasksForSlice(dictionary, sub_slice, depth + 1, parent) | 127 ProcessTasksForSlice(dictionary, sub_slice, depth + 1, parent) |
| OLD | NEW |