OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 import 'package:kernel/kernel.dart'; | 5 import 'package:kernel/kernel.dart'; |
6 import 'package:kernel/class_hierarchy.dart'; | 6 import 'package:kernel/class_hierarchy.dart'; |
7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 import 'class_hierarchy_basic.dart'; | 8 import 'class_hierarchy_basic.dart'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
11 ArgParser argParser = new ArgParser() | 11 ArgParser argParser = new ArgParser() |
12 ..addFlag('basic', help: 'Measure the basic implementation', negatable: false) | 12 ..addFlag('basic', help: 'Measure the basic implementation', negatable: false) |
13 ..addOption('count', | 13 ..addOption('count', |
14 abbr: 'c', | 14 abbr: 'c', |
15 help: 'Build N copies of the class hierarchy', | 15 help: 'Build N copies of the class hierarchy', |
16 defaultsTo: '300'); | 16 defaultsTo: '300'); |
17 | 17 |
18 String usage = """ | 18 String usage = """ |
19 Usage: class_hierarchy_membench [options] FILE.dart | 19 Usage: class_hierarchy_membench [options] FILE.dill |
20 | 20 |
21 Options: | 21 Options: |
22 ${argParser.usage} | 22 ${argParser.usage} |
23 """; | 23 """; |
24 | 24 |
25 /// Builds N copies of the class hierarchy for the given program. | 25 /// Builds N copies of the class hierarchy for the given program. |
26 /// Pass --print-metrics to the Dart VM to measure the memory use. | 26 /// Pass --print-metrics to the Dart VM to measure the memory use. |
27 main(List<String> args) { | 27 main(List<String> args) { |
28 if (args.length == 0) { | 28 if (args.length == 0) { |
29 print(usage); | 29 print(usage); |
(...skipping 25 matching lines...) Expand all Loading... |
55 | 55 |
56 if (args.contains('-v')) { | 56 if (args.contains('-v')) { |
57 // Use of the list for something to avoid premature GC. | 57 // Use of the list for something to avoid premature GC. |
58 int size = 0; | 58 int size = 0; |
59 for (var classHierarchy in keepAlive) { | 59 for (var classHierarchy in keepAlive) { |
60 size += classHierarchy.getSuperTypeHashTableSize(); | 60 size += classHierarchy.getSuperTypeHashTableSize(); |
61 } | 61 } |
62 print(size); | 62 print(size); |
63 } | 63 } |
64 } | 64 } |
OLD | NEW |