/usr/include/mathic/Timer.h is in libmathic-dev 1.0~git20160320-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #ifndef MATHIC_TIMER_GUARD
#define MATHIC_TIMER_GUARD
#include "stdinc.h"
#include <ctime>
#include <cstdio>
#include <ostream>
namespace mathic {
/** Measures spans of CPU time.
The internal record of time can overflow quickly. If
clock_t is 32 bits unsigned and CLOCKS_PER_TIC is one million
then overflow will occur after 71 minutes. */
class Timer {
public:
Timer() {reset();}
/** Resets the amount of elapsed CPU time to zero. */
void reset() {_clocksAtReset = std::clock();}
/** Returns the number of CPU milliseconds since the last reset.
See class description for time span overflow limitations. */
unsigned long getMilliseconds() const;
/** Prints the elapsed time in a human readable format. See
class description for time span overflow limitations. */
void print(FILE* out) const;
/** Prints the elapsed time in a human readable format. See
class description for time span overflow limitations. */
void print(std::ostream& out) const;
private:
std::clock_t _clocksAtReset;
};
inline std::ostream& operator<<(std::ostream& out, const Timer& timer) {
timer.print(out);
return out;
}
}
#endif
|