source: doc/theses/andrew_beach_MMath/code/cross-finally.cfa@ 0c730d9

ADT ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 0c730d9 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: 576 bytes
Line 
1// Cross a Try Statement With Finally Clause
2#include <clock.hfa>
3#include <exception.hfa>
4#include <fstream.hfa>
5#include <stdlib.hfa>
6
7int main(int argc, char * argv[]) {
8 unsigned int times = 1;
9 unsigned int total_frames = 1;
10 if (1 < argc) {
11 times = strtol(argv[1], 0p, 10);
12 }
13 if (2 < argc) {
14 total_frames = strtol(argv[2], 0p, 10);
15 }
16
17 Time start_time = timeHiRes();
18 for (unsigned int count = 0 ; count < times ; ++count) {
19 try {
20 // ...
21 } finally {
22 // ...
23 }
24 }
25 Time end_time = timeHiRes();
26 sout | "Run-Time (ns): " | (end_time - start_time)`ns;
27}
Note: See TracBrowser for help on using the repository browser.