OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:io'; | 5 import 'dart:io'; |
6 import 'package:kernel/checks.dart'; | 6 |
7 import 'package:kernel/kernel.dart'; | 7 import 'package:kernel/kernel.dart'; |
| 8 import 'package:kernel/verifier.dart'; |
8 | 9 |
9 final String usage = ''' | 10 final String usage = ''' |
10 Usage: check_bench FILE.dill | 11 Usage: verify_bench FILE.dill |
11 | 12 |
12 Measures the time it takes to run sanity checks on the given program. | 13 Measures the time it takes to run kernel verifier on the given program. |
13 '''; | 14 '''; |
14 | 15 |
15 main(List<String> args) { | 16 main(List<String> args) { |
16 if (args.length != 1) { | 17 if (args.length != 1) { |
17 print(usage); | 18 print(usage); |
18 exit(1); | 19 exit(1); |
19 } | 20 } |
20 var program = loadProgramFromBinary(args[0]); | 21 var program = loadProgramFromBinary(args[0]); |
21 var watch = new Stopwatch()..start(); | 22 var watch = new Stopwatch()..start(); |
22 runSanityChecks(program); | 23 verifyProgram(program); |
23 print('Cold: ${watch.elapsedMilliseconds} ms'); | 24 print('Cold: ${watch.elapsedMilliseconds} ms'); |
24 const int warmUpTrials = 20; | 25 const int warmUpTrials = 20; |
25 for (int i = 0; i < warmUpTrials; ++i) { | 26 for (int i = 0; i < warmUpTrials; ++i) { |
26 runSanityChecks(program); | 27 verifyProgram(program); |
27 } | 28 } |
28 watch.reset(); | 29 watch.reset(); |
29 const int numberOfTrials = 100; | 30 const int numberOfTrials = 100; |
30 for (int i = 0; i < numberOfTrials; ++i) { | 31 for (int i = 0; i < numberOfTrials; ++i) { |
31 runSanityChecks(program); | 32 verifyProgram(program); |
32 } | 33 } |
33 double millisecondsPerRun = watch.elapsedMilliseconds / numberOfTrials; | 34 double millisecondsPerRun = watch.elapsedMilliseconds / numberOfTrials; |
34 print('Hot: $millisecondsPerRun ms'); | 35 print('Hot: $millisecondsPerRun ms'); |
35 } | 36 } |
OLD | NEW |