OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.developer; | 5 part of dart.developer; |
6 | 6 |
7 typedef dynamic TimelineSyncFunction(); | 7 typedef dynamic TimelineSyncFunction(); |
8 | 8 |
9 /// Add to the timeline. | 9 /// Add to the timeline. |
10 class Timeline { | 10 class Timeline { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 final int _taskId; | 128 final int _taskId; |
129 /// An (optional) set of arguments which will be serialized to JSON and | 129 /// An (optional) set of arguments which will be serialized to JSON and |
130 /// associated with this block. | 130 /// associated with this block. |
131 final Map arguments = {}; | 131 final Map arguments = {}; |
132 bool _finished = false; | 132 bool _finished = false; |
133 | 133 |
134 AsyncBlock._(this.name, this._taskId, this.category); | 134 AsyncBlock._(this.name, this._taskId, this.category); |
135 | 135 |
136 // Emit the start event. | 136 // Emit the start event. |
137 void _start() { | 137 void _start() { |
138 arguments['isolateNumber'] = Timeline._isolateId; | 138 arguments['isolateNumber'] = '${Timeline._isolateId}'; |
139 String argumentsAsJson = JSON.encode(arguments); | 139 String argumentsAsJson = JSON.encode(arguments); |
140 _reportTaskEvent(_getTraceClock(), | 140 _reportTaskEvent(_getTraceClock(), |
141 _taskId, | 141 _taskId, |
142 'b', | 142 'b', |
143 category, | 143 category, |
144 name, | 144 name, |
145 argumentsAsJson); | 145 argumentsAsJson); |
146 } | 146 } |
147 | 147 |
148 // Emit the finish event. | 148 // Emit the finish event. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 final int _start; | 193 final int _start; |
194 | 194 |
195 _SyncBlock._(this.name, | 195 _SyncBlock._(this.name, |
196 this._start); | 196 this._start); |
197 | 197 |
198 /// Finish this block of time. At this point, this block can no longer be | 198 /// Finish this block of time. At this point, this block can no longer be |
199 /// used. | 199 /// used. |
200 void finish() { | 200 void finish() { |
201 var end = _getTraceClock(); | 201 var end = _getTraceClock(); |
202 | 202 |
203 arguments['isolateNumber'] = Timeline._isolateId; | 203 arguments['isolateNumber'] = '${Timeline._isolateId}'; |
204 | 204 |
205 // Encode arguments map as JSON before reporting. | 205 // Encode arguments map as JSON before reporting. |
206 var argumentsAsJson = JSON.encode(arguments); | 206 var argumentsAsJson = JSON.encode(arguments); |
207 | 207 |
208 // Report event to runtime. | 208 // Report event to runtime. |
209 _reportCompleteEvent(_start, | 209 _reportCompleteEvent(_start, |
210 end, | 210 end, |
211 category, | 211 category, |
212 name, | 212 name, |
213 argumentsAsJson); | 213 argumentsAsJson); |
(...skipping 16 matching lines...) Expand all Loading... |
230 String category, | 230 String category, |
231 String name, | 231 String name, |
232 String argumentsAsJson); | 232 String argumentsAsJson); |
233 | 233 |
234 /// Reports a complete synchronous event. | 234 /// Reports a complete synchronous event. |
235 external void _reportCompleteEvent(int start, | 235 external void _reportCompleteEvent(int start, |
236 int end, | 236 int end, |
237 String category, | 237 String category, |
238 String name, | 238 String name, |
239 String argumentsAsJson); | 239 String argumentsAsJson); |
OLD | NEW |