Ignore:
Timestamp:
Jul 12, 2021, 1:44:35 PM (3 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
605673f, 9345684
Parents:
cf444b6 (diff), a953c2e3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 moved

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/code/cond-catch.cpp

    rcf444b6 r6ff08d8  
    11// Conditional Match (or Re-Raise)
     2#include <chrono>
     3#include <cstdlib>
    24#include <exception>
    3 #include <cstdlib>
     5#include <iostream>
     6
     7using namespace std::chrono;
    48
    59struct EmptyException : public std::exception {};
     
    2327int main(int argc, char * argv[]) {
    2428        unsigned int times = 1;
    25         unsigned int total_frames = 1;
    26         if (2 < argc) {
     29        if (1 < argc) {
    2730                times = strtol(argv[1], nullptr, 10);
    2831        }
    29         if (3 < argc) {
    30                 total_frames = strtol(argv[2], nullptr, 10);
     32        if (2 < argc) {
     33                should_catch = strtol(argv[2], nullptr, 10);
    3134        }
    3235
     36        time_point<steady_clock> start_time = steady_clock::now();
    3337    for (unsigned int count = 0 ; count < times ; ++count) {
    3438        try {
     
    3842                }
    3943    }
     44        time_point<steady_clock> end_time = steady_clock::now();
     45        nanoseconds duration = duration_cast<nanoseconds>(end_time - start_time);
     46        std::cout << "Run-Time (ns): " << duration.count() << std::endl;
    4047}
Note: See TracChangeset for help on using the changeset viewer.