| 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 import collections | 4 import collections |
| 5 | 5 |
| 6 from telemetry.web_perf.metrics import timeline_based_metric | 6 from telemetry.web_perf.metrics import timeline_based_metric |
| 7 | 7 |
| 8 | 8 |
| 9 class LoadTimesTimelineMetric(timeline_based_metric.TimelineBasedMetric): | 9 class LoadTimesTimelineMetric(timeline_based_metric.TimelineBasedMetric): |
| 10 def __init__(self): | 10 def __init__(self): |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 events_by_name = collections.defaultdict(list) | 25 events_by_name = collections.defaultdict(list) |
| 26 renderer_process = renderer_thread.parent | 26 renderer_process = renderer_thread.parent |
| 27 | 27 |
| 28 for thread in renderer_process.threads.itervalues(): | 28 for thread in renderer_process.threads.itervalues(): |
| 29 | 29 |
| 30 if thread_filter and not thread.name in thread_filter: | 30 if thread_filter and not thread.name in thread_filter: |
| 31 continue | 31 continue |
| 32 | 32 |
| 33 thread_name = thread.name.replace('/','_') | 33 thread_name = thread.name.replace('/','_') |
| 34 for e in thread.IterAllSlicesInRange(interaction_record.start, | 34 for e in thread.IterAllSlicesInTimeRange(interaction_record.start, |
| 35 interaction_record.end): | 35 interaction_record.end): |
| 36 events_by_name[e.name].append(e) | 36 events_by_name[e.name].append(e) |
| 37 | 37 |
| 38 for event_name, event_group in events_by_name.iteritems(): | 38 for event_name, event_group in events_by_name.iteritems(): |
| 39 times = [event.self_time for event in event_group] | 39 times = [event.self_time for event in event_group] |
| 40 total = sum(times) | 40 total = sum(times) |
| 41 biggest_jank = max(times) | 41 biggest_jank = max(times) |
| 42 | 42 |
| 43 # Results objects cannot contain the '.' character, so remove that here. | 43 # Results objects cannot contain the '.' character, so remove that here. |
| 44 sanitized_event_name = event_name.replace('.', '_') | 44 sanitized_event_name = event_name.replace('.', '_') |
| 45 | 45 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 num_frames = self.CountSlices(frame_slices, FrameTraceName) | 240 num_frames = self.CountSlices(frame_slices, FrameTraceName) |
| 241 | 241 |
| 242 # Report the desired results and details. | 242 # Report the desired results and details. |
| 243 for thread_results in thread_category_results.values(): | 243 for thread_results in thread_category_results.values(): |
| 244 if thread_results.name in self.results_to_report: | 244 if thread_results.name in self.results_to_report: |
| 245 thread_results.AddResults(num_frames, results) | 245 thread_results.AddResults(num_frames, results) |
| 246 # TOOD(nduca): When generic results objects are done, this special case | 246 # TOOD(nduca): When generic results objects are done, this special case |
| 247 # can be replaced with a generic UI feature. | 247 # can be replaced with a generic UI feature. |
| 248 if thread_results.name in self.details_to_report: | 248 if thread_results.name in self.details_to_report: |
| 249 thread_results.AddDetailedResults(num_frames, results) | 249 thread_results.AddDetailedResults(num_frames, results) |
| OLD | NEW |