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

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

Issue 23766009: Telemetry: smoothness measurement throws MissingTimelineMarker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Insert line breaks inbetween top-levels. Created 7 years, 3 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
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/page_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 metrics import loading 4 from metrics import loading
5 from metrics import smoothness 5 from metrics import smoothness
6 from metrics.gpu_rendering_stats import GpuRenderingStats 6 from metrics.gpu_rendering_stats import GpuRenderingStats
7 from telemetry.page import page_measurement 7 from telemetry.page import page_measurement
8 8
9
9 class DidNotScrollException(page_measurement.MeasurementFailure): 10 class DidNotScrollException(page_measurement.MeasurementFailure):
10 def __init__(self): 11 def __init__(self):
11 super(DidNotScrollException, self).__init__('Page did not scroll') 12 super(DidNotScrollException, self).__init__('Page did not scroll')
12 13
14
13 class MissingDisplayFrameRate(page_measurement.MeasurementFailure): 15 class MissingDisplayFrameRate(page_measurement.MeasurementFailure):
14 def __init__(self, name): 16 def __init__(self, name):
15 super(MissingDisplayFrameRate, self).__init__( 17 super(MissingDisplayFrameRate, self).__init__(
16 'Missing display frame rate metrics: ' + name) 18 'Missing display frame rate metrics: ' + name)
17 19
20
21 class MissingTimelineMarker(page_measurement.MeasurementFailure):
22 def __init__(self):
23 super(MissingTimelineMarker, self).__init__('Timeline marker not found')
24
25
18 class Smoothness(page_measurement.PageMeasurement): 26 class Smoothness(page_measurement.PageMeasurement):
19 def __init__(self): 27 def __init__(self):
20 super(Smoothness, self).__init__('smoothness') 28 super(Smoothness, self).__init__('smoothness')
21 self.force_enable_threaded_compositing = False 29 self.force_enable_threaded_compositing = False
22 self._metrics = None 30 self._metrics = None
23 31
24 def AddCommandLineOptions(self, parser): 32 def AddCommandLineOptions(self, parser):
25 parser.add_option('--report-all-results', dest='report_all_results', 33 parser.add_option('--report-all-results', dest='report_all_results',
26 action='store_true', 34 action='store_true',
27 help='Reports all data collected, not just FPS') 35 help='Reports all data collected, not just FPS')
(...skipping 22 matching lines...) Expand all
50 if not action.CanBeBound(): 58 if not action.CanBeBound():
51 self._metrics.Stop() 59 self._metrics.Stop()
52 tab.browser.StopTracing() 60 tab.browser.StopTracing()
53 61
54 def FindTimelineMarker(self, timeline): 62 def FindTimelineMarker(self, timeline):
55 events = [s for 63 events = [s for
56 s in timeline.GetAllEventsOfName( 64 s in timeline.GetAllEventsOfName(
57 smoothness.TIMELINE_MARKER) 65 smoothness.TIMELINE_MARKER)
58 if s.parent_slice == None] 66 if s.parent_slice == None]
59 if len(events) != 1: 67 if len(events) != 1:
60 raise LookupError, 'timeline marker not found' 68 raise MissingTimelineMarker()
61 return events[0] 69 return events[0]
62 70
63 def MeasurePage(self, page, tab, results): 71 def MeasurePage(self, page, tab, results):
64 rendering_stats_deltas = self._metrics.deltas 72 rendering_stats_deltas = self._metrics.deltas
65 73
66 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0): 74 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0):
67 raise DidNotScrollException() 75 raise DidNotScrollException()
68 76
69 loading.LoadingMetric().AddResults(tab, results) 77 loading.LoadingMetric().AddResults(tab, results)
70 78
71 smoothness.CalcFirstPaintTimeResults(results, tab) 79 smoothness.CalcFirstPaintTimeResults(results, tab)
72 80
73 timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel() 81 timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel()
74 timeline_marker = self.FindTimelineMarker(timeline) 82 timeline_marker = self.FindTimelineMarker(timeline)
75 benchmark_stats = GpuRenderingStats(timeline_marker, 83 benchmark_stats = GpuRenderingStats(timeline_marker,
76 rendering_stats_deltas, 84 rendering_stats_deltas,
77 self._metrics.is_using_gpu_benchmarking) 85 self._metrics.is_using_gpu_benchmarking)
78 smoothness.CalcResults(benchmark_stats, results) 86 smoothness.CalcResults(benchmark_stats, results)
79 87
80 if self.options.report_all_results: 88 if self.options.report_all_results:
81 for k, v in rendering_stats_deltas.iteritems(): 89 for k, v in rendering_stats_deltas.iteritems():
82 results.Add(k, '', v) 90 results.Add(k, '', v)
83 91
84 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 92 if tab.browser.platform.IsRawDisplayFrameRateSupported():
85 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): 93 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
86 if r.value is None: 94 if r.value is None:
87 raise MissingDisplayFrameRate(r.name) 95 raise MissingDisplayFrameRate(r.name)
88 results.Add(r.name, r.unit, r.value) 96 results.Add(r.name, r.unit, r.value)
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/page_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698