41 const auto now = std::chrono::high_resolution_clock::now();
42 std::chrono::duration<float> duration = now -
m_start;
44 return duration.count();
52 std::stringstream buffer;
69 : m_name(
name), m_out(out), m_start(
std::chrono::system_clock::now()) {}
74 const auto stop = std::chrono::system_clock::now();
75 const std::chrono::duration<double> elapsed = stop -
m_start;
76 m_out <<
"Elapsed time (sec) in \"" <<
m_name <<
"\": " << elapsed.count() <<
'\n';
84 : m_accumulator(accumulator), m_start(
std::chrono::system_clock::now()) {}
89 const auto stop = std::chrono::system_clock::now();
90 const std::chrono::duration<double> elapsed = stop -
m_start;
104 m_number_of_entrances = 0;
111 m_elapsed_sec += time_sec;
112 m_number_of_entrances++;
129 std::ostringstream out;
130 out <<
"Elapsed time (sec) in \"" << m_name <<
"\": " << m_elapsed_sec
131 <<
"; Number of entrances: " << m_number_of_entrances;
double obj
the value of the quadratic function
std::string toString() const
Return the timing summary as a string.
void reset()
Reset the elapsed wall-clock time and number of times the code block was entered.
size_t getNumberOfEntrances() const
Return the number of times the code block was entered.
void increment(const double time_sec)
Increment the elapsed wall-clock time and number of times the code block was entered.
double getElapsed() const
Return the total elapsed wall-clock time.
~CodeBlockMultipleTimer()
Calculate the elapsed wall-clock time (seconds) and update the time accumulator.
CodeBlockMultipleTimer()=delete
TimeAccumulator & m_accumulator
std::chrono::time_point< std::chrono::system_clock > m_start
~CodeBlockTimer()
Calculate and output to a stream the elapsed wall-clock time (sec)
std::chrono::time_point< std::chrono::system_clock > m_start
A simple class that provides a wall-clock (not processor time) timer.
float elapsed_no_reset() const
Returns the wall-clock time elapsed in seconds since the Timer object's creation, or the last call to...
float elapsed(bool reset=true)
Returns the wall-clock time elapsed in seconds since the Timer object's creation, or the last call to...
void reset()
Explicitly reset the timer.
time_point_ns m_start
The starting time.
std::string str() const
Convert the elapsed time (without reseting) to a string.
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.