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 23 matching lines...) Expand all Loading... |
34 var block = _stack.removeLast(); | 34 var block = _stack.removeLast(); |
35 // Close it. | 35 // Close it. |
36 block.close(); | 36 block.close(); |
37 } | 37 } |
38 | 38 |
39 /// A utility method to time a synchronous [function]. Internally calls | 39 /// A utility method to time a synchronous [function]. Internally calls |
40 /// [function] bracketed by calls to [startSync] and [finishSync]. | 40 /// [function] bracketed by calls to [startSync] and [finishSync]. |
41 static dynamic timeSync(String name, | 41 static dynamic timeSync(String name, |
42 TimelineSyncFunction function, | 42 TimelineSyncFunction function, |
43 {Map arguments}) { | 43 {Map arguments}) { |
44 beginSync(name, arguments: arguments); | 44 startSync(name, arguments: arguments); |
45 try { | 45 try { |
46 return function(); | 46 return function(); |
47 } finally { | 47 } finally { |
48 finishSync(); | 48 finishSync(); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 static final List<_SyncBlock> _stack = new List<_SyncBlock>(); | 52 static final List<_SyncBlock> _stack = new List<_SyncBlock>(); |
53 } | 53 } |
54 | 54 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 /// Returns the current value from the trace clock. | 95 /// Returns the current value from the trace clock. |
96 external int _getTraceClock(); | 96 external int _getTraceClock(); |
97 | 97 |
98 /// Reports a complete synchronous event. | 98 /// Reports a complete synchronous event. |
99 external void _reportCompleteEvent(int start, | 99 external void _reportCompleteEvent(int start, |
100 int end, | 100 int end, |
101 String category, | 101 String category, |
102 String name, | 102 String name, |
103 String argumentsAsJson); | 103 String argumentsAsJson); |
OLD | NEW |