ADTast-experimentalpthread-emulation
Last change
on this file since f403c46 was
f79ee0d,
checked in by Peter A. Buhr <pabuhr@…>, 3 years ago
|
update exception benchmarks
|
-
Property mode set to
100644
|
File size:
1012 bytes
|
Line | |
---|
1 | // Resume Across Other Handler |
---|
2 | #include <clock.hfa> |
---|
3 | #include <exception.hfa> |
---|
4 | #include <fstream.hfa> |
---|
5 | #include <stdlib.hfa> // strto |
---|
6 | |
---|
7 | exception empty_exception; |
---|
8 | vtable(empty_exception) empty_vt; |
---|
9 | exception not_raised_exception; |
---|
10 | |
---|
11 | void nounwind_other(unsigned int frames) { |
---|
12 | if (frames) { |
---|
13 | try { |
---|
14 | nounwind_other(frames - 1); |
---|
15 | } catchResume (not_raised_exception *) { |
---|
16 | asm volatile ("# fixup block (stack)"); |
---|
17 | } |
---|
18 | } else { |
---|
19 | throwResume (empty_exception){&empty_vt}; |
---|
20 | } |
---|
21 | } |
---|
22 | |
---|
23 | int main(int argc, char * argv[]) { |
---|
24 | unsigned int times = 1; |
---|
25 | unsigned int total_frames = 1; |
---|
26 | if (1 < argc) { |
---|
27 | times = strto(argv[1], 0p, 10); |
---|
28 | } |
---|
29 | if (2 < argc) { |
---|
30 | total_frames = strto(argv[2], 0p, 10); |
---|
31 | } |
---|
32 | |
---|
33 | Time start_time = timeHiRes(); |
---|
34 | for (int count = 0 ; count < times ; ++count) { |
---|
35 | try { |
---|
36 | nounwind_other(total_frames); |
---|
37 | } catchResume (empty_exception *) { |
---|
38 | asm volatile ("# fixup block (base)"); |
---|
39 | } |
---|
40 | } |
---|
41 | Time end_time = timeHiRes(); |
---|
42 | sout | "Run-Time (s): " | wd(0,1, (end_time - start_time)`ns / 1_000_000_000.); |
---|
43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.