2012-03-24 22:39:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// http://linux.die.net/man/3/clock_gettime
|
|
|
|
|
|
|
|
// Seconds.
|
|
|
|
double time_now_d();
|
|
|
|
|
2012-03-31 09:16:13 +00:00
|
|
|
// Sleep. Does not necessarily have millisecond granularity, especially on Windows.
|
2012-03-24 22:39:19 +00:00
|
|
|
void sleep_ms(int ms);
|
2013-01-10 22:47:50 +00:00
|
|
|
|
|
|
|
// Can be sprinkled around the code to make sure that thing don't take
|
|
|
|
// unexpectedly long. What that means is up to you.
|
|
|
|
class LoggingDeadline {
|
|
|
|
public:
|
|
|
|
LoggingDeadline(const char *name, int deadline_in_ms);
|
|
|
|
~LoggingDeadline();
|
|
|
|
bool End();
|
|
|
|
|
|
|
|
private:
|
|
|
|
const char *name_;
|
|
|
|
bool endCalled_;
|
|
|
|
double totalTime_;
|
|
|
|
double endTime_;
|
2020-08-16 08:00:26 +00:00
|
|
|
};
|