Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / tools / perf / measurements / thread_times.py
blob8762502c76652fd4f85229055cf747d45fc8a290
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
3 # found in the LICENSE file.
4 from measurements import timeline_controller
5 from metrics import timeline
6 from telemetry.core.platform import tracing_category_filter
7 from telemetry.page import page_test
8 from telemetry.web_perf.metrics import layout
10 class ThreadTimes(page_test.PageTest):
11 def __init__(self, report_silk_details=False,
12 action_name_to_run='RunPageInteractions'):
13 super(ThreadTimes, self).__init__(action_name_to_run=action_name_to_run)
14 self._timeline_controller = None
15 self._report_silk_details = report_silk_details
17 def WillNavigateToPage(self, page, tab):
18 self._timeline_controller = timeline_controller.TimelineController()
19 if self._report_silk_details:
20 # We need the other traces in order to have any details to report.
21 self._timeline_controller.trace_categories = None
22 else:
23 self._timeline_controller.trace_categories = \
24 tracing_category_filter.CreateNoOverheadFilter().filter_string
25 self._timeline_controller.SetUp(page, tab)
27 def WillRunActions(self, page, tab):
28 self._timeline_controller.Start(tab)
30 def ValidateAndMeasurePage(self, page, tab, results):
31 self._timeline_controller.Stop(tab, results)
32 metric = timeline.ThreadTimesTimelineMetric()
33 renderer_thread = \
34 self._timeline_controller.model.GetRendererThreadFromTabId(tab.id)
35 if self._report_silk_details:
36 metric.details_to_report = timeline.ReportSilkDetails
37 metric.AddResults(self._timeline_controller.model, renderer_thread,
38 self._timeline_controller.smooth_records, results)
39 layout_metric = layout.LayoutMetric()
40 layout_metric.AddResults(self._timeline_controller.model, renderer_thread,
41 self._timeline_controller.smooth_records, results)
43 def CleanUpAfterPage(self, _, tab):
44 self._timeline_controller.CleanUp(tab)