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

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

Issue 185953004: Add some statistics to the monsoon profile run (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebase and provide own statistics functions Created 6 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 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 4
5 from metrics import Metric 5 from metrics import Metric
6 from metrics import rendering_stats 6 from metrics import rendering_stats
7 from metrics import statistics
8 from telemetry.page import page_measurement 7 from telemetry.page import page_measurement
9 from telemetry.page.perf_tests_helper import FlattenList 8 from telemetry.page.perf_tests_helper import FlattenList
10 from telemetry.core.timeline.model import TimelineModel 9 from telemetry.core.timeline.model import TimelineModel
10 from telemetry.util import statistics
11 11
12 TIMELINE_MARKER = 'Smoothness' 12 TIMELINE_MARKER = 'Smoothness'
13 13
14 14
15 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure): 15 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure):
16 def __init__(self, name): 16 def __init__(self, name):
17 super(MissingDisplayFrameRateError, self).__init__( 17 super(MissingDisplayFrameRateError, self).__init__(
18 'Missing display frame rate metrics: ' + name) 18 'Missing display frame rate metrics: ' + name)
19 19
20 class NotEnoughFramesError(page_measurement.MeasurementFailure): 20 class NotEnoughFramesError(page_measurement.MeasurementFailure):
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 renderer_process = timeline_model.GetRendererProcessFromTab(tab) 69 renderer_process = timeline_model.GetRendererProcessFromTab(tab)
70 self._stats = rendering_stats.RenderingStats( 70 self._stats = rendering_stats.RenderingStats(
71 renderer_process, timeline_model.browser_process, timeline_ranges) 71 renderer_process, timeline_model.browser_process, timeline_ranges)
72 72
73 if not self._stats.frame_times: 73 if not self._stats.frame_times:
74 raise NotEnoughFramesError() 74 raise NotEnoughFramesError()
75 75
76 def AddResults(self, tab, results): 76 def AddResults(self, tab, results):
77 if self._stats.mouse_wheel_scroll_latency: 77 if self._stats.mouse_wheel_scroll_latency:
78 mean_mouse_wheel_scroll_latency = statistics.ArithmeticMean( 78 mean_mouse_wheel_scroll_latency = statistics.ArithmeticMean(
79 self._stats.mouse_wheel_scroll_latency, 79 self._stats.mouse_wheel_scroll_latency)
80 len(self._stats.mouse_wheel_scroll_latency))
81 mouse_wheel_scroll_latency_discrepancy = statistics.DurationsDiscrepancy( 80 mouse_wheel_scroll_latency_discrepancy = statistics.DurationsDiscrepancy(
82 self._stats.mouse_wheel_scroll_latency) 81 self._stats.mouse_wheel_scroll_latency)
83 results.Add('mean_mouse_wheel_scroll_latency', 'ms', 82 results.Add('mean_mouse_wheel_scroll_latency', 'ms',
84 round(mean_mouse_wheel_scroll_latency, 3)) 83 round(mean_mouse_wheel_scroll_latency, 3))
85 results.Add('mouse_wheel_scroll_latency_discrepancy', '', 84 results.Add('mouse_wheel_scroll_latency_discrepancy', '',
86 round(mouse_wheel_scroll_latency_discrepancy, 4)) 85 round(mouse_wheel_scroll_latency_discrepancy, 4))
87 86
88 if self._stats.touch_scroll_latency: 87 if self._stats.touch_scroll_latency:
89 mean_touch_scroll_latency = statistics.ArithmeticMean( 88 mean_touch_scroll_latency = statistics.ArithmeticMean(
90 self._stats.touch_scroll_latency, 89 self._stats.touch_scroll_latency)
91 len(self._stats.touch_scroll_latency))
92 touch_scroll_latency_discrepancy = statistics.DurationsDiscrepancy( 90 touch_scroll_latency_discrepancy = statistics.DurationsDiscrepancy(
93 self._stats.touch_scroll_latency) 91 self._stats.touch_scroll_latency)
94 results.Add('mean_touch_scroll_latency', 'ms', 92 results.Add('mean_touch_scroll_latency', 'ms',
95 round(mean_touch_scroll_latency, 3)) 93 round(mean_touch_scroll_latency, 3))
96 results.Add('touch_scroll_latency_discrepancy', '', 94 results.Add('touch_scroll_latency_discrepancy', '',
97 round(touch_scroll_latency_discrepancy, 4)) 95 round(touch_scroll_latency_discrepancy, 4))
98 96
99 if self._stats.js_touch_scroll_latency: 97 if self._stats.js_touch_scroll_latency:
100 mean_js_touch_scroll_latency = statistics.ArithmeticMean( 98 mean_js_touch_scroll_latency = statistics.ArithmeticMean(
101 self._stats.js_touch_scroll_latency, 99 self._stats.js_touch_scroll_latency)
102 len(self._stats.js_touch_scroll_latency))
103 js_touch_scroll_latency_discrepancy = statistics.DurationsDiscrepancy( 100 js_touch_scroll_latency_discrepancy = statistics.DurationsDiscrepancy(
104 self._stats.js_touch_scroll_latency) 101 self._stats.js_touch_scroll_latency)
105 results.Add('mean_js_touch_scroll_latency', 'ms', 102 results.Add('mean_js_touch_scroll_latency', 'ms',
106 round(mean_js_touch_scroll_latency, 3)) 103 round(mean_js_touch_scroll_latency, 3))
107 results.Add('js_touch_scroll_latency_discrepancy', '', 104 results.Add('js_touch_scroll_latency_discrepancy', '',
108 round(js_touch_scroll_latency_discrepancy, 4)) 105 round(js_touch_scroll_latency_discrepancy, 4))
109 106
110 # List of raw frame times. 107 # List of raw frame times.
111 frame_times = FlattenList(self._stats.frame_times) 108 frame_times = FlattenList(self._stats.frame_times)
112 results.Add('frame_times', 'ms', frame_times) 109 results.Add('frame_times', 'ms', frame_times)
113 110
114 # Arithmetic mean of frame times. 111 # Arithmetic mean of frame times.
115 mean_frame_time = statistics.ArithmeticMean(frame_times, 112 mean_frame_time = statistics.ArithmeticMean(frame_times)
116 len(frame_times))
117 results.Add('mean_frame_time', 'ms', round(mean_frame_time, 3)) 113 results.Add('mean_frame_time', 'ms', round(mean_frame_time, 3))
118 114
119 # Absolute discrepancy of frame time stamps. 115 # Absolute discrepancy of frame time stamps.
120 frame_discrepancy = statistics.TimestampsDiscrepancy( 116 frame_discrepancy = statistics.TimestampsDiscrepancy(
121 self._stats.frame_timestamps) 117 self._stats.frame_timestamps)
122 results.Add('jank', 'ms', round(frame_discrepancy, 4)) 118 results.Add('jank', 'ms', round(frame_discrepancy, 4))
123 119
124 # Are we hitting 60 fps for 95 percent of all frames? 120 # Are we hitting 60 fps for 95 percent of all frames?
125 # We use 19ms as a somewhat looser threshold, instead of 1000.0/60.0. 121 # We use 19ms as a somewhat looser threshold, instead of 1000.0/60.0.
126 percentile_95 = statistics.Percentile(frame_times, 95.0) 122 percentile_95 = statistics.Percentile(frame_times, 95.0)
127 results.Add('mostly_smooth', 'score', 1.0 if percentile_95 < 19.0 else 0.0) 123 results.Add('mostly_smooth', 'score', 1.0 if percentile_95 < 19.0 else 0.0)
128 124
129 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 125 if tab.browser.platform.IsRawDisplayFrameRateSupported():
130 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): 126 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
131 if r.value is None: 127 if r.value is None:
132 raise MissingDisplayFrameRateError(r.name) 128 raise MissingDisplayFrameRateError(r.name)
133 results.Add(r.name, r.unit, r.value) 129 results.Add(r.name, r.unit, r.value)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698