Fix timing measure for multi-thread tests (as it was reported the total time consummed
by all threads, not the run time).
This commit is contained in:
1 parent
ccaf183940
commit
02445c9cc3
1 file changed
+8
@@ -47,9 +47,17 @@ cputime (void)
|
|||||||
static unsigned long long
|
static unsigned long long
|
||||||
cputime (void)
|
cputime (void)
|
||||||
{
|
{
|
||||||
|
#if defined(MULTI_THREAD_MEASURE)
|
||||||
|
// Multi thread
|
||||||
|
struct timeval tv;
|
||||||
|
gettimeofday (&tv, NULL);
|
||||||
|
return tv.tv_sec * 1000000ULL + tv.tv_usec;
|
||||||
|
#else
|
||||||
|
// Single thread
|
||||||
struct rusage rus;
|
struct rusage rus;
|
||||||
getrusage (0, &rus);
|
getrusage (0, &rus);
|
||||||
return rus.ru_utime.tv_sec * 1000000ULL + rus.ru_utime.tv_usec;
|
return rus.ru_utime.tv_sec * 1000000ULL + rus.ru_utime.tv_usec;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in new issue
Block a user