#ifndef STEVE_HEARTBEAT_GUARD #define STEVE_HEARTBEAT_GUARD #include /* * Heartbeater. * create one, and use it to give user-feedback for really * tight loops. */ class Heartbeat { public: //-------------------------------- // Call this function constantly (like, every iteration of your loop). // If it returns true, that means you should perform a "beat". // And a beat means, output some status message // e.g. "Raytraced 123/1234 pixels" // NOTE: If it returns TRUE, then it will assume you // performed the beat. Thus, the next immediate call will // always yield FALSE (until enough time has elapsed) //-------------------------------- bool OK_to_beat(); Heartbeat(time_t secs = 1); virtual ~Heartbeat(); time_t min_secs_per_beat; private: time_t last_beat_time; }; #endif /* STEVE_HEARTBEAT_GUARD */