20 DELTA_T_STORE += clock() - T_START;
37 return 1.e3 * double(DELTA_T_STORE) / CLOCKS_PER_SEC;
40 return 1.e3 * (double(DELTA_T_STORE) + double(clock()) - double(T_START)) / CLOCKS_PER_SEC;
50 return 1.e3 * double(DELTA_T_STORE) / CLOCKS_PER_SEC / COUNTER;
52 std::string problem = HEADER;
53 problem +=
"\n The Timer object can only return time_per_count after being stopped.\n";
60 std::cout.precision(4);
61 std::cout <<
" " << HEADER <<
"\n";
62 const double elapsed_time_in_ms(1.e3 *
double(DELTA_T_STORE) / CLOCKS_PER_SEC);
63 if(elapsed_time_in_ms > 1000) {
64 std::cout <<
" TOTAL CPU time taken = " << elapsed_time_in_ms / 1000. <<
" s\n";
65 std::cout <<
" TOTAL wall time taken = " << m_deltaWall <<
" s\n";
67 std::cout <<
" TOTAL CPU time taken = " << elapsed_time_in_ms <<
" ms\n";
70 std::cout <<
" Number of loops during this time = " << COUNTER <<
"\n";
71 std::cout <<
" Throughput = " << 1.e3 * COUNTER / elapsed_time_in_ms <<
" runs/s \n";
The collection of CppNoddy exceptions.
A spec for the CppNoddy Timer object.
A generic runtime exception.
double get_time() const
Return the time.
void start()
Start the timer & reset stored time to zero.
double time_per_count() const
int & counter()
Increment an internal discrete counter.
void print() const
Write a string to cout stating the time taken.
void stop()
Stop the clock & add the current time interval to the previously stored values ready for printing.
void reset()
Pause the clock & add the time interval to the stored cumulative time.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...