thread_should_yield (struct thread *thread)
{
quagga_get_relative (NULL);
- return (timeval_elapsed(relative_time, thread->ru.real) >
+ return (timeval_elapsed(relative_time, thread->real) >
THREAD_YIELD_TIME_SLOT);
}
thread_call (struct thread *thread)
{
unsigned long realtime, cputime;
- RUSAGE_T ru;
+ RUSAGE_T before, after;
/* Cache a pointer to the relevant cpu history thread, if the thread
* does not have it yet.
(void * (*) (void *))cpu_record_hash_alloc);
}
- GETRUSAGE (&thread->ru);
+ GETRUSAGE (&before);
+ thread->real = before.real;
(*thread->func) (thread);
- GETRUSAGE (&ru);
+ GETRUSAGE (&after);
- realtime = thread_consumed_time (&ru, &thread->ru, &cputime);
+ realtime = thread_consumed_time (&after, &before, &cputime);
thread->hist->real.total += realtime;
if (thread->hist->real.max < realtime)
thread->hist->real.max = realtime;
int fd; /* file descriptor in case of read/write. */
struct timeval sands; /* rest of time sands value. */
} u;
- RUSAGE_T ru; /* Indepth usage info. */
+ struct timeval real;
struct cpu_thread_history *hist; /* cache pointer to cpu_history */
char* funcname;
};