Ignore:
Timestamp:
Jul 5, 2021, 3:17:12 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
11ad42f, e84ab3d
Parents:
b7763da
Message:

Added duration information (in nanoseconds) to EHM benchmarks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/code/throw-detor.cpp

    rb7763da ree23a8d  
    11// Throw Across Destructor
     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 {};
     
    2125        unsigned int times = 1;
    2226        unsigned int total_frames = 1;
    23         if (2 < argc) {
     27        if (1 < argc) {
    2428                times = strtol(argv[1], nullptr, 10);
    2529        }
    26         if (3 < argc) {
     30        if (2 < argc) {
    2731                total_frames = strtol(argv[2], nullptr, 10);
    2832        }
    2933
     34        time_point<steady_clock> start_time = steady_clock::now();
    3035        for (int count = 0 ; count < times ; ++count) {
    3136                try {
     
    3540                }
    3641        }
     42        time_point<steady_clock> end_time = steady_clock::now();
     43        nanoseconds duration = duration_cast<nanoseconds>(end_time - start_time);
     44        std::cout << "Run-Time (ns): " << duration.count() << std::endl;
    3745}
Note: See TracChangeset for help on using the changeset viewer.