getrusage on NetBSD may not return monotonically increasing values for CPU time.

See: http://archives.devshed.com/forums/bsd-93/kern-30115-getrusage-returns-bogus-ru-utime-values-220800.html
This commit is contained in:
Doug MacEachern 2009-04-25 09:52:07 -07:00
parent 039080f722
commit 8c8d4cf814
1 changed files with 3 additions and 1 deletions

View File

@ -1905,7 +1905,7 @@ int sigar_thread_cpu_get(sigar_t *sigar,
sigar_uint64_t id, sigar_uint64_t id,
sigar_thread_cpu_t *cpu) sigar_thread_cpu_t *cpu)
{ {
#ifdef DARWIN #if defined(DARWIN)
mach_port_t self = mach_thread_self(); mach_port_t self = mach_thread_self();
thread_basic_info_data_t info; thread_basic_info_data_t info;
mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT; mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
@ -1922,6 +1922,8 @@ int sigar_thread_cpu_get(sigar_t *sigar,
cpu->user = tval2nsec(info.user_time); cpu->user = tval2nsec(info.user_time);
cpu->sys = tval2nsec(info.system_time); cpu->sys = tval2nsec(info.system_time);
cpu->total = cpu->user + cpu->sys; cpu->total = cpu->user + cpu->sys;
#elif defined(__NetBSD__)
return SIGAR_ENOTIMPL; /* http://tinyurl.com/chbvln */
#else #else
/* XXX this is not per-thread, it is for the whole-process. /* XXX this is not per-thread, it is for the whole-process.
* just want to use for the shell time command at the moment. * just want to use for the shell time command at the moment.