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

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

Issue 26031002: cc: Remove unused metrics from RenderingStats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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 import os 4 import os
5 import math 5 import math
6 6
7 from metrics import discrepancy 7 from metrics import discrepancy
8 from telemetry.core import util 8 from telemetry.core import util
9 from telemetry.page import page_measurement 9 from telemetry.page import page_measurement
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 'window.chrome.loadTimes().firstPaintTime - ' + 164 'window.chrome.loadTimes().firstPaintTime - ' +
165 'window.chrome.loadTimes().startLoadTime') 165 'window.chrome.loadTimes().startLoadTime')
166 166
167 results.Add('first_paint', 'ms', round(first_paint_secs * 1000, 1)) 167 results.Add('first_paint', 'ms', round(first_paint_secs * 1000, 1))
168 168
169 169
170 def CalcResults(benchmark_stats, results): 170 def CalcResults(benchmark_stats, results):
171 s = benchmark_stats 171 s = benchmark_stats
172 172
173 frame_times = [] 173 frame_times = []
174 for i in xrange(1, len(s.screen_frame_timestamps)): 174 for i in xrange(1, len(s.frame_timestamps)):
175 frame_times.append( 175 frame_times.append(
176 round(s.screen_frame_timestamps[i] - s.screen_frame_timestamps[i-1], 2)) 176 round(s.frame_timestamps[i] - s.frame_timestamps[i-1], 2))
177 177
178 # List of raw frame times. 178 # List of raw frame times.
179 results.Add('frame_times', 'ms', frame_times) 179 results.Add('frame_times', 'ms', frame_times)
180 180
181 # Arithmetic mean of frame times. Not the generalized mean. 181 # Arithmetic mean of frame times. Not the generalized mean.
182 results.Add('mean_frame_time', 'ms', 182 results.Add('mean_frame_time', 'ms',
183 Average(s.total_time, s.screen_frame_count, 1000, 3)) 183 Average(s.total_time, len(s.frame_timestamps), 1000, 3))
184 184
185 # Absolute discrepancy of frame time stamps. 185 # Absolute discrepancy of frame time stamps.
186 results.Add('jank', '', 186 results.Add('jank', '',
187 round(discrepancy.FrameDiscrepancy(s.screen_frame_timestamps, 187 round(discrepancy.FrameDiscrepancy(s.frame_timestamps,
188 True), 4)) 188 True), 4))
189 189
190 # Are we hitting 60 fps for 95 percent of all frames? (Boolean value) 190 # Are we hitting 60 fps for 95 percent of all frames? (Boolean value)
191 # We use 17ms as a slightly looser threshold, instead of 1000.0/60.0. 191 # We use 17ms as a slightly looser threshold, instead of 1000.0/60.0.
192 results.Add('mostly_smooth', '', 192 results.Add('mostly_smooth', '',
193 Percentile(frame_times, 95.0) < 17.0) 193 Percentile(frame_times, 95.0) < 17.0)
194 194
195 195
196 class MissingTimelineMarker(page_measurement.MeasurementFailure): 196 class MissingTimelineMarker(page_measurement.MeasurementFailure):
197 def __init__(self, name): 197 def __init__(self, name):
198 super(MissingTimelineMarker, self).__init__( 198 super(MissingTimelineMarker, self).__init__(
199 'Timeline marker not found: ' + name) 199 'Timeline marker not found: ' + name)
200 200
201 201
202 def FindTimelineMarker(timeline, name): 202 def FindTimelineMarker(timeline, name):
203 """Find the timeline event with the given name. 203 """Find the timeline event with the given name.
204 204
205 If there is not exactly one such timeline event, raise an error. 205 If there is not exactly one such timeline event, raise an error.
206 """ 206 """
207 events = [s for s in timeline.GetAllEventsOfName(name) 207 events = [s for s in timeline.GetAllEventsOfName(name)
208 if s.parent_slice == None] 208 if s.parent_slice == None]
209 if len(events) != 1: 209 if len(events) != 1:
210 raise MissingTimelineMarker(name) 210 raise MissingTimelineMarker(name)
211 return events[0] 211 return events[0]
212
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698