aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1998-07-27 19:16:21 +0000
committerBruce Evans <bde@FreeBSD.org>1998-07-27 19:16:21 +0000
commitbc9e7c3b4227265a72363a3e2898afc0068ffd0d (patch)
tree02b4d0ae4fb51e82cb4dbab46e84bbc7dd6dc463 /sys/kern
parentd6c37912c61f77db81788f51b68cc44c50d1dbf9 (diff)
downloadsrc-bc9e7c3b4227265a72363a3e2898afc0068ffd0d.tar.gz
src-bc9e7c3b4227265a72363a3e2898afc0068ffd0d.zip
Fixed double counting of runtime after a process exits. The last
timeslice of the exiting process was counted for both the exiting process and the next process to run if the next process runs immediately. Broken in: mostly in kern_clock.c rev.1.70 (1998/05/28)
Notes
Notes: svn path=/head/; revision=37894
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_resource.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index a19f489cc75b..1bad1d2f0471 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.36 1998/05/17 11:52:43 phk Exp $
+ * $Id: kern_resource.c,v 1.37 1998/05/28 09:30:18 phk Exp $
*/
#include "opt_compat.h"
@@ -524,6 +524,16 @@ calcru(p, up, sp, ip)
microuptime(&tv);
totusec += (tv.tv_usec - p->p_switchtime.tv_usec) +
(tv.tv_sec - p->p_switchtime.tv_sec) * (int64_t)1000000;
+
+ /*
+ * Copy the time that was just read to `switchtime' in case
+ * we are being called from exit1(). Exits don't go through
+ * mi_switch(), so `switchtime' doesn't get set in the normal
+ * way. We set it here instead of more cleanly in exit1()
+ * to avoid losing track of the time between the calls to
+ * microuptime().
+ */
+ switchtime = tv;
}
if (totusec < 0) {
/* XXX no %qd in kernel. Truncate. */