ADT
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Last change
on this file since e49b6f5 was ee23a8d, checked in by Andrew Beach <ajbeach@…>, 4 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.