OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // NOTE: See also wrapper script sdk/runtime/tools/bmu_benchmark_gallery.sh | 5 // NOTE: See also wrapper script sdk/runtime/tools/bmu_benchmark_gallery.sh |
6 // | 6 // |
7 // Tool to compute bounded mutator utilization (BMU) from a --verbose_gc log. | 7 // Tool to compute bounded mutator utilization (BMU) from a --verbose_gc log. |
8 // Outputs CSV suitable for, e.g., gnuplot: | 8 // Outputs CSV suitable for, e.g., gnuplot: |
9 // | 9 // |
10 // dart --verbose_gc foo.dart 2> foo.gclog | 10 // dart --verbose_gc foo.dart 2> foo.gclog |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 final Interval<int> _run = new Interval<int>(0, 0); | 72 final Interval<int> _run = new Interval<int>(0, 0); |
73 final List<Interval<int>> _pauses = []; | 73 final List<Interval<int>> _pauses = []; |
74 } | 74 } |
75 | 75 |
76 // Returns a GC pause as an interval in microseconds since program start, or | 76 // Returns a GC pause as an interval in microseconds since program start, or |
77 // the interval [0, 0) on parse error. | 77 // the interval [0, 0) on parse error. |
78 Interval<int> parseVerboseGCLine(String line) { | 78 Interval<int> parseVerboseGCLine(String line) { |
79 var fields = line.split(','); | 79 var fields = line.split(','); |
80 // Update this (and indices below, if needed) when logging format changes. | 80 // Update this (and indices below, if needed) when logging format changes. |
81 if (fields.length != 25) { | 81 if (fields.length < 10) { |
82 assert(line.startsWith('[ GC | space | count | start | gc time') || | 82 // Ignore the lines that just specify column names, separated by '|'. |
83 line.startsWith('[ (isolate)| (reason)| | (s) | (ms) ')); | 83 // We assume these have very few commas in them, so that fields.length |
| 84 // is < 10. |
| 85 assert(line.contains("|")); |
84 return new Interval<int>(0, 0); | 86 return new Interval<int>(0, 0); |
85 } | 87 } |
86 var begin = (1e6 * double.parse(fields[2])).floor(); | 88 var begin = (1e6 * double.parse(fields[2])).floor(); |
87 var duration = (1000 * double.parse(fields[3])).floor(); | 89 var duration = (1000 * double.parse(fields[3])).floor(); |
88 var end = begin + duration; | 90 var end = begin + duration; |
89 return new Interval<int>(begin, end); | 91 return new Interval<int>(begin, end); |
90 } | 92 } |
91 | 93 |
92 void main() { | 94 void main() { |
93 Timeline t = new Timeline(); | 95 Timeline t = new Timeline(); |
94 for (String line = stdin.readLineSync(); | 96 for (String line = stdin.readLineSync(); |
95 line != null; | 97 line != null; |
96 line = stdin.readLineSync()) { | 98 line = stdin.readLineSync()) { |
97 t.addPause(parseVerboseGCLine(line)); | 99 t.addPause(parseVerboseGCLine(line)); |
98 } | 100 } |
99 print('# window_size_ms, bounded_mutator_utilization'); | 101 print('# window_size_ms, bounded_mutator_utilization'); |
100 var minimumSeen = 1.0; | 102 var minimumSeen = 1.0; |
101 for (int w = t._run.length; | 103 for (int w = t._run.length; |
102 w > 1000 * MINIMUM_WINDOW_SIZE_MS; | 104 w > 1000 * MINIMUM_WINDOW_SIZE_MS; |
103 w = (w * WINDOW_STEP_FACTOR).floor()) { | 105 w = (w * WINDOW_STEP_FACTOR).floor()) { |
104 minimumSeen = min(minimumSeen, t.minUtilization(w)); | 106 minimumSeen = min(minimumSeen, t.minUtilization(w)); |
105 print('${w / 1000}, $minimumSeen'); | 107 print('${w / 1000}, $minimumSeen'); |
106 } | 108 } |
107 } | 109 } |
OLD | NEW |