ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationpthread-emulationqualifiedEnum
Last change
on this file since 9cb6514 was
f79ee0d,
checked in by Peter A. Buhr <pabuhr@…>, 3 years ago
|
update exception benchmarks
|
-
Property mode set to
100644
|
File size:
845 bytes
|
Rev | Line | |
---|
[f79ee0d] | 1 | // Resume Across Fixup |
---|
| 2 | #include <clock.hfa> |
---|
| 3 | #include <fstream.hfa> |
---|
| 4 | #include <stdlib.hfa> // strto |
---|
| 5 | |
---|
| 6 | void nounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) { |
---|
| 7 | if (frames) { |
---|
| 8 | nounwind_fixup(frames - 1, raised_rtn); |
---|
| 9 | } else { |
---|
| 10 | int fixup = 17; |
---|
| 11 | raised_rtn(fixup); |
---|
| 12 | } |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | int main(int argc, char * argv[]) { |
---|
| 16 | unsigned int times = 1; |
---|
| 17 | unsigned int total_frames = 1; |
---|
| 18 | if (1 < argc) { |
---|
| 19 | times = strto(argv[1], 0p, 10); |
---|
| 20 | } |
---|
| 21 | if (2 < argc) { |
---|
| 22 | total_frames = strto(argv[2], 0p, 10); |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | void raised(int & fixup) { |
---|
| 26 | fixup = total_frames + 42; // use local scope => lexical link |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | Time start_time = timeHiRes(); |
---|
| 30 | for (unsigned int count = 0 ; count < times ; ++count) { |
---|
| 31 | nounwind_fixup(total_frames, raised); |
---|
| 32 | } |
---|
| 33 | Time end_time = timeHiRes(); |
---|
| 34 | sout | "Run-Time (s): " | wd(0,1, (end_time - start_time)`ns / 1_000_000_000.); |
---|
| 35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.