Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: tools/perf/measurements/thread_times.py

Issue 392613002: Telemetry: Initialize smoothness and thread_times metrics before page load, not after. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split Start into SetUp and Start for smoothness and timeline controller. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 from measurements import timeline_controller 4 from measurements import timeline_controller
5 from metrics import timeline 5 from metrics import timeline
6 from telemetry.core.backends.chrome import tracing_backend 6 from telemetry.core.backends.chrome import tracing_backend
7 from telemetry.page import page_measurement 7 from telemetry.page import page_measurement
8 8
9 class ThreadTimes(page_measurement.PageMeasurement): 9 class ThreadTimes(page_measurement.PageMeasurement):
10 def __init__(self): 10 def __init__(self):
11 super(ThreadTimes, self).__init__('RunSmoothness') 11 super(ThreadTimes, self).__init__('RunSmoothness')
12 self._timeline_controller = None 12 self._timeline_controller = None
13 13
14 @classmethod 14 @classmethod
15 def AddCommandLineArgs(cls, parser): 15 def AddCommandLineArgs(cls, parser):
16 parser.add_option('--report-silk-results', action='store_true', 16 parser.add_option('--report-silk-results', action='store_true',
17 help='Report results relevant to silk.') 17 help='Report results relevant to silk.')
18 parser.add_option('--report-silk-details', action='store_true', 18 parser.add_option('--report-silk-details', action='store_true',
19 help='Report details relevant to silk.') 19 help='Report details relevant to silk.')
20 20
21 @property 21 @property
22 def results_are_the_same_on_every_page(self): 22 def results_are_the_same_on_every_page(self):
23 return False 23 return False
24 24
25 def WillRunActions(self, page, tab): 25 def WillNavigateToPage(self, page, tab):
26 self._timeline_controller = timeline_controller.TimelineController() 26 self._timeline_controller = timeline_controller.TimelineController()
27 if self.options.report_silk_details: 27 if self.options.report_silk_details:
28 # We need the other traces in order to have any details to report. 28 # We need the other traces in order to have any details to report.
29 self.timeline_controller.trace_categories = \ 29 self.timeline_controller.trace_categories = \
30 tracing_backend.DEFAULT_TRACE_CATEGORIES 30 tracing_backend.DEFAULT_TRACE_CATEGORIES
31 else: 31 else:
32 self._timeline_controller.trace_categories = \ 32 self._timeline_controller.trace_categories = \
33 tracing_backend.MINIMAL_TRACE_CATEGORIES 33 tracing_backend.MINIMAL_TRACE_CATEGORIES
34 self._timeline_controller.Start(page, tab) 34 self._timeline_controller.SetUp(page, tab)
35
36 def WillRunActions(self, page, tab):
37 self._timeline_controller.Start(tab)
35 38
36 def DidRunActions(self, page, tab): 39 def DidRunActions(self, page, tab):
37 self._timeline_controller.Stop(tab) 40 self._timeline_controller.Stop(tab)
38 41
39 def MeasurePage(self, page, tab, results): 42 def MeasurePage(self, page, tab, results):
40 metric = timeline.ThreadTimesTimelineMetric() 43 metric = timeline.ThreadTimesTimelineMetric()
41 renderer_thread = \ 44 renderer_thread = \
42 self._timeline_controller.model.GetRendererThreadFromTabId(tab.id) 45 self._timeline_controller.model.GetRendererThreadFromTabId(tab.id)
43 if self.options.report_silk_results: 46 if self.options.report_silk_results:
44 metric.results_to_report = timeline.ReportSilkResults 47 metric.results_to_report = timeline.ReportSilkResults
45 if self.options.report_silk_details: 48 if self.options.report_silk_details:
46 metric.details_to_report = timeline.ReportSilkDetails 49 metric.details_to_report = timeline.ReportSilkDetails
47 metric.AddResults(self._timeline_controller.model, renderer_thread, 50 metric.AddResults(self._timeline_controller.model, renderer_thread,
48 self._timeline_controller.smooth_records, results) 51 self._timeline_controller.smooth_records, results)
49 52
50 def CleanUpAfterPage(self, _, tab): 53 def CleanUpAfterPage(self, _, tab):
51 self._timeline_controller.CleanUp(tab) 54 self._timeline_controller.CleanUp(tab)
OLDNEW
« no previous file with comments | « tools/perf/measurements/smoothness_unittest.py ('k') | tools/perf/measurements/timeline_controller.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698