Changeset 6ff08d8 for doc/theses/andrew_beach_MMath/code/cond-catch.cpp
- Timestamp:
- Jul 12, 2021, 1:44:35 PM (3 years ago)
- 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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/cond-catch.cpp
rcf444b6 r6ff08d8 1 1 // Conditional Match (or Re-Raise) 2 #include <chrono> 3 #include <cstdlib> 2 4 #include <exception> 3 #include <cstdlib> 5 #include <iostream> 6 7 using namespace std::chrono; 4 8 5 9 struct EmptyException : public std::exception {}; … … 23 27 int main(int argc, char * argv[]) { 24 28 unsigned int times = 1; 25 unsigned int total_frames = 1; 26 if (2 < argc) { 29 if (1 < argc) { 27 30 times = strtol(argv[1], nullptr, 10); 28 31 } 29 if ( 3< argc) {30 total_frames= strtol(argv[2], nullptr, 10);32 if (2 < argc) { 33 should_catch = strtol(argv[2], nullptr, 10); 31 34 } 32 35 36 time_point<steady_clock> start_time = steady_clock::now(); 33 37 for (unsigned int count = 0 ; count < times ; ++count) { 34 38 try { … … 38 42 } 39 43 } 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; 40 47 }
Note: See TracChangeset
for help on using the changeset viewer.