ADT
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Last change
on this file since 37c6f77 was 47e413b, checked in by Andrew Beach <ajbeach@…>, 4 years ago |
Cforall exception benchmarks now use a more high resolution clock.
|
-
Property mode
set to
100644
|
File size:
645 bytes
|
Line | |
---|
1 | // Cross a Try Statement with a Termination Handler
|
---|
2 | #include <clock.hfa>
|
---|
3 | #include <exception.hfa>
|
---|
4 | #include <fstream.hfa>
|
---|
5 | #include <stdlib.hfa>
|
---|
6 |
|
---|
7 | EHM_EXCEPTION(not_raised_exception)();
|
---|
8 |
|
---|
9 | int main(int argc, char * argv[]) {
|
---|
10 | unsigned int times = 1;
|
---|
11 | unsigned int total_frames = 1;
|
---|
12 | if (1 < argc) {
|
---|
13 | times = strtol(argv[1], 0p, 10);
|
---|
14 | }
|
---|
15 | if (2 < argc) {
|
---|
16 | total_frames = strtol(argv[2], 0p, 10);
|
---|
17 | }
|
---|
18 |
|
---|
19 | Time start_time = timeHiRes();
|
---|
20 | for (unsigned int count = 0 ; count < times ; ++count) {
|
---|
21 | try {
|
---|
22 | // ...
|
---|
23 | } catch (not_raised_exception *) {
|
---|
24 | // ...
|
---|
25 | }
|
---|
26 | }
|
---|
27 | Time end_time = timeHiRes();
|
---|
28 | sout | "Run-Time (ns): " | (end_time - start_time)`ns;
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.