1 2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 3<html><head><title>Python: module telemetry.web_perf.timeline_based_measurement</title> 4<meta charset="utf-8"> 5</head><body bgcolor="#f0f0f8"> 6 7<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> 8<tr bgcolor="#7799ee"> 9<td valign=bottom> <br> 10<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry.web_perf.html"><font color="#ffffff">web_perf</font></a>.timeline_based_measurement</strong></big></big></font></td 11><td align=right valign=bottom 12><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/web_perf/timeline_based_measurement.py">telemetry/web_perf/timeline_based_measurement.py</a></font></td></tr></table> 13 <p><tt># Copyright 2014 The Chromium Authors. All rights reserved.<br> 14# Use of this source code is governed by a BSD-style license that can be<br> 15# found in the LICENSE file.</tt></p> 16<p> 17<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 18<tr bgcolor="#aa55cc"> 19<td colspan=3 valign=bottom> <br> 20<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> 21 22<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> 23<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="telemetry.web_perf.metrics.blob_timeline.html">telemetry.web_perf.metrics.blob_timeline</a><br> 24<a href="collections.html">collections</a><br> 25<a href="telemetry.web_perf.metrics.gpu_timeline.html">telemetry.web_perf.metrics.gpu_timeline</a><br> 26<a href="telemetry.web_perf.metrics.indexeddb_timeline.html">telemetry.web_perf.metrics.indexeddb_timeline</a><br> 27<a href="telemetry.web_perf.metrics.layout.html">telemetry.web_perf.metrics.layout</a><br> 28</td><td width="25%" valign=top><a href="logging.html">logging</a><br> 29<a href="telemetry.web_perf.metrics.memory_timeline.html">telemetry.web_perf.metrics.memory_timeline</a><br> 30<a href="telemetry.timeline.model.html">telemetry.timeline.model</a><br> 31<a href="telemetry.web_perf.metrics.responsiveness_metric.html">telemetry.web_perf.metrics.responsiveness_metric</a><br> 32<a href="telemetry.web_perf.smooth_gesture_util.html">telemetry.web_perf.smooth_gesture_util</a><br> 33</td><td width="25%" valign=top><a href="telemetry.web_perf.metrics.smoothness.html">telemetry.web_perf.metrics.smoothness</a><br> 34<a href="telemetry.web_perf.story_test.html">telemetry.web_perf.story_test</a><br> 35<a href="telemetry.web_perf.metrics.text_selection.html">telemetry.web_perf.metrics.text_selection</a><br> 36<a href="telemetry.web_perf.metrics.timeline_based_metric.html">telemetry.web_perf.metrics.timeline_based_metric</a><br> 37<a href="telemetry.web_perf.timeline_interaction_record.html">telemetry.web_perf.timeline_interaction_record</a><br> 38</td><td width="25%" valign=top><a href="telemetry.value.trace.html">telemetry.value.trace</a><br> 39<a href="telemetry.timeline.tracing_category_filter.html">telemetry.timeline.tracing_category_filter</a><br> 40<a href="telemetry.timeline.tracing_options.html">telemetry.timeline.tracing_options</a><br> 41<a href="telemetry.web_perf.metrics.webrtc_rendering_timeline.html">telemetry.web_perf.metrics.webrtc_rendering_timeline</a><br> 42</td></tr></table></td></tr></table><p> 43<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 44<tr bgcolor="#ee77aa"> 45<td colspan=3 valign=bottom> <br> 46<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> 47 48<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> 49<td width="100%"><dl> 50<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> 51</font></dt><dd> 52<dl> 53<dt><font face="helvetica, arial"><a href="telemetry.web_perf.timeline_based_measurement.html#Options">Options</a> 54</font></dt><dt><font face="helvetica, arial"><a href="telemetry.web_perf.timeline_based_measurement.html#ResultsWrapperInterface">ResultsWrapperInterface</a> 55</font></dt></dl> 56</dd> 57<dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) 58</font></dt><dd> 59<dl> 60<dt><font face="helvetica, arial"><a href="telemetry.web_perf.timeline_based_measurement.html#InvalidInteractions">InvalidInteractions</a> 61</font></dt></dl> 62</dd> 63<dt><font face="helvetica, arial"><a href="telemetry.web_perf.story_test.html#StoryTest">telemetry.web_perf.story_test.StoryTest</a>(<a href="__builtin__.html#object">__builtin__.object</a>) 64</font></dt><dd> 65<dl> 66<dt><font face="helvetica, arial"><a href="telemetry.web_perf.timeline_based_measurement.html#TimelineBasedMeasurement">TimelineBasedMeasurement</a> 67</font></dt></dl> 68</dd> 69</dl> 70 <p> 71<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 72<tr bgcolor="#ffc8d8"> 73<td colspan=3 valign=bottom> <br> 74<font color="#000000" face="helvetica, arial"><a name="InvalidInteractions">class <strong>InvalidInteractions</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr> 75 76<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> 77<td width="100%"><dl><dt>Method resolution order:</dt> 78<dd><a href="telemetry.web_perf.timeline_based_measurement.html#InvalidInteractions">InvalidInteractions</a></dd> 79<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> 80<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> 81<dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 82</dl> 83<hr> 84Data descriptors defined here:<br> 85<dl><dt><strong>__weakref__</strong></dt> 86<dd><tt>list of weak references to the object (if defined)</tt></dd> 87</dl> 88<hr> 89Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 90<dl><dt><a name="InvalidInteractions-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidInteractions-__init__">__init__</a>(...) initializes x; see help(type(x)) for signature</tt></dd></dl> 91 92<hr> 93Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 94<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#InvalidInteractions-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> 95 96<hr> 97Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 98<dl><dt><a name="InvalidInteractions-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidInteractions-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> 99 100<dl><dt><a name="InvalidInteractions-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidInteractions-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> 101 102<dl><dt><a name="InvalidInteractions-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidInteractions-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> 103 104<dl><dt><a name="InvalidInteractions-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidInteractions-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> 105 <br> 106Use of negative indices is not supported.</tt></dd></dl> 107 108<dl><dt><a name="InvalidInteractions-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 109 110<dl><dt><a name="InvalidInteractions-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidInteractions-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> 111 112<dl><dt><a name="InvalidInteractions-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidInteractions-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> 113 114<dl><dt><a name="InvalidInteractions-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 115 116<dl><dt><a name="InvalidInteractions-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#InvalidInteractions-__str__">__str__</a>() <==> str(x)</tt></dd></dl> 117 118<dl><dt><a name="InvalidInteractions-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 119 120<hr> 121Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 122<dl><dt><strong>__dict__</strong></dt> 123</dl> 124<dl><dt><strong>args</strong></dt> 125</dl> 126<dl><dt><strong>message</strong></dt> 127</dl> 128</td></tr></table> <p> 129<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 130<tr bgcolor="#ffc8d8"> 131<td colspan=3 valign=bottom> <br> 132<font color="#000000" face="helvetica, arial"><a name="Options">class <strong>Options</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> 133 134<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 135<td colspan=2><tt>A class to be used to configure <a href="#TimelineBasedMeasurement">TimelineBasedMeasurement</a>.<br> 136 <br> 137This is created and returned by<br> 138Benchmark.CreateTimelineBasedMeasurementOptions.<br> 139 <br> 140By default, all the timeline based metrics in telemetry/web_perf/metrics are<br> 141used (see _GetAllTimelineBasedMetrics above).<br> 142To customize your metric needs, use <a href="#Options-SetTimelineBasedMetrics">SetTimelineBasedMetrics</a>().<br> </tt></td></tr> 143<tr><td> </td> 144<td width="100%">Methods defined here:<br> 145<dl><dt><a name="Options-ExtendTraceCategoryFilter"><strong>ExtendTraceCategoryFilter</strong></a>(self, filters)</dt></dl> 146 147<dl><dt><a name="Options-GetTimelineBasedMetrics"><strong>GetTimelineBasedMetrics</strong></a>(self)</dt></dl> 148 149<dl><dt><a name="Options-SetTimelineBasedMetrics"><strong>SetTimelineBasedMetrics</strong></a>(self, metrics)</dt></dl> 150 151<dl><dt><a name="Options-__init__"><strong>__init__</strong></a>(self, overhead_level<font color="#909090">='no-overhead'</font>)</dt><dd><tt>As the amount of instrumentation increases, so does the overhead.<br> 152The user of the measurement chooses the overhead level that is appropriate,<br> 153and the tracing is filtered accordingly.<br> 154 <br> 155overhead_level: Can either be a custom TracingCategoryFilter <a href="__builtin__.html#object">object</a> or<br> 156 one of NO_OVERHEAD_LEVEL, MINIMAL_OVERHEAD_LEVEL or<br> 157 DEBUG_OVERHEAD_LEVEL.</tt></dd></dl> 158 159<hr> 160Data descriptors defined here:<br> 161<dl><dt><strong>__dict__</strong></dt> 162<dd><tt>dictionary for instance variables (if defined)</tt></dd> 163</dl> 164<dl><dt><strong>__weakref__</strong></dt> 165<dd><tt>list of weak references to the object (if defined)</tt></dd> 166</dl> 167<dl><dt><strong>category_filter</strong></dt> 168</dl> 169<dl><dt><strong>tracing_options</strong></dt> 170</dl> 171</td></tr></table> <p> 172<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 173<tr bgcolor="#ffc8d8"> 174<td colspan=3 valign=bottom> <br> 175<font color="#000000" face="helvetica, arial"><a name="ResultsWrapperInterface">class <strong>ResultsWrapperInterface</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> 176 177<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 178<td colspan=2><tt># TODO(nednguyen): Get rid of this results wrapper hack after we add interaction<br> 179# record to telemetry value system (crbug.com/453109)<br> </tt></td></tr> 180<tr><td> </td> 181<td width="100%">Methods defined here:<br> 182<dl><dt><a name="ResultsWrapperInterface-AddValue"><strong>AddValue</strong></a>(self, value)</dt></dl> 183 184<dl><dt><a name="ResultsWrapperInterface-SetResults"><strong>SetResults</strong></a>(self, results)</dt></dl> 185 186<dl><dt><a name="ResultsWrapperInterface-SetTirLabel"><strong>SetTirLabel</strong></a>(self, tir_label)</dt></dl> 187 188<dl><dt><a name="ResultsWrapperInterface-__init__"><strong>__init__</strong></a>(self)</dt></dl> 189 190<hr> 191Data descriptors defined here:<br> 192<dl><dt><strong>__dict__</strong></dt> 193<dd><tt>dictionary for instance variables (if defined)</tt></dd> 194</dl> 195<dl><dt><strong>__weakref__</strong></dt> 196<dd><tt>list of weak references to the object (if defined)</tt></dd> 197</dl> 198<dl><dt><strong>current_page</strong></dt> 199</dl> 200</td></tr></table> <p> 201<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 202<tr bgcolor="#ffc8d8"> 203<td colspan=3 valign=bottom> <br> 204<font color="#000000" face="helvetica, arial"><a name="TimelineBasedMeasurement">class <strong>TimelineBasedMeasurement</strong></a>(<a href="telemetry.web_perf.story_test.html#StoryTest">telemetry.web_perf.story_test.StoryTest</a>)</font></td></tr> 205 206<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 207<td colspan=2><tt>Collects multiple metrics based on their interaction records.<br> 208 <br> 209A timeline based measurement shifts the burden of what metrics to collect onto<br> 210the story under test. Instead of the measurement<br> 211having a fixed set of values it collects, the story being tested<br> 212issues (via javascript) an Interaction record into the user timing API that<br> 213describing what is happening at that time, as well as a standardized set<br> 214of flags describing the semantics of the work being done. The<br> 215<a href="#TimelineBasedMeasurement">TimelineBasedMeasurement</a> <a href="__builtin__.html#object">object</a> collects a trace that includes both these<br> 216interaction records, and a user-chosen amount of performance data using<br> 217Telemetry's various timeline-producing APIs, tracing especially.<br> 218 <br> 219It then passes the recorded timeline to different TimelineBasedMetrics based<br> 220on those flags. As an example, this allows a single story run to produce<br> 221load timing data, smoothness data, critical jank information and overall cpu<br> 222usage information.<br> 223 <br> 224For information on how to mark up a page to work with<br> 225<a href="#TimelineBasedMeasurement">TimelineBasedMeasurement</a>, refer to the<br> 226perf.metrics.timeline_interaction_record module.<br> 227 <br> 228Args:<br> 229 options: an instance of timeline_based_measurement.<a href="#Options">Options</a>.<br> 230 results_wrapper: A class that has the __init__ method takes in<br> 231 the page_test_results <a href="__builtin__.html#object">object</a> and the interaction record label. This<br> 232 class follows the <a href="#ResultsWrapperInterface">ResultsWrapperInterface</a>. Note: this class is not<br> 233 supported long term and to be removed when crbug.com/453109 is resolved.<br> </tt></td></tr> 234<tr><td> </td> 235<td width="100%"><dl><dt>Method resolution order:</dt> 236<dd><a href="telemetry.web_perf.timeline_based_measurement.html#TimelineBasedMeasurement">TimelineBasedMeasurement</a></dd> 237<dd><a href="telemetry.web_perf.story_test.html#StoryTest">telemetry.web_perf.story_test.StoryTest</a></dd> 238<dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 239</dl> 240<hr> 241Methods defined here:<br> 242<dl><dt><a name="TimelineBasedMeasurement-DidRunStory"><strong>DidRunStory</strong></a>(self, platform)</dt><dd><tt>Clean up after running the story.</tt></dd></dl> 243 244<dl><dt><a name="TimelineBasedMeasurement-Measure"><strong>Measure</strong></a>(self, platform, results)</dt><dd><tt>Collect all possible metrics and added them to results.</tt></dd></dl> 245 246<dl><dt><a name="TimelineBasedMeasurement-WillRunStory"><strong>WillRunStory</strong></a>(self, platform)</dt><dd><tt>Configure and start tracing.</tt></dd></dl> 247 248<dl><dt><a name="TimelineBasedMeasurement-__init__"><strong>__init__</strong></a>(self, options, results_wrapper<font color="#909090">=None</font>)</dt></dl> 249 250<hr> 251Data descriptors inherited from <a href="telemetry.web_perf.story_test.html#StoryTest">telemetry.web_perf.story_test.StoryTest</a>:<br> 252<dl><dt><strong>__dict__</strong></dt> 253<dd><tt>dictionary for instance variables (if defined)</tt></dd> 254</dl> 255<dl><dt><strong>__weakref__</strong></dt> 256<dd><tt>list of weak references to the object (if defined)</tt></dd> 257</dl> 258</td></tr></table></td></tr></table><p> 259<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 260<tr bgcolor="#55aa55"> 261<td colspan=3 valign=bottom> <br> 262<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> 263 264<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> 265<td width="100%"><strong>ALL_OVERHEAD_LEVELS</strong> = ['no-overhead', 'minimal-overhead', 'debug-overhead']<br> 266<strong>DEBUG_OVERHEAD_LEVEL</strong> = 'debug-overhead'<br> 267<strong>MINIMAL_OVERHEAD_LEVEL</strong> = 'minimal-overhead'<br> 268<strong>NO_OVERHEAD_LEVEL</strong> = 'no-overhead'</td></tr></table> 269</body></html>