ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 815c6ae was
11d4fa5,
checked in by Andrew Beach <ajbeach@…>, 3 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
|
Rev | Line | |
---|
[ea593a3] | 1 | // Cross a Try Statement with a Finally Clause |
---|
| 2 | |
---|
| 3 | public class CrossFinally { |
---|
[11d4fa5] | 4 | private static boolean shouldThrow = false; |
---|
[ea593a3] | 5 | |
---|
[11d4fa5] | 6 | private static long loop(int times) { |
---|
[ee23a8d] | 7 | long startTime = System.nanoTime(); |
---|
[ea593a3] | 8 | for (int count = 0 ; count < times ; ++count) { |
---|
| 9 | try { |
---|
| 10 | // ... |
---|
| 11 | } finally { |
---|
| 12 | // ... |
---|
| 13 | } |
---|
| 14 | } |
---|
[ee23a8d] | 15 | long endTime = System.nanoTime(); |
---|
[11d4fa5] | 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); |
---|
[ea593a3] | 30 | } |
---|
| 31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.