29 # include <sys/time.h>
30 # include <sys/resource.h>
31 #elif defined HAVE_TIMES
32 # include <sys/times.h>
50 #ifdef XAPIAN_DEBUG_LOG
51 SKIP_TEST(
"Skipping timed test because configured with --enable-log");
53 static bool skip = (getenv(
"AUTOMATED_TESTING") != NULL);
55 SKIP_TEST(
"Skipping timed test because $AUTOMATED_TESTING is set");
61 if (getrusage(RUSAGE_SELF, &r) == -1) {
65 t = r.ru_utime.tv_sec + r.ru_stime.tv_sec;
66 t += (r.ru_utime.tv_usec + r.ru_stime.tv_usec) * 0.000001;
67 #elif defined HAVE_TIMES
69 if (times(&b) == clock_t(-1)) {
72 t = (double)(b.tms_utime + b.tms_stime);
74 t /= sysconf(_SC_CLK_TCK);
static double get_current_cputime()
void errno_to_string(int e, string &s)
Convert errno value to std::string, thread-safe if possible.
double now()
Return the current time.
Functions for handling a time or time interval in a double.
<unistd.h>, but with compat.
a generic test suite engine
#define FAIL_TEST(MSG)
Fail the current testcase with message MSG.
#define SKIP_TEST(MSG)
Skip the current testcase with message MSG.