source: doc/theses/andrew_beach_MMath/code/cross-finally.cfa @ 47e413b

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 47e413b was 47e413b, checked in by Andrew Beach <ajbeach@…>, 3 years ago

Cforall exception benchmarks now use a more high resolution clock.

  • Property mode set to 100644
File size: 576 bytes
RevLine 
[ea593a3]1// Cross a Try Statement With Finally Clause
[ee23a8d]2#include <clock.hfa>
[ea593a3]3#include <exception.hfa>
[ee23a8d]4#include <fstream.hfa>
[ea593a3]5#include <stdlib.hfa>
6
7int main(int argc, char * argv[]) {
8        unsigned int times = 1;
9        unsigned int total_frames = 1;
[ee23a8d]10        if (1 < argc) {
[ea593a3]11                times = strtol(argv[1], 0p, 10);
12        }
[ee23a8d]13        if (2 < argc) {
[ea593a3]14                total_frames = strtol(argv[2], 0p, 10);
15        }
16
[47e413b]17        Time start_time = timeHiRes();
[ea593a3]18        for (unsigned int count = 0 ; count < times ; ++count) {
19                 try {
20                        // ...
21                } finally {
22                        // ...
23                }
24        }
[47e413b]25        Time end_time = timeHiRes();
[ee23a8d]26        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
[ea593a3]27}
Note: See TracBrowser for help on using the repository browser.