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

Unified Diff: tools/perf/metrics/rendering_stats_unittest.py

Issue 268803002: re-land: telemetry: Add approximated pixels percentage to smoothness. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/metrics/rendering_stats.py ('k') | tools/perf/metrics/smoothness.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/rendering_stats_unittest.py
diff --git a/tools/perf/metrics/rendering_stats_unittest.py b/tools/perf/metrics/rendering_stats_unittest.py
index 10419ca0c333a99d2d5a23de6845a766b2f4894c..edd8994cb4beb12fd5d85ad8d26094ab763f56f5 100644
--- a/tools/perf/metrics/rendering_stats_unittest.py
+++ b/tools/perf/metrics/rendering_stats_unittest.py
@@ -12,6 +12,7 @@ from metrics.rendering_stats import ComputeTouchScrollLatency
from metrics.rendering_stats import HasRenderingStats
from metrics.rendering_stats import RenderingStats
from metrics.rendering_stats import NotEnoughFramesError
+from telemetry.util.statistics import DivideIfPossibleOrZero
import telemetry.core.timeline.bounds as timeline_bounds
from telemetry.core.timeline import model
import telemetry.core.timeline.async_slice as tracing_async_slice
@@ -47,6 +48,7 @@ class ReferenceRenderingStats(object):
self.recorded_pixel_counts = []
self.rasterize_times = []
self.rasterized_pixel_counts = []
+ self.approximated_pixel_percentages = []
def AppendNewRange(self):
self.frame_timestamps.append([])
@@ -57,6 +59,7 @@ class ReferenceRenderingStats(object):
self.recorded_pixel_counts.append([])
self.rasterize_times.append([])
self.rasterized_pixel_counts.append([])
+ self.approximated_pixel_percentages.append([])
class ReferenceInputLatencyStats(object):
""" Stores expected data for comparison with actual input latency stats """
@@ -119,7 +122,9 @@ def AddImplThreadRenderingStats(mock_timer, thread, first_frame,
# Create randonm data and timestap for impl thread rendering stats.
data = { 'frame_count': 1,
'rasterize_time': mock_timer.Advance(5, 10) / 1000.0,
- 'rasterized_pixel_count': 1280*720 }
+ 'rasterized_pixel_count': 1280*720,
+ 'visible_content_area': random.uniform(0, 100),
+ 'approximated_visible_content_area': random.uniform(0, 5)}
timestamp = mock_timer.Get()
# Add a slice with the event data to the given thread.
@@ -142,6 +147,9 @@ def AddImplThreadRenderingStats(mock_timer, thread, first_frame,
ref_stats.rasterize_times[-1].append(data['rasterize_time'] * 1000.0)
ref_stats.rasterized_pixel_counts[-1].append(data['rasterized_pixel_count'])
+ ref_stats.approximated_pixel_percentages[-1].append(
+ round(DivideIfPossibleOrZero(data['approximated_visible_content_area'],
+ data['visible_content_area']) * 100.0, 3))
def AddInputLatencyStats(mock_timer, input_type, start_thread, end_thread,
@@ -359,6 +367,8 @@ class RenderingStatsUnitTest(unittest.TestCase):
self.assertEquals(stats.rasterize_times, renderer_ref_stats.rasterize_times)
self.assertEquals(stats.rasterized_pixel_counts,
renderer_ref_stats.rasterized_pixel_counts)
+ self.assertEquals(stats.approximated_pixel_percentages,
+ renderer_ref_stats.approximated_pixel_percentages)
self.assertEquals(stats.paint_times, renderer_ref_stats.paint_times)
self.assertEquals(stats.painted_pixel_counts,
renderer_ref_stats.painted_pixel_counts)
« no previous file with comments | « tools/perf/metrics/rendering_stats.py ('k') | tools/perf/metrics/smoothness.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698