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 const bool _isProduct = const bool.fromEnvironment("dart.vm.product"); | 7 const bool _isProduct = const bool.fromEnvironment("dart.vm.product"); |
8 | 8 |
9 typedef dynamic TimelineSyncFunction(); | 9 typedef dynamic TimelineSyncFunction(); |
10 typedef Future TimelineAsyncFunction(); | 10 typedef Future TimelineAsyncFunction(); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 final String name; | 218 final String name; |
219 | 219 |
220 /// An (optional) set of arguments which will be serialized to JSON and | 220 /// An (optional) set of arguments which will be serialized to JSON and |
221 /// associated with this block. | 221 /// associated with this block. |
222 Map _arguments; | 222 Map _arguments; |
223 // The start time stamp. | 223 // The start time stamp. |
224 final int _start; | 224 final int _start; |
225 // The start time stamp of the thread cpu clock. | 225 // The start time stamp of the thread cpu clock. |
226 final int _startCpu; | 226 final int _startCpu; |
227 | 227 |
228 _SyncBlock._(this.name, this._start, this._startCpu); | 228 _SyncBlock._(this.name, this._start, this._startCpu) { |
| 229 _reportBeginEvent(name); |
| 230 } |
229 | 231 |
230 /// Finish this block of time. At this point, this block can no longer be | 232 /// Finish this block of time. At this point, this block can no longer be |
231 /// used. | 233 /// used. |
232 void finish() { | 234 void finish() { |
233 // Report event to runtime. | 235 // Report event to runtime. |
234 _reportCompleteEvent( | 236 _reportCompleteEvent( |
235 _start, _startCpu, category, name, _argumentsAsJson(_arguments)); | 237 _start, _startCpu, category, name, _argumentsAsJson(_arguments)); |
236 } | 238 } |
237 | 239 |
238 void _appendArguments(Map arguments) { | 240 void _appendArguments(Map arguments) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 /// Returns the current value from the thread CPU usage clock. | 274 /// Returns the current value from the thread CPU usage clock. |
273 external int _getThreadCpuClock(); | 275 external int _getThreadCpuClock(); |
274 | 276 |
275 /// Returns the isolate's main port number. | 277 /// Returns the isolate's main port number. |
276 external int _getIsolateNum(); | 278 external int _getIsolateNum(); |
277 | 279 |
278 /// Reports an event for a task. | 280 /// Reports an event for a task. |
279 external void _reportTaskEvent(int start, int taskId, String phase, | 281 external void _reportTaskEvent(int start, int taskId, String phase, |
280 String category, String name, String argumentsAsJson); | 282 String category, String name, String argumentsAsJson); |
281 | 283 |
| 284 /// Reports a begin event for a synchronous event. |
| 285 external void _reportBeginEvent(String name); |
| 286 |
282 /// Reports a complete synchronous event. | 287 /// Reports a complete synchronous event. |
283 external void _reportCompleteEvent(int start, int startCpu, String category, | 288 external void _reportCompleteEvent(int start, int startCpu, String category, |
284 String name, String argumentsAsJson); | 289 String name, String argumentsAsJson); |
285 | 290 |
286 /// Reports an instant event. | 291 /// Reports an instant event. |
287 external void _reportInstantEvent( | 292 external void _reportInstantEvent( |
288 int start, String category, String name, String argumentsAsJson); | 293 int start, String category, String name, String argumentsAsJson); |
OLD | NEW |