| 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 from telemetry.util.statistics import DivideIfPossibleOrZero | 6 from telemetry.util.statistics import DivideIfPossibleOrZero |
| 6 | 7 from telemetry.value import scalar |
| 7 from telemetry.web_perf.metrics import timeline_based_metric | 8 from telemetry.web_perf.metrics import timeline_based_metric |
| 8 from telemetry.value import scalar | |
| 9 | 9 |
| 10 | 10 |
| 11 class LoadTimesTimelineMetric(timeline_based_metric.TimelineBasedMetric): | 11 class LoadTimesTimelineMetric(timeline_based_metric.TimelineBasedMetric): |
| 12 def __init__(self): | 12 def __init__(self): |
| 13 super(LoadTimesTimelineMetric, self).__init__() | 13 super(LoadTimesTimelineMetric, self).__init__() |
| 14 self.report_main_thread_only = True | 14 self.report_main_thread_only = True |
| 15 | 15 |
| 16 def AddResults(self, model, renderer_thread, interaction_records, results): | 16 def AddResults(self, model, renderer_thread, interaction_records, results): |
| 17 assert model | 17 assert model |
| 18 assert len(interaction_records) == 1, ( | 18 assert len(interaction_records) == 1, ( |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 num_frames = frame_rate_thread.CountTracesWithName(FrameTraceName) | 268 num_frames = frame_rate_thread.CountTracesWithName(FrameTraceName) |
| 269 | 269 |
| 270 # Report the desired results and details. | 270 # Report the desired results and details. |
| 271 for thread_results in thread_category_results.values(): | 271 for thread_results in thread_category_results.values(): |
| 272 if thread_results.name in self.results_to_report: | 272 if thread_results.name in self.results_to_report: |
| 273 thread_results.AddResults(num_frames, results) | 273 thread_results.AddResults(num_frames, results) |
| 274 # TOOD(nduca): When generic results objects are done, this special case | 274 # TOOD(nduca): When generic results objects are done, this special case |
| 275 # can be replaced with a generic UI feature. | 275 # can be replaced with a generic UI feature. |
| 276 if thread_results.name in self.details_to_report: | 276 if thread_results.name in self.details_to_report: |
| 277 thread_results.AddDetailedResults(num_frames, results) | 277 thread_results.AddDetailedResults(num_frames, results) |
| OLD | NEW |