16 #ifndef HEARTBEAT_H_PREDOEHL_UOFARIZONAVISION
17 #define HEARTBEAT_H_PREDOEHL_UOFARIZONAVISION
46 const std::string m_msg;
47 const unsigned m_mask;
48 const unsigned m_total;
49 const float m_denominator;
50 const time_t m_start_time;
51 unsigned m_progress_counter;
52 const bool m_is_output_to_tty;
55 mutable int m_lastlen;
67 std::string thump(
bool finalize =
false )
const;
93 const std::string& message,
120 if ( m_is_output_to_tty && 0 == (m_progress_counter & m_mask) )
124 ++m_progress_counter;
141 return thump(
true );
std::string beat()
Indicate one tiny step of your algorithm's execution.
Definition: l_heartbeat.h:117
A class for for indicating the status of slow-moving loops.
Definition: l_heartbeat.h:45
std::string stop() const
Call this when your algorithm is finished, to see total time.
Definition: l_heartbeat.h:139
Heartbeat(const std::string &message, unsigned total=1, unsigned masklen=10)
Make a "heart" which will beat while your slow algorithm runs.
Definition: l_heartbeat.cpp:103