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>&nbsp;<br>
10<font color="#ffffff" face="helvetica, arial">&nbsp;<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>#&nbsp;Copyright&nbsp;2014&nbsp;The&nbsp;Chromium&nbsp;Authors.&nbsp;All&nbsp;rights&nbsp;reserved.<br>
14#&nbsp;Use&nbsp;of&nbsp;this&nbsp;source&nbsp;code&nbsp;is&nbsp;governed&nbsp;by&nbsp;a&nbsp;BSD-style&nbsp;license&nbsp;that&nbsp;can&nbsp;be<br>
15#&nbsp;found&nbsp;in&nbsp;the&nbsp;LICENSE&nbsp;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>&nbsp;<br>
20<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
21
22<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>&nbsp;<br>
28<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
29
30<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td>
54<td colspan=2><tt>Raised&nbsp;when&nbsp;raw&nbsp;trace&nbsp;data&nbsp;cannot&nbsp;be&nbsp;serialized&nbsp;to&nbsp;<a href="#TraceData">TraceData</a>.<br>&nbsp;</tt></td></tr>
55<tr><td>&nbsp;</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>
63Data descriptors defined here:<br>
64<dl><dt><strong>__weakref__</strong></dt>
65<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
66</dl>
67<hr>
68Methods 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>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;help(type(x))&nbsp;for&nbsp;signature</tt></dd></dl>
70
71<hr>
72Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
73<dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#NonSerializableTraceData-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
74
75<hr>
76Methods 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')&nbsp;&lt;==&gt;&nbsp;del&nbsp;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')&nbsp;&lt;==&gt;&nbsp;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)&nbsp;&lt;==&gt;&nbsp;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,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
84&nbsp;<br>
85Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;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>()&nbsp;&lt;==&gt;&nbsp;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',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;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>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl>
96
97<dl><dt><a name="NonSerializableTraceData-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl>
98
99<hr>
100Data 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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td>
114<td colspan=2><tt>Validates,&nbsp;parses,&nbsp;and&nbsp;serializes&nbsp;raw&nbsp;data.<br>
115&nbsp;<br>
116NOTE:&nbsp;raw&nbsp;data&nbsp;must&nbsp;only&nbsp;include&nbsp;primitive&nbsp;objects!<br>
117By&nbsp;design,&nbsp;<a href="#TraceData">TraceData</a>&nbsp;must&nbsp;contain&nbsp;only&nbsp;data&nbsp;that&nbsp;is&nbsp;BOTH&nbsp;json-serializable<br>
118to&nbsp;a&nbsp;file,&nbsp;AND&nbsp;restorable&nbsp;once&nbsp;again&nbsp;from&nbsp;that&nbsp;file&nbsp;into&nbsp;<a href="#TraceData">TraceData</a>&nbsp;without<br>
119assistance&nbsp;from&nbsp;other&nbsp;classes.<br>
120&nbsp;<br>
121Raw&nbsp;data&nbsp;can&nbsp;be&nbsp;one&nbsp;of&nbsp;three&nbsp;standard&nbsp;trace_event&nbsp;formats:<br>
1221.&nbsp;Trace&nbsp;container&nbsp;format:&nbsp;a&nbsp;json-parseable&nbsp;dict.<br>
1232.&nbsp;A&nbsp;json-parseable&nbsp;array:&nbsp;assumed&nbsp;to&nbsp;be&nbsp;chrome&nbsp;trace&nbsp;data.<br>
1243.&nbsp;A&nbsp;json-parseable&nbsp;array&nbsp;missing&nbsp;the&nbsp;final&nbsp;']':&nbsp;assumed&nbsp;to&nbsp;be&nbsp;chrome&nbsp;trace<br>
125&nbsp;&nbsp;&nbsp;data.<br>&nbsp;</tt></td></tr>
126<tr><td>&nbsp;</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&nbsp;the&nbsp;trace&nbsp;result&nbsp;to&nbsp;a&nbsp;file-like&nbsp;<a href="__builtin__.html#object">object</a>.<br>
133&nbsp;<br>
134Always&nbsp;writes&nbsp;in&nbsp;the&nbsp;trace&nbsp;container&nbsp;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&nbsp;<a href="#TraceData">TraceData</a>&nbsp;from&nbsp;the&nbsp;given&nbsp;data.</tt></dd></dl>
137
138<hr>
139Data descriptors defined here:<br>
140<dl><dt><strong>__dict__</strong></dt>
141<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
142</dl>
143<dl><dt><strong>__weakref__</strong></dt>
144<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;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&nbsp;true&nbsp;if&nbsp;the&nbsp;events&nbsp;in&nbsp;this&nbsp;value&nbsp;are&nbsp;completely&nbsp;sealed.<br>
150&nbsp;<br>
151Some&nbsp;importers&nbsp;want&nbsp;to&nbsp;take&nbsp;complex&nbsp;fields&nbsp;out&nbsp;of&nbsp;the&nbsp;TraceData&nbsp;and&nbsp;add<br>
152them&nbsp;to&nbsp;the&nbsp;model,&nbsp;changing&nbsp;them&nbsp;subtly&nbsp;as&nbsp;they&nbsp;do&nbsp;so.&nbsp;If&nbsp;the&nbsp;TraceData<br>
153was&nbsp;constructed&nbsp;with&nbsp;data&nbsp;that&nbsp;is&nbsp;shared&nbsp;with&nbsp;something&nbsp;outside&nbsp;the&nbsp;trace<br>
154data,&nbsp;for&nbsp;instance&nbsp;a&nbsp;test&nbsp;harness,&nbsp;then&nbsp;this&nbsp;mutation&nbsp;is&nbsp;unexpected.&nbsp;But,<br>
155if&nbsp;the&nbsp;values&nbsp;are&nbsp;sealed,&nbsp;then&nbsp;mutating&nbsp;the&nbsp;events&nbsp;is&nbsp;a&nbsp;lot&nbsp;faster.<br>
156&nbsp;<br>
157We&nbsp;know&nbsp;if&nbsp;events&nbsp;are&nbsp;sealed&nbsp;if&nbsp;the&nbsp;value&nbsp;came&nbsp;from&nbsp;a&nbsp;string,&nbsp;or&nbsp;if&nbsp;the<br>
158value&nbsp;came&nbsp;from&nbsp;a&nbsp;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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td>
169<td colspan=2><tt><a href="#TraceDataBuilder">TraceDataBuilder</a>&nbsp;helps&nbsp;build&nbsp;up&nbsp;a&nbsp;trace&nbsp;from&nbsp;multiple&nbsp;trace&nbsp;agents.<br>
170&nbsp;<br>
171<a href="#TraceData">TraceData</a>&nbsp;is&nbsp;supposed&nbsp;to&nbsp;be&nbsp;immutable,&nbsp;but&nbsp;it&nbsp;is&nbsp;useful&nbsp;during&nbsp;recording&nbsp;to<br>
172have&nbsp;a&nbsp;mutable&nbsp;version.&nbsp;That&nbsp;is&nbsp;<a href="#TraceDataBuilder">TraceDataBuilder</a>.<br>&nbsp;</tt></td></tr>
173<tr><td>&nbsp;</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:&nbsp;this&nbsp;won't&nbsp;work&nbsp;when&nbsp;called&nbsp;from&nbsp;multiple&nbsp;browsers.<br>
176&nbsp;<br>
177Each&nbsp;browser's&nbsp;trace_event_impl&nbsp;zeros&nbsp;its&nbsp;timestamps&nbsp;when&nbsp;it&nbsp;writes&nbsp;them<br>
178out&nbsp;and&nbsp;doesn't&nbsp;write&nbsp;a&nbsp;timebase&nbsp;that&nbsp;can&nbsp;be&nbsp;used&nbsp;to&nbsp;re-sync&nbsp;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>
187Data descriptors defined here:<br>
188<dl><dt><strong>__dict__</strong></dt>
189<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
190</dl>
191<dl><dt><strong>__weakref__</strong></dt>
192<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td>
201<td colspan=2><tt><a href="#TraceData">TraceData</a>&nbsp;can&nbsp;have&nbsp;a&nbsp;variety&nbsp;of&nbsp;events.<br>
202&nbsp;<br>
203These&nbsp;are&nbsp;called&nbsp;"parts"&nbsp;and&nbsp;are&nbsp;accessed&nbsp;by&nbsp;the&nbsp;following&nbsp;fixed&nbsp;field&nbsp;names.<br>&nbsp;</tt></td></tr>
204<tr><td>&nbsp;</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>
211Data descriptors defined here:<br>
212<dl><dt><strong>__dict__</strong></dt>
213<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
214</dl>
215<dl><dt><strong>__weakref__</strong></dt>
216<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;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>&nbsp;<br>
224<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
225
226<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>