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

Side by Side Diff: tools/perf/metrics/speedindex.py

Issue 671913004: Telemetry: Sanitize a key and add description to speedindex metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add more description Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 6
7 from metrics import Metric 7 from metrics import Metric
8 from telemetry.core import bitmap 8 from telemetry.core import bitmap
9 from telemetry.value import scalar 9 from telemetry.value import scalar
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 self._impl.Stop(tab) 46 self._impl.Stop(tab)
47 47
48 # Optional argument chart_name is not in base class Metric. 48 # Optional argument chart_name is not in base class Metric.
49 # pylint: disable=W0221 49 # pylint: disable=W0221
50 def AddResults(self, tab, results, chart_name=None): 50 def AddResults(self, tab, results, chart_name=None):
51 """Calculate the speed index and add it to the results.""" 51 """Calculate the speed index and add it to the results."""
52 index = self._impl.CalculateSpeedIndex(tab) 52 index = self._impl.CalculateSpeedIndex(tab)
53 # Release the tab so that it can be disconnected. 53 # Release the tab so that it can be disconnected.
54 self._impl = None 54 self._impl = None
55 results.AddValue(scalar.ScalarValue( 55 results.AddValue(scalar.ScalarValue(
56 results.current_page, '%s.speed_index' % chart_name, 'ms', index)) 56 results.current_page, '%s_speed_index' % chart_name, 'ms', index,
57 description='Speed Index. This focuses on time when visible parts of '
58 'page are displayed and shows the time when the '
59 'first look is "almost" composed. If the contents of the '
60 'testing page are composed by only static resources, load '
61 'time can measure more accurately and speed index will be '
62 'smaller than the load time. On the other hand, If the '
63 'contents are composed by many XHR requests with small '
64 'main resource and javascript, speed index will be able to '
65 'get the features of performance more accurately than load '
66 'time because the load time will measure the time when '
67 'static resources are loaded. If you want to get more '
68 'detail, please refer to http://goo.gl/Rw3d5d. Currently '
69 'there are two implementations: for Android and for '
70 'Desktop. The Android version uses video capture; the '
71 'Desktop one uses paint events and has extra overhead to '
72 'catch paint events.'))
57 73
58 def IsFinished(self, tab): 74 def IsFinished(self, tab):
59 """Decide whether the timeline recording should be stopped. 75 """Decide whether the timeline recording should be stopped.
60 76
61 When the timeline recording is stopped determines which paint events 77 When the timeline recording is stopped determines which paint events
62 are used in the speed index metric calculation. In general, the recording 78 are used in the speed index metric calculation. In general, the recording
63 should continue if there has just been some data received, because 79 should continue if there has just been some data received, because
64 this suggests that painting may continue. 80 this suggests that painting may continue.
65 81
66 A page may repeatedly request resources in an infinite loop; a timeout 82 A page may repeatedly request resources in an infinite loop; a timeout
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 frame = paint_event.args['frameId'] 314 frame = paint_event.args['frameId']
299 return (frame,) + GetBox(paint_event.args['data']['clip']) 315 return (frame,) + GetBox(paint_event.args['data']['clip'])
300 316
301 def _GroupEventByRectangle(self, paint_events): 317 def _GroupEventByRectangle(self, paint_events):
302 """Group all paint events according to the rectangle that they update.""" 318 """Group all paint events according to the rectangle that they update."""
303 result = collections.defaultdict(list) 319 result = collections.defaultdict(list)
304 for event in paint_events: 320 for event in paint_events:
305 assert event.name == 'Paint' 321 assert event.name == 'Paint'
306 result[self._GetRectangle(event)].append(event) 322 result[self._GetRectangle(event)].append(event)
307 return result 323 return result
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698