summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_resource.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-07-27 19:16:21 +0000
committerbde <bde@FreeBSD.org>1998-07-27 19:16:21 +0000
commitd3ce1542c8c6c45b760f7bf089d043d3ba30c1d6 (patch)
treed05ffb45dd0644105ee06529d208d24953dbec0a /sys/kern/kern_resource.c
parent4f1654fff445d112e931db403b0e03ea11452383 (diff)
downloadFreeBSD-src-d3ce1542c8c6c45b760f7bf089d043d3ba30c1d6.zip
FreeBSD-src-d3ce1542c8c6c45b760f7bf089d043d3ba30c1d6.tar.gz
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)
Diffstat (limited to 'sys/kern/kern_resource.c')
-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 a19f489..1bad1d2 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. */
OpenPOWER on IntegriCloud