diff options
author | phk <phk@FreeBSD.org> | 1998-04-04 13:26:20 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1998-04-04 13:26:20 +0000 |
commit | 5e9a131f20894d1df9e8c1768be6eb1cc29a3cf4 (patch) | |
tree | 76909c92c472744745de10e5dacc307ea5f7af45 /sys/kern/kern_resource.c | |
parent | ddcbf85eb29fd2d50ce1afa0243be370d4893370 (diff) | |
download | FreeBSD-src-5e9a131f20894d1df9e8c1768be6eb1cc29a3cf4.zip FreeBSD-src-5e9a131f20894d1df9e8c1768be6eb1cc29a3cf4.tar.gz |
Time changes mark 2:
* Figure out UTC relative to boottime. Four new functions provide
time relative to boottime.
* move "runtime" into struct proc. This helps fix the calcru()
problem in SMP.
* kill mono_time.
* add timespec{add|sub|cmp} macros to time.h. (XXX: These may change!)
* nanosleep, select & poll takes long sleeps one day at a time
Reviewed by: bde
Tested by: ache and others
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r-- | sys/kern/kern_resource.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 1b034ca..004a446 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 - * $Id: kern_resource.c,v 1.32 1998/02/09 06:09:24 eivind Exp $ + * $Id: kern_resource.c,v 1.33 1998/03/04 10:25:52 dufault Exp $ */ #include "opt_compat.h" @@ -491,6 +491,7 @@ calcru(p, up, sp, ip) int s; struct timeval tv; + /* XXX: why spl-protect ? worst case is an off-by-one report */ s = splstatclock(); st = p->p_sticks; ut = p->p_uticks; @@ -505,23 +506,25 @@ calcru(p, up, sp, ip) sec = p->p_rtime.tv_sec; usec = p->p_rtime.tv_usec; - if (p == curproc) { /* XXX what if it's running on another cpu?? */ +#ifdef SMP + if (p->p_oncpu != 0xff) { +#else + if (p == curproc) { +#endif /* * Adjust for the current time slice. This is actually fairly * important since the error here is on the order of a time * quantum, which is much greater than the sampling error. */ - microtime(&tv); - sec += tv.tv_sec - runtime.tv_sec; - usec += tv.tv_usec - runtime.tv_usec; + microruntime(&tv); + sec += tv.tv_sec - p->p_runtime.tv_sec; + usec += tv.tv_usec - p->p_runtime.tv_usec; } totusec = (quad_t)sec * 1000000 + usec; if (totusec < 0) { -#ifndef SMP /* sigh, microtime and fork/exit madness here */ /* XXX no %qd in kernel. Truncate. */ printf("calcru: negative time of %ld usec for pid %d (%s)\n", (long)totusec, p->p_pid, p->p_comm); -#endif totusec = 0; } u = totusec; |