OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Print a summary of a profile trace. | 5 // Print a summary of a profile trace. |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 class TraceSymbol { | 10 class TraceSymbol { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 var symbol = _stack.last; | 61 var symbol = _stack.last; |
62 if (symbol.name != name) { | 62 if (symbol.name != name) { |
63 throw new StateError('$name not found at top of stack.'); | 63 throw new StateError('$name not found at top of stack.'); |
64 } | 64 } |
65 if ((_stack.length > 1) && (_marked == false)) { | 65 if ((_stack.length > 1) && (_marked == false)) { |
66 // We are transitioning from the sequence of begins to the sequence | 66 // We are transitioning from the sequence of begins to the sequence |
67 // of ends. Mark the symbols on the stack. | 67 // of ends. Mark the symbols on the stack. |
68 _marked = true; | 68 _marked = true; |
69 _totalSamples++; | 69 _totalSamples++; |
70 // Mark all symbols except the top with an inclusive tick. | 70 // Mark all symbols except the top with an inclusive tick. |
71 for (int i = 1; i < _stack.length - 1; i++) { | 71 for (int i = 1; i < _stack.length; i++) { |
72 _stack[i].inclusive++; | 72 _stack[i].inclusive++; |
73 } | 73 } |
74 _stack.last.exclusive++; | 74 _stack.last.exclusive++; |
75 } | 75 } |
76 _stack.removeLast(); | 76 _stack.removeLast(); |
77 } | 77 } |
78 | 78 |
79 void _processEvents(List events) { | 79 void _processEvents(List events) { |
80 for (var i = 0; i < events.length; i++) { | 80 for (var i = 0; i < events.length; i++) { |
81 Map event = events[i]; | 81 Map event = events[i]; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return; | 154 return; |
155 } | 155 } |
156 String input = arguments[0]; | 156 String input = arguments[0]; |
157 int numSymbols = 10; | 157 int numSymbols = 10; |
158 if (arguments.length >= 2) { | 158 if (arguments.length >= 2) { |
159 numSymbols = int.parse(arguments[1]); | 159 numSymbols = int.parse(arguments[1]); |
160 } | 160 } |
161 TraceSummary ts = new TraceSummary(numSymbols); | 161 TraceSummary ts = new TraceSummary(numSymbols); |
162 ts.summarize(input); | 162 ts.summarize(input); |
163 } | 163 } |
OLD | NEW |