source: doc/theses/andrew_beach_MMath/code/CrossFinally.java@ d83b266

ADT ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since d83b266 was 11d4fa5, checked in by Andrew Beach <ajbeach@…>, 4 years ago

Updated the Java exception benchmarks to provide some warm-up. Does not appear to change results.

  • Property mode set to 100644
File size: 610 bytes
Line 
1// Cross a Try Statement with a Finally Clause
2
3public class CrossFinally {
4 private static boolean shouldThrow = false;
5
6 private static long loop(int times) {
7 long startTime = System.nanoTime();
8 for (int count = 0 ; count < times ; ++count) {
9 try {
10 // ...
11 } finally {
12 // ...
13 }
14 }
15 long endTime = System.nanoTime();
16 return endTime - startTime;
17 }
18
19 public static void main(String[] args) {
20 int times = 1;
21 if (0 < args.length) {
22 times = Integer.parseInt(args[0]);
23 }
24
25 // Warm-Up:
26 loop(1000);
27
28 long time = loop(times);
29 System.out.println("Run-Time (ns): " + time);
30 }
31}
Note: See TracBrowser for help on using the repository browser.