Commit 4db467da authored by ernstm's avatar ernstm Committed by Commit bot

telemetry: Replace mostly_smooth by percentage_smooth.

R=tonyg@chromium.org,qyearsley@chromium.org,nednguyen@chromium.org
BUG=422093

Review URL: https://codereview.chromium.org/645753002

Cr-Commit-Position: refs/heads/master@{#299189}
parent 3377c626
...@@ -50,9 +50,10 @@ class RepaintUnitTest(page_test_test_case.PageTestTestCase): ...@@ -50,9 +50,10 @@ class RepaintUnitTest(page_test_test_case.PageTestTestCase):
self.assertEquals(len(jank), 1) self.assertEquals(len(jank), 1)
self.assertGreater(jank[0].GetRepresentativeNumber(), 0) self.assertGreater(jank[0].GetRepresentativeNumber(), 0)
mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') percentage_smooth = results.FindAllPageSpecificValuesNamed(
self.assertEquals(len(mostly_smooth), 1) 'percentage_smooth')
self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) self.assertEquals(len(percentage_smooth), 1)
self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0)
@test.Disabled('android') @test.Disabled('android')
def testCleanUpTrace(self): def testCleanUpTrace(self):
......
...@@ -116,9 +116,10 @@ class SmoothnessUnitTest(page_test_test_case.PageTestTestCase): ...@@ -116,9 +116,10 @@ class SmoothnessUnitTest(page_test_test_case.PageTestTestCase):
self.assertEquals(len(jank), 1) self.assertEquals(len(jank), 1)
self.assertGreater(jank[0].GetRepresentativeNumber(), 0) self.assertGreater(jank[0].GetRepresentativeNumber(), 0)
mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') percentage_smooth = results.FindAllPageSpecificValuesNamed(
self.assertEquals(len(mostly_smooth), 1) 'percentage_smooth')
self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) self.assertEquals(len(percentage_smooth), 1)
self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0)
mean_input_event_latency = results.FindAllPageSpecificValuesNamed( mean_input_event_latency = results.FindAllPageSpecificValuesNamed(
'mean_input_event_latency') 'mean_input_event_latency')
...@@ -136,9 +137,10 @@ class SmoothnessUnitTest(page_test_test_case.PageTestTestCase): ...@@ -136,9 +137,10 @@ class SmoothnessUnitTest(page_test_test_case.PageTestTestCase):
results = self.RunMeasurement(measurement, ps, options=self._options) results = self.RunMeasurement(measurement, ps, options=self._options)
self.assertEquals(0, len(results.failures)) self.assertEquals(0, len(results.failures))
mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') percentage_smooth = results.FindAllPageSpecificValuesNamed(
self.assertEquals(len(mostly_smooth), 1) 'percentage_smooth')
self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) self.assertEquals(len(percentage_smooth), 1)
self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0)
def testCleanUpTrace(self): def testCleanUpTrace(self):
self.TestTracingCleanedUp(smoothness.Smoothness, self._options) self.TestTracingCleanedUp(smoothness.Smoothness, self._options)
......
...@@ -30,7 +30,7 @@ class SmoothnessMetric(timeline_based_metric.TimelineBasedMetric): ...@@ -30,7 +30,7 @@ class SmoothnessMetric(timeline_based_metric.TimelineBasedMetric):
frame_times: A list of raw frame times frame_times: A list of raw frame times
mean_frame_time: The arithmetic mean of frame times mean_frame_time: The arithmetic mean of frame times
mostly_smooth: Whether we hit 60 fps for 95% of all frames percentage_smooth: Percentage of frames that were hitting 60 FPS.
jank: The absolute discrepancy of frame timestamps jank: The absolute discrepancy of frame timestamps
mean_pixels_approximated: The mean percentage of pixels approximated mean_pixels_approximated: The mean percentage of pixels approximated
queueing_durations: The queueing delay between compositor & main threads queueing_durations: The queueing delay between compositor & main threads
...@@ -146,19 +146,20 @@ class SmoothnessMetric(timeline_based_metric.TimelineBasedMetric): ...@@ -146,19 +146,20 @@ class SmoothnessMetric(timeline_based_metric.TimelineBasedMetric):
def _ComputeFrameTimeMetric(self, page, stats): def _ComputeFrameTimeMetric(self, page, stats):
"""Returns Values for the frame time metrics. """Returns Values for the frame time metrics.
This includes the raw and mean frame times, as well as the mostly_smooth This includes the raw and mean frame times, as well as the percentage of
metric which tracks whether we hit 60 fps for 95% of the frames. frames that were hitting 60 fps.
""" """
frame_times = None frame_times = None
mean_frame_time = None mean_frame_time = None
mostly_smooth = None percentage_smooth = None
none_value_reason = None none_value_reason = None
if self._HasEnoughFrames(stats.frame_timestamps): if self._HasEnoughFrames(stats.frame_timestamps):
frame_times = FlattenList(stats.frame_times) frame_times = FlattenList(stats.frame_times)
mean_frame_time = round(statistics.ArithmeticMean(frame_times), 3) mean_frame_time = round(statistics.ArithmeticMean(frame_times), 3)
# We use 19ms as a somewhat looser threshold, instead of 1000.0/60.0. # We use 17ms as a somewhat looser threshold, instead of 1000.0/60.0.
percentile_95 = statistics.Percentile(frame_times, 95.0) smooth_threshold = 17.0
mostly_smooth = 1.0 if percentile_95 < 19.0 else 0.0 smooth_count = sum(1 for t in frame_times if t < smooth_threshold)
percentage_smooth = float(smooth_count) / len(frame_times) * 100.0
else: else:
none_value_reason = NOT_ENOUGH_FRAMES_MESSAGE none_value_reason = NOT_ENOUGH_FRAMES_MESSAGE
return ( return (
...@@ -172,9 +173,8 @@ class SmoothnessMetric(timeline_based_metric.TimelineBasedMetric): ...@@ -172,9 +173,8 @@ class SmoothnessMetric(timeline_based_metric.TimelineBasedMetric):
description='Arithmetic mean of frame times.', description='Arithmetic mean of frame times.',
none_value_reason=none_value_reason), none_value_reason=none_value_reason),
scalar.ScalarValue( scalar.ScalarValue(
page, 'mostly_smooth', 'score', mostly_smooth, page, 'percentage_smooth', 'score', percentage_smooth,
description='Were 95 percent of the frames hitting 60 fps?' description='Percentage of frames that were hitting 60 fps.',
'boolean value (1/0).',
none_value_reason=none_value_reason) none_value_reason=none_value_reason)
) )
......
...@@ -153,17 +153,17 @@ class SmoothnessMetricUnitTest(unittest.TestCase): ...@@ -153,17 +153,17 @@ class SmoothnessMetricUnitTest(unittest.TestCase):
def testComputeFrameTimeMetric(self): def testComputeFrameTimeMetric(self):
stats = _MockRenderingStats(frame_timestamps=self.good_timestamps, stats = _MockRenderingStats(frame_timestamps=self.good_timestamps,
frame_times=[[10, 20], [30, 40, 50]]) frame_times=[[10, 20], [30, 40, 50]])
frame_times_value, mean_frame_time_value, mostly_smooth_value = ( frame_times_value, mean_frame_time_value, percentage_smooth_value = (
self.metric._ComputeFrameTimeMetric(self.page, stats)) self.metric._ComputeFrameTimeMetric(self.page, stats))
self.assertEquals([10, 20, 30, 40, 50], frame_times_value.values) self.assertEquals([10, 20, 30, 40, 50], frame_times_value.values)
self.assertEquals(30, mean_frame_time_value.value) self.assertEquals(30, mean_frame_time_value.value)
self.assertEquals(0, mostly_smooth_value.value) self.assertEquals(20, percentage_smooth_value.value)
def testComputeFrameTimeMetricWithNotEnoughFrames(self): def testComputeFrameTimeMetricWithNotEnoughFrames(self):
stats = _MockRenderingStats( stats = _MockRenderingStats(
frame_timestamps=self.not_enough_frames_timestamps, frame_timestamps=self.not_enough_frames_timestamps,
frame_times=[[10, 20], [30, 40, 50]]) frame_times=[[10, 20], [30, 40, 50]])
frame_times_value, mean_frame_time_value, mostly_smooth_value = ( frame_times_value, mean_frame_time_value, percentage_smooth_value = (
self.metric._ComputeFrameTimeMetric(self.page, stats)) self.metric._ComputeFrameTimeMetric(self.page, stats))
self.assertEquals(None, frame_times_value.values) self.assertEquals(None, frame_times_value.values)
self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE, self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE,
...@@ -171,9 +171,9 @@ class SmoothnessMetricUnitTest(unittest.TestCase): ...@@ -171,9 +171,9 @@ class SmoothnessMetricUnitTest(unittest.TestCase):
self.assertEquals(None, mean_frame_time_value.value) self.assertEquals(None, mean_frame_time_value.value)
self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE, self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE,
mean_frame_time_value.none_value_reason) mean_frame_time_value.none_value_reason)
self.assertEquals(None, mostly_smooth_value.value) self.assertEquals(None, percentage_smooth_value.value)
self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE, self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE,
mostly_smooth_value.none_value_reason) percentage_smooth_value.none_value_reason)
def testComputeFrameTimeDiscrepancy(self): def testComputeFrameTimeDiscrepancy(self):
stats = _MockRenderingStats(frame_timestamps=self.good_timestamps) stats = _MockRenderingStats(frame_timestamps=self.good_timestamps)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment