summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_resource.c
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2001-02-22 20:12:52 +0000
committertegge <tegge@FreeBSD.org>2001-02-22 20:12:52 +0000
commita0e033921a24795371af2a1aa3c4fb45cbd5ea2c (patch)
tree3b876f7a59e88a366884127692e92733d6585c8b /sys/kern/kern_resource.c
parentb3140862f54f556a07bb57298f0327c9b95770fa (diff)
downloadFreeBSD-src-a0e033921a24795371af2a1aa3c4fb45cbd5ea2c.zip
FreeBSD-src-a0e033921a24795371af2a1aa3c4fb45cbd5ea2c.tar.gz
Backout previous commit. sched_lock is held, thus interrupts are prevented
here. Submitted by: jhb
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r--sys/kern/kern_resource.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index b872acd..73ffb03 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -567,27 +567,19 @@ calcru(p, up, sp, ip)
tu = p->p_runtime;
if (p == curproc) {
- struct timeval old_switchtime;
/*
* 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.
*/
- do {
- old_switchtime = PCPU_GET(switchtime);
- microuptime(&tv);
- } while (old_switchtime.tv_sec !=
- PCPU_GET(switchtime.tv_sec) ||
- old_switchtime.tv_usec !=
- PCPU_GET(switchtime.tv_usec));
- if (timevalcmp(&tv, &old_switchtime, <))
+ microuptime(&tv);
+ if (timevalcmp(&tv, PCPU_PTR(switchtime), <))
printf("microuptime() went backwards (%ld.%06ld -> %ld.%06ld)\n",
- old_switchtime.tv_sec,
- old_switchtime.tv_usec,
- tv.tv_sec, tv.tv_usec);
+ PCPU_GET(switchtime.tv_sec), PCPU_GET(switchtime.tv_usec),
+ tv.tv_sec, tv.tv_usec);
else
- tu += (tv.tv_usec - old_switchtime.tv_usec) +
- (tv.tv_sec - old_switchtime.tv_sec) *
+ tu += (tv.tv_usec - PCPU_GET(switchtime.tv_usec)) +
+ (tv.tv_sec - PCPU_GET(switchtime.tv_sec)) *
(int64_t)1000000;
}
ptu = p->p_uu + p->p_su + p->p_iu;
OpenPOWER on IntegriCloud