ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since d1ecd39 was
ee23a8d,
checked in by Andrew Beach <ajbeach@…>, 3 years ago
|
Added duration information (in nanoseconds) to EHM benchmarks.
|
-
Property mode set to
100644
|
File size:
773 bytes
|
Line | |
---|
1 | // Throw Across Empty Function |
---|
2 | |
---|
3 | class EmptyException extends Exception {} |
---|
4 | |
---|
5 | public class ThrowEmpty { |
---|
6 | static void unwind_empty(int frames) throws EmptyException { |
---|
7 | if (0 < frames) { |
---|
8 | unwind_empty(frames - 1); |
---|
9 | } else { |
---|
10 | throw new EmptyException(); |
---|
11 | } |
---|
12 | } |
---|
13 | |
---|
14 | public static void main(String[] args) { |
---|
15 | int times = 1; |
---|
16 | int total_frames = 1; |
---|
17 | if (0 < args.length) { |
---|
18 | times = Integer.parseInt(args[0]); |
---|
19 | } |
---|
20 | if (1 < args.length) { |
---|
21 | total_frames = Integer.parseInt(args[1]); |
---|
22 | } |
---|
23 | |
---|
24 | long startTime = System.nanoTime(); |
---|
25 | for (int count = 0 ; count < times ; ++count) { |
---|
26 | try { |
---|
27 | unwind_empty(total_frames); |
---|
28 | } catch (EmptyException e) { |
---|
29 | // ... |
---|
30 | } |
---|
31 | } |
---|
32 | long endTime = System.nanoTime(); |
---|
33 | System.out.println("Run-Time (ns) " + (endTime - startTime)); |
---|
34 | } |
---|
35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.