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

Unified Diff: tools/telemetry/telemetry/web_perf/metrics/smoothness.py

Issue 1092803002: telemetry: Remove gaps between interactions when calculating smoothness metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest. Change new method to static. Created 5 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
Index: tools/telemetry/telemetry/web_perf/metrics/smoothness.py
diff --git a/tools/telemetry/telemetry/web_perf/metrics/smoothness.py b/tools/telemetry/telemetry/web_perf/metrics/smoothness.py
index f63fea8bed3b45ec5c6ceaab2248f226f85c7e76..127e0ad05ec0487d5f0fda81284836ab0ba80c06 100644
--- a/tools/telemetry/telemetry/web_perf/metrics/smoothness.py
+++ b/tools/telemetry/telemetry/web_perf/metrics/smoothness.py
@@ -87,6 +87,21 @@ class SmoothnessMetric(timeline_based_metric.TimelineBasedMetric):
if d / refresh_period >= min_normalized_delta]
return (deltas, [delta / refresh_period for delta in deltas])
+ @staticmethod
+ def _JoinTimestampRanges(frame_timestamps):
+ """Joins ranges of timestamps, adjusting timestamps to remove deltas
+ between the start of a range and the end of the prior range.
+ """
+ timestamps = []
+ for timestamp_range in frame_timestamps:
+ if len(timestamps) == 0:
+ timestamps.extend(timestamp_range)
+ else:
+ for i in range(1, len(timestamp_range)):
+ timestamps.append(timestamps[-1] +
+ timestamp_range[i] - timestamp_range[i-1])
+ return timestamps
+
def _ComputeSurfaceFlingerMetric(self, page, stats):
jank_count = None
avg_surface_fps = None
@@ -94,7 +109,7 @@ class SmoothnessMetric(timeline_based_metric.TimelineBasedMetric):
frame_lengths = None
none_value_reason = None
if self._HasEnoughFrames(stats.frame_timestamps):
mithro-old 2015/04/21 03:45:58 Why does this metric use stats.frame_timestamps ra
vmiura 2015/04/21 22:04:46 I think you're right, it looks like these metrics
- timestamps = FlattenList(stats.frame_timestamps)
+ timestamps = self._JoinTimestampRanges(stats.frame_timestamps)
frame_count = len(timestamps)
milliseconds = timestamps[-1] - timestamps[0]
min_normalized_frame_length = 0.5

Powered by Google App Engine
This is Rietveld 408576698