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

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

Issue 23506030: telemetry: Add new metrics to smoothness benchmark. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replaced 'score' by inverse RMS frame time. 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
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 unittest 4 import unittest
5 import random 5 import random
6 6
7 from metrics import discrepancy
7 from metrics import smoothness 8 from metrics import smoothness
8 from metrics.gpu_rendering_stats import GpuRenderingStats 9 from metrics.gpu_rendering_stats import GpuRenderingStats
9 from telemetry.page import page 10 from telemetry.page import page
10 from telemetry.page.page_measurement_results import PageMeasurementResults 11 from telemetry.page.page_measurement_results import PageMeasurementResults
11 from telemetry.core.backends.chrome.tracing_backend import RawTraceResultImpl 12 from telemetry.core.backends.chrome.tracing_backend import RawTraceResultImpl
12 from telemetry.core.backends.chrome.trace_result import TraceResult 13 from telemetry.core.backends.chrome.trace_result import TraceResult
13 14
14 class MockTimer(object): 15 class MockTimer(object):
15 """ An instance of this class is used as a global timer to generate 16 """ An instance of this class is used as a global timer to generate
16 random durations for stats and consistent timestamps for all mock trace 17 random durations for stats and consistent timestamps for all mock trace
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 smoothness.CalcResults(stats, res) 232 smoothness.CalcResults(stats, res)
232 res.DidMeasurePage() 233 res.DidMeasurePage()
233 234
234 rs = rendering_stats 235 rs = rendering_stats
235 236
236 # Scroll Results 237 # Scroll Results
237 self.assertAlmostEquals( 238 self.assertAlmostEquals(
238 round(rs['totalTimeInSeconds'] / rs['numFramesSentToScreen'] * 1000.0, 239 round(rs['totalTimeInSeconds'] / rs['numFramesSentToScreen'] * 1000.0,
239 3), 240 3),
240 res.page_results[0]['mean_frame_time'].value, 2) 241 res.page_results[0]['mean_frame_time'].value, 2)
242 # We don't verify the correctness of the discrepancy computation
243 # itself, because we have a separate unit test for that purpose.
244 self.assertEquals(
245 round(discrepancy.FrameDiscrepancy(stats.screen_frame_timestamps,
246 True), 4),
247 res.page_results[0]['absolute_frame_discrepancy'].value)
248 self.assertEquals(
249 round(discrepancy.FrameDiscrepancy(stats.screen_frame_timestamps,
250 False), 4),
251 res.page_results[0]['relative_frame_discrepancy'].value)
241 self.assertAlmostEquals( 252 self.assertAlmostEquals(
242 round(rs['droppedFrameCount'] / rs['numFramesSentToScreen'] * 100.0, 1), 253 round(rs['droppedFrameCount'] / rs['numFramesSentToScreen'] * 100.0, 1),
243 res.page_results[0]['dropped_percent'].value) 254 res.page_results[0]['dropped_percent'].value)
244 self.assertAlmostEquals( 255 self.assertAlmostEquals(
245 round(rs['numImplThreadScrolls'] / (rs['numImplThreadScrolls'] + 256 round(rs['numImplThreadScrolls'] / (rs['numImplThreadScrolls'] +
246 rs['numMainThreadScrolls']) * 100.0, 257 rs['numMainThreadScrolls']) * 100.0,
247 1), 258 1),
248 res.page_results[0]['percent_impl_scrolled'].value) 259 res.page_results[0]['percent_impl_scrolled'].value)
249 self.assertAlmostEquals( 260 self.assertAlmostEquals(
250 round(rs['numLayersDrawn'] / rs['numFramesSentToScreen'], 1), 261 round(rs['numLayersDrawn'] / rs['numFramesSentToScreen'], 1),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 self.assertAlmostEquals( 310 self.assertAlmostEquals(
300 round(rs['totalTouchUILatency'] / rs['touchUICount'] * 1000.0, 3), 311 round(rs['totalTouchUILatency'] / rs['touchUICount'] * 1000.0, 3),
301 res.page_results[0]['average_touch_ui_latency'].value) 312 res.page_results[0]['average_touch_ui_latency'].value)
302 self.assertAlmostEquals( 313 self.assertAlmostEquals(
303 round(rs['totalTouchAckedLatency'] / rs['touchAckedCount'] * 1000.0, 3), 314 round(rs['totalTouchAckedLatency'] / rs['touchAckedCount'] * 1000.0, 3),
304 res.page_results[0]['average_touch_acked_latency'].value) 315 res.page_results[0]['average_touch_acked_latency'].value)
305 self.assertAlmostEquals( 316 self.assertAlmostEquals(
306 round(rs['totalScrollUpdateLatency'] / rs['scrollUpdateCount'] * 1000.0, 317 round(rs['totalScrollUpdateLatency'] / rs['scrollUpdateCount'] * 1000.0,
307 3), 318 3),
308 res.page_results[0]['average_scroll_update_latency'].value) 319 res.page_results[0]['average_scroll_update_latency'].value)
OLDNEW
« tools/perf/metrics/smoothness.py ('K') | « tools/perf/metrics/smoothness.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698