1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 3 <html><head><title>Python: module telemetry.timeline.trace_data</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.timeline.html"><font color="#ffffff">timeline</font></a>.trace_data</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/timeline/trace_data.py">telemetry/timeline/trace_data.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="json.html">json</a><br> 24 </td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p> 25 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 26 <tr bgcolor="#ee77aa"> 27 <td colspan=3 valign=bottom> <br> 28 <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> 29 30 <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> 31 <td width="100%"><dl> 32 <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> 33 </font></dt><dd> 34 <dl> 35 <dt><font face="helvetica, arial"><a href="telemetry.timeline.trace_data.html#TraceData">TraceData</a> 36 </font></dt><dt><font face="helvetica, arial"><a href="telemetry.timeline.trace_data.html#TraceDataBuilder">TraceDataBuilder</a> 37 </font></dt><dt><font face="helvetica, arial"><a href="telemetry.timeline.trace_data.html#TraceDataPart">TraceDataPart</a> 38 </font></dt></dl> 39 </dd> 40 <dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) 41 </font></dt><dd> 42 <dl> 43 <dt><font face="helvetica, arial"><a href="telemetry.timeline.trace_data.html#NonSerializableTraceData">NonSerializableTraceData</a> 44 </font></dt></dl> 45 </dd> 46 </dl> 47 <p> 48 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 49 <tr bgcolor="#ffc8d8"> 50 <td colspan=3 valign=bottom> <br> 51 <font color="#000000" face="helvetica, arial"><a name="NonSerializableTraceData">class <strong>NonSerializableTraceData</strong></a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)</font></td></tr> 52 53 <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 54 <td colspan=2><tt>Raised when raw trace data cannot be serialized to <a href="#TraceData">TraceData</a>.<br> </tt></td></tr> 55 <tr><td> </td> 56 <td width="100%"><dl><dt>Method resolution order:</dt> 57 <dd><a href="telemetry.timeline.trace_data.html#NonSerializableTraceData">NonSerializableTraceData</a></dd> 58 <dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> 59 <dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> 60 <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 61 </dl> 62 <hr> 63 Data descriptors defined here:<br> 64 <dl><dt><strong>__weakref__</strong></dt> 65 <dd><tt>list of weak references to the object (if defined)</tt></dd> 66 </dl> 67 <hr> 68 Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 69 <dl><dt><a name="NonSerializableTraceData-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#NonSerializableTraceData-__init__">__init__</a>(...) initializes x; see help(type(x)) for signature</tt></dd></dl> 70 71 <hr> 72 Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 73 <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#NonSerializableTraceData-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> 74 75 <hr> 76 Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 77 <dl><dt><a name="NonSerializableTraceData-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#NonSerializableTraceData-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> 78 79 <dl><dt><a name="NonSerializableTraceData-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#NonSerializableTraceData-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> 80 81 <dl><dt><a name="NonSerializableTraceData-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#NonSerializableTraceData-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> 82 83 <dl><dt><a name="NonSerializableTraceData-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#NonSerializableTraceData-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> 84 <br> 85 Use of negative indices is not supported.</tt></dd></dl> 86 87 <dl><dt><a name="NonSerializableTraceData-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 88 89 <dl><dt><a name="NonSerializableTraceData-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#NonSerializableTraceData-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> 90 91 <dl><dt><a name="NonSerializableTraceData-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#NonSerializableTraceData-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> 92 93 <dl><dt><a name="NonSerializableTraceData-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 94 95 <dl><dt><a name="NonSerializableTraceData-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#NonSerializableTraceData-__str__">__str__</a>() <==> str(x)</tt></dd></dl> 96 97 <dl><dt><a name="NonSerializableTraceData-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 98 99 <hr> 100 Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 101 <dl><dt><strong>__dict__</strong></dt> 102 </dl> 103 <dl><dt><strong>args</strong></dt> 104 </dl> 105 <dl><dt><strong>message</strong></dt> 106 </dl> 107 </td></tr></table> <p> 108 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 109 <tr bgcolor="#ffc8d8"> 110 <td colspan=3 valign=bottom> <br> 111 <font color="#000000" face="helvetica, arial"><a name="TraceData">class <strong>TraceData</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> 112 113 <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 114 <td colspan=2><tt>Validates, parses, and serializes raw data.<br> 115 <br> 116 NOTE: raw data must only include primitive objects!<br> 117 By design, <a href="#TraceData">TraceData</a> must contain only data that is BOTH json-serializable<br> 118 to a file, AND restorable once again from that file into <a href="#TraceData">TraceData</a> without<br> 119 assistance from other classes.<br> 120 <br> 121 Raw data can be one of three standard trace_event formats:<br> 122 1. Trace container format: a json-parseable dict.<br> 123 2. A json-parseable array: assumed to be chrome trace data.<br> 124 3. A json-parseable array missing the final ']': assumed to be chrome trace<br> 125 data.<br> </tt></td></tr> 126 <tr><td> </td> 127 <td width="100%">Methods defined here:<br> 128 <dl><dt><a name="TraceData-GetEventsFor"><strong>GetEventsFor</strong></a>(self, part)</dt></dl> 129 130 <dl><dt><a name="TraceData-HasEventsFor"><strong>HasEventsFor</strong></a>(self, part)</dt></dl> 131 132 <dl><dt><a name="TraceData-Serialize"><strong>Serialize</strong></a>(self, f, gzip_result<font color="#909090">=False</font>)</dt><dd><tt>Serializes the trace result to a file-like <a href="__builtin__.html#object">object</a>.<br> 133 <br> 134 Always writes in the trace container format.</tt></dd></dl> 135 136 <dl><dt><a name="TraceData-__init__"><strong>__init__</strong></a>(self, raw_data<font color="#909090">=None</font>)</dt><dd><tt>Creates <a href="#TraceData">TraceData</a> from the given data.</tt></dd></dl> 137 138 <hr> 139 Data descriptors defined here:<br> 140 <dl><dt><strong>__dict__</strong></dt> 141 <dd><tt>dictionary for instance variables (if defined)</tt></dd> 142 </dl> 143 <dl><dt><strong>__weakref__</strong></dt> 144 <dd><tt>list of weak references to the object (if defined)</tt></dd> 145 </dl> 146 <dl><dt><strong>active_parts</strong></dt> 147 </dl> 148 <dl><dt><strong>events_are_safely_mutable</strong></dt> 149 <dd><tt>Returns true if the events in this value are completely sealed.<br> 150 <br> 151 Some importers want to take complex fields out of the TraceData and add<br> 152 them to the model, changing them subtly as they do so. If the TraceData<br> 153 was constructed with data that is shared with something outside the trace<br> 154 data, for instance a test harness, then this mutation is unexpected. But,<br> 155 if the values are sealed, then mutating the events is a lot faster.<br> 156 <br> 157 We know if events are sealed if the value came from a string, or if the<br> 158 value came from a TraceDataBuilder.</tt></dd> 159 </dl> 160 <dl><dt><strong>metadata_records</strong></dt> 161 </dl> 162 </td></tr></table> <p> 163 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 164 <tr bgcolor="#ffc8d8"> 165 <td colspan=3 valign=bottom> <br> 166 <font color="#000000" face="helvetica, arial"><a name="TraceDataBuilder">class <strong>TraceDataBuilder</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> 167 168 <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 169 <td colspan=2><tt><a href="#TraceDataBuilder">TraceDataBuilder</a> helps build up a trace from multiple trace agents.<br> 170 <br> 171 <a href="#TraceData">TraceData</a> is supposed to be immutable, but it is useful during recording to<br> 172 have a mutable version. That is <a href="#TraceDataBuilder">TraceDataBuilder</a>.<br> </tt></td></tr> 173 <tr><td> </td> 174 <td width="100%">Methods defined here:<br> 175 <dl><dt><a name="TraceDataBuilder-AddEventsTo"><strong>AddEventsTo</strong></a>(self, part, events)</dt><dd><tt>Note: this won't work when called from multiple browsers.<br> 176 <br> 177 Each browser's trace_event_impl zeros its timestamps when it writes them<br> 178 out and doesn't write a timebase that can be used to re-sync them.</tt></dd></dl> 179 180 <dl><dt><a name="TraceDataBuilder-AsData"><strong>AsData</strong></a>(self)</dt></dl> 181 182 <dl><dt><a name="TraceDataBuilder-HasEventsFor"><strong>HasEventsFor</strong></a>(self, part)</dt></dl> 183 184 <dl><dt><a name="TraceDataBuilder-__init__"><strong>__init__</strong></a>(self)</dt></dl> 185 186 <hr> 187 Data descriptors defined here:<br> 188 <dl><dt><strong>__dict__</strong></dt> 189 <dd><tt>dictionary for instance variables (if defined)</tt></dd> 190 </dl> 191 <dl><dt><strong>__weakref__</strong></dt> 192 <dd><tt>list of weak references to the object (if defined)</tt></dd> 193 </dl> 194 </td></tr></table> <p> 195 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 196 <tr bgcolor="#ffc8d8"> 197 <td colspan=3 valign=bottom> <br> 198 <font color="#000000" face="helvetica, arial"><a name="TraceDataPart">class <strong>TraceDataPart</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> 199 200 <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 201 <td colspan=2><tt><a href="#TraceData">TraceData</a> can have a variety of events.<br> 202 <br> 203 These are called "parts" and are accessed by the following fixed field names.<br> </tt></td></tr> 204 <tr><td> </td> 205 <td width="100%">Methods defined here:<br> 206 <dl><dt><a name="TraceDataPart-__init__"><strong>__init__</strong></a>(self, raw_field_name)</dt></dl> 207 208 <dl><dt><a name="TraceDataPart-__repr__"><strong>__repr__</strong></a>(self)</dt></dl> 209 210 <hr> 211 Data descriptors defined here:<br> 212 <dl><dt><strong>__dict__</strong></dt> 213 <dd><tt>dictionary for instance variables (if defined)</tt></dd> 214 </dl> 215 <dl><dt><strong>__weakref__</strong></dt> 216 <dd><tt>list of weak references to the object (if defined)</tt></dd> 217 </dl> 218 <dl><dt><strong>raw_field_name</strong></dt> 219 </dl> 220 </td></tr></table></td></tr></table><p> 221 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 222 <tr bgcolor="#55aa55"> 223 <td colspan=3 valign=bottom> <br> 224 <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> 225 226 <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> 227 <td width="100%"><strong>ALL_TRACE_PARTS</strong> = set([TraceDataPart("traceEvents"), TraceDataPart("inspectorTimelineEvents"), TraceDataPart("surfaceFlinger"), TraceDataPart("tabIds")])<br> 228 <strong>CHROME_TRACE_PART</strong> = TraceDataPart("traceEvents")<br> 229 <strong>INSPECTOR_TRACE_PART</strong> = TraceDataPart("inspectorTimelineEvents")<br> 230 <strong>SURFACE_FLINGER_PART</strong> = TraceDataPart("surfaceFlinger")<br> 231 <strong>TAB_ID_PART</strong> = TraceDataPart("tabIds")</td></tr></table> 232 </body></html>