Changeset ee23a8d for doc/theses/andrew_beach_MMath/code/throw-other.cpp
- Timestamp:
- Jul 5, 2021, 3:17:12 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 11ad42f, e84ab3d
- Parents:
- b7763da
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/throw-other.cpp
rb7763da ree23a8d 1 1 // Throw Across Other Handler 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 {}; … … 22 26 unsigned int times = 1; 23 27 unsigned int total_frames = 1; 24 if ( 2< argc) {28 if (1 < argc) { 25 29 times = strtol(argv[1], nullptr, 10); 26 30 } 27 if ( 3< argc) {31 if (2 < argc) { 28 32 total_frames = strtol(argv[2], nullptr, 10); 29 33 } 30 34 35 time_point<steady_clock> start_time = steady_clock::now(); 31 36 for (int count = 0 ; count < times ; ++count) { 32 37 try { … … 36 41 } 37 42 } 43 time_point<steady_clock> end_time = steady_clock::now(); 44 nanoseconds duration = duration_cast<nanoseconds>(end_time - start_time); 45 std::cout << "Run-Time (ns): " << duration.count() << std::endl; 38 46 }
Note: See TracChangeset
for help on using the changeset viewer.