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