CGRA-ME
|
#include <CodeProfiling.h>
Classes | |
struct | TickResult |
Public Types | |
using | Clock = std::chrono::steady_clock |
using | TimePoint = std::chrono::time_point< Clock > |
using | TimeEntry = std::pair< std::string, TimePoint > |
Public Member Functions | |
ChronoSequence (std::string sequence_name) | |
virtual | ~ChronoSequence ()=default |
auto | now () const |
TimeEntry | makeNowTick (std::string timepoint_name) const |
TickResult | tick (std::string timepoint_name, double threshold=0.0, std::ostream *os=nullptr) |
void | printTo (std::ostream &os) const |
void | printEntry (const TimeEntry &entry, const TimeEntry &previous, std::ostream &os, std::ptrdiff_t name_width=0) const |
double | getTotal () |
double | secondsSinceStart () |
Static Public Member Functions | |
static double | differenceAsSecondFraction (const TimePoint &start, const TimePoint &end) |
Protected Member Functions | |
void | recordTick (TimeEntry new_entry, std::ostream *os) |
Protected Attributes | |
std::string | sequence_name |
std::vector< TimeEntry > | times |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ChronoSequence &cs) |
For taking timing measurements of a large piece of code, especially with multiple sections.
Ex. ChronoSequence timing_seq("my sequence"); std::this_thread::sleep_for(std::chrono::seconds(4)); timing_seq.tick("takes 4 seconds"); std::this_thread::sleep_for(std::chrono::seconds(2)); timing_seq.tick("takes 2 seconds"); std::cout << timing_seq << '
';
// prints something like: // start of my sequence +0.000000 @0.000000 // takes 4 seconds +4.000000 @4.000000 // takes 2 seconds +2.000000 @6.000000
Definition at line 26 of file CodeProfiling.h.
using ChronoSequence::Clock = std::chrono::steady_clock |
Definition at line 27 of file CodeProfiling.h.
using ChronoSequence::TimeEntry = std::pair<std::string, TimePoint> |
Definition at line 29 of file CodeProfiling.h.
using ChronoSequence::TimePoint = std::chrono::time_point<Clock> |
Definition at line 28 of file CodeProfiling.h.
|
inline |
Definition at line 37 of file CodeProfiling.h.
|
virtualdefault |
|
inlinestatic |
Definition at line 68 of file CodeProfiling.h.
|
inline |
Definition at line 93 of file CodeProfiling.h.
|
inline |
Definition at line 47 of file CodeProfiling.h.
|
inline |
Definition at line 46 of file CodeProfiling.h.
|
inline |
Definition at line 87 of file CodeProfiling.h.
|
inline |
Definition at line 72 of file CodeProfiling.h.
|
inlineprotected |
Unconditionally append the given tick, new_entry
, to the list of ticks.
Definition at line 104 of file CodeProfiling.h.
|
inline |
Definition at line 94 of file CodeProfiling.h.
|
inline |
Record how much time it has been since the last tick under a name No effect if it has been less than threshold
seconds since the last tick. Will immediately print the tick information to the given ostream, if it is not null.
Definition at line 54 of file CodeProfiling.h.
|
friend |
Definition at line 96 of file CodeProfiling.h.
|
protected |
Definition at line 113 of file CodeProfiling.h.
|
protected |
Definition at line 114 of file CodeProfiling.h.