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

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

Issue 273103003: Add responsiveness_metric for timeline_based_measurement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable timeline_based_measurement smoke test for responsive on windows platform Created 6 years, 6 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/responsiveness_metric.py
diff --git a/tools/telemetry/telemetry/web_perf/metrics/responsiveness_metric.py b/tools/telemetry/telemetry/web_perf/metrics/responsiveness_metric.py
new file mode 100644
index 0000000000000000000000000000000000000000..17e765afeee22b8a19efcedca73157558bd70167
--- /dev/null
+++ b/tools/telemetry/telemetry/web_perf/metrics/responsiveness_metric.py
@@ -0,0 +1,47 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import logging
+
+from telemetry.web_perf import timeline_interaction_record as tir_module
+from telemetry.web_perf.metrics import mainthread_jank_stats
+from telemetry.web_perf.metrics import timeline_based_metric
+
+
+class ResponsivenessMetric(timeline_based_metric.TimelineBasedMetric):
+ """Computes metrics that measure respsonsiveness on the record ranges.
+
+ total_big_jank_thread_time is the total thread duration of all top
+ slices whose thread time ranges overlapped with any thread time ranges of
+ the records and the overlapped thread duration is greater than or equal
+ USER_PERCEIVABLE_DELAY_THRESHOLD_MS.
+
+ biggest_jank_thread_time is the biggest thread duration of all
+ top slices whose thread time ranges overlapped with any of records' thread
+ time ranges.
+
+ All *_time values are measured in milliseconds.
+ """
+
+ def __init__(self):
+ super(ResponsivenessMetric, self).__init__()
+
+ def AddResults(self, _, renderer_thread, interaction_records, results):
+ self.VerifyNonOverlappedRecords(interaction_records)
+ try:
+ jank_stats = mainthread_jank_stats.MainthreadJankStats(
+ renderer_thread, interaction_records)
+ # TODO(nednguyen): maybe fall back to use wall-time for computing the
+ # metrics.
+ except tir_module.NoThreadTimeDataException as e:
+ #TODO(nednguyen): Report the warning with page_results system.
+ logging.warning(
+ 'Main thread jank metrics cannot be computed for records %s since '
+ 'trace does not contain thread time data. %s',
+ repr(interaction_records), repr(e))
+ return
+
+ results.Add('responsive-total_big_jank_thread_time', 'ms',
+ jank_stats.total_big_jank_thread_time)
+ results.Add('responsive-biggest_jank_thread_time', 'ms',
+ jank_stats.biggest_jank_thread_time)

Powered by Google App Engine
This is Rietveld 408576698