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

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

Issue 23693005: Revert 222150 "Telemetry: smoothness measurement throws MissingT..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/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
10 class DidNotScrollException(page_measurement.MeasurementFailure): 9 class DidNotScrollException(page_measurement.MeasurementFailure):
11 def __init__(self): 10 def __init__(self):
12 super(DidNotScrollException, self).__init__('Page did not scroll') 11 super(DidNotScrollException, self).__init__('Page did not scroll')
13 12
14
15 class MissingDisplayFrameRate(page_measurement.MeasurementFailure): 13 class MissingDisplayFrameRate(page_measurement.MeasurementFailure):
16 def __init__(self, name): 14 def __init__(self, name):
17 super(MissingDisplayFrameRate, self).__init__( 15 super(MissingDisplayFrameRate, self).__init__(
18 'Missing display frame rate metrics: ' + name) 16 'Missing display frame rate metrics: ' + name)
19 17
20
21 class MissingTimelineMarker(page_measurement.MeasurementFailure):
22 def __init__(self):
23 super(MissingTimelineMarker, self).__init__('Timeline marker not found')
24
25
26 class Smoothness(page_measurement.PageMeasurement): 18 class Smoothness(page_measurement.PageMeasurement):
27 def __init__(self): 19 def __init__(self):
28 super(Smoothness, self).__init__('smoothness') 20 super(Smoothness, self).__init__('smoothness')
29 self.force_enable_threaded_compositing = False 21 self.force_enable_threaded_compositing = False
30 self._metrics = None 22 self._metrics = None
31 23
32 def AddCommandLineOptions(self, parser): 24 def AddCommandLineOptions(self, parser):
33 parser.add_option('--report-all-results', dest='report_all_results', 25 parser.add_option('--report-all-results', dest='report_all_results',
34 action='store_true', 26 action='store_true',
35 help='Reports all data collected, not just FPS') 27 help='Reports all data collected, not just FPS')
(...skipping 24 matching lines...) Expand all
60 if not action.CanBeBound(): 52 if not action.CanBeBound():
61 self._metrics.Stop() 53 self._metrics.Stop()
62 tab.browser.StopTracing() 54 tab.browser.StopTracing()
63 55
64 def FindTimelineMarker(self, timeline): 56 def FindTimelineMarker(self, timeline):
65 events = [s for 57 events = [s for
66 s in timeline.GetAllEventsOfName( 58 s in timeline.GetAllEventsOfName(
67 smoothness.TIMELINE_MARKER) 59 smoothness.TIMELINE_MARKER)
68 if s.parent_slice == None] 60 if s.parent_slice == None]
69 if len(events) != 1: 61 if len(events) != 1:
70 raise MissingTimelineMarker() 62 raise LookupError, 'timeline marker not found'
71 return events[0] 63 return events[0]
72 64
73 def MeasurePage(self, page, tab, results): 65 def MeasurePage(self, page, tab, results):
74 rendering_stats_deltas = self._metrics.deltas 66 rendering_stats_deltas = self._metrics.deltas
75 67
76 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0): 68 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0):
77 raise DidNotScrollException() 69 raise DidNotScrollException()
78 70
79 loading.LoadingMetric().AddResults(tab, results) 71 loading.LoadingMetric().AddResults(tab, results)
80 72
81 smoothness.CalcFirstPaintTimeResults(results, tab) 73 smoothness.CalcFirstPaintTimeResults(results, tab)
82 74
83 timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel() 75 timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel()
84 timeline_marker = self.FindTimelineMarker(timeline) 76 timeline_marker = self.FindTimelineMarker(timeline)
85 benchmark_stats = GpuRenderingStats(timeline_marker, 77 benchmark_stats = GpuRenderingStats(timeline_marker,
86 rendering_stats_deltas, 78 rendering_stats_deltas,
87 self._metrics.is_using_gpu_benchmarking) 79 self._metrics.is_using_gpu_benchmarking)
88 smoothness.CalcResults(benchmark_stats, results) 80 smoothness.CalcResults(benchmark_stats, results)
89 81
90 if self.options.report_all_results: 82 if self.options.report_all_results:
91 for k, v in rendering_stats_deltas.iteritems(): 83 for k, v in rendering_stats_deltas.iteritems():
92 results.Add(k, '', v) 84 results.Add(k, '', v)
93 85
94 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 86 if tab.browser.platform.IsRawDisplayFrameRateSupported():
95 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): 87 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
96 if r.value is None: 88 if r.value is None:
97 raise MissingDisplayFrameRate(r.name) 89 raise MissingDisplayFrameRate(r.name)
98 results.Add(r.name, r.unit, r.value) 90 results.Add(r.name, r.unit, r.value)
OLDNEW
« no previous file with comments | « no previous file | trunk/src/tools/telemetry/telemetry/page/page_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698