inline
struct timeval operator-(const struct timeval& a, const struct timeval& b)
{
- timeval result;
+ struct timeval result;
result.tv_sec = a.tv_sec - b.tv_sec;
result.tv_usec = a.tv_usec - b.tv_usec;
if (result.tv_usec < 0) {
return result;
}
-double timertod(const timeval& a)
+double timertod(const struct timeval& a)
{
return a.tv_sec + a.tv_usec / 1e6;
}
void start()
{
- getrusage(RUSAGE_SELF, &before);
+ getrusage(RUSAGE_SELF, &before);
}
void stop()
{
- getrusage(RUSAGE_SELF, &after);
+ getrusage(RUSAGE_SELF, &after);
difference = difference + ((after.ru_utime + after.ru_stime) -
(before.ru_utime + before.ru_stime));
}