Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / web_perf / metrics / rendering_stats.py
index ad29d57..492b4f6 100644 (file)
@@ -1,10 +1,8 @@
 # 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 operator import attrgetter
 
-from telemetry.page import page_test
 from telemetry.web_perf.metrics import rendering_frame
 
 # These are LatencyInfo component names indicating the various components
@@ -30,19 +28,6 @@ SCROLL_UPDATE_EVENT_NAME = 'InputLatency:ScrollUpdate'
 GESTURE_SCROLL_UPDATE_EVENT_NAME  = 'InputLatency:GestureScrollUpdate'
 
 
-class NotEnoughFramesError(page_test.MeasurementFailure):
-  def __init__(self, frame_count):
-    super(NotEnoughFramesError, self).__init__(
-      'Only %i frame timestamps were collected ' % frame_count +
-      '(at least two are required).\n'
-      'Issues that have caused this in the past:\n' +
-      '- Browser bugs that prevents the page from redrawing\n' +
-      '- Bugs in the synthetic gesture code\n' +
-      '- Page and benchmark out of sync (e.g. clicked element was renamed)\n' +
-      '- Pages that render extremely slow\n' +
-      '- Pages that can\'t be scrolled')
-
-
 def GetInputLatencyEvents(process, timeline_range):
   """Get input events' LatencyInfo from the process's trace buffer that are
      within the timeline_range.
@@ -139,7 +124,11 @@ class RenderingStats(object):
     if HasRenderingStats(browser_process):
       timestamp_process = browser_process
     else:
-      timestamp_process  = renderer_process
+      timestamp_process = renderer_process
+
+    # A lookup from list names below to any errors or exceptions encountered
+    # in attempting to generate that list.
+    self.errors = {}
 
     self.frame_timestamps = []
     self.frame_times = []
@@ -186,12 +175,6 @@ class RenderingStats(object):
       self._InitFrameQueueingDurationsFromTimeline(
           renderer_process, timeline_range)
 
-    # Check if we have collected at least 2 frames in every range. Otherwise we
-    # can't compute any meaningful metrics.
-    for segment in self.frame_timestamps:
-      if len(segment) < 2:
-        raise NotEnoughFramesError(len(segment))
-
   def _InitInputLatencyStatsFromTimeline(
       self, browser_process, renderer_process, timeline_range):
     latency_events = GetInputLatencyEvents(browser_process, timeline_range)
@@ -199,8 +182,12 @@ class RenderingStats(object):
     latency_events.extend(GetInputLatencyEvents(renderer_process,
                                                 timeline_range))
     input_event_latencies = ComputeInputEventLatencies(latency_events)
+    # Don't include scroll updates in the overall input latency measurement,
+    # because scroll updates can take much more time to process than other
+    # input events and would therefore add noise to overall latency numbers.
     self.input_event_latency[-1] = [
-        latency for name, latency in input_event_latencies]
+        latency for name, latency in input_event_latencies
+        if name != SCROLL_UPDATE_EVENT_NAME]
     self.scroll_update_latency[-1] = [
         latency for name, latency in input_event_latencies
         if name == SCROLL_UPDATE_EVENT_NAME]
@@ -267,5 +254,5 @@ class RenderingStats(object):
       new_frame_queueing_durations = [e.queueing_duration for e in events]
       self.frame_queueing_durations.append(new_frame_queueing_durations)
     except rendering_frame.NoBeginFrameIdException:
-      logging.warning('Current chrome version does not support the queueing '
-                      'delay metric.')
+      self.errors['frame_queueing_durations'] = (
+          'Current chrome version does not support the queueing delay metric.')