Backout previous commit. sched_lock is held, thus interrupts are prevented

here.

Submitted by:	jhb
This commit is contained in:
Tor Egge 2001-02-22 20:12:52 +00:00
parent 0d139b3741
commit 35030da9f8

View File

@ -567,27 +567,19 @@ calcru(p, up, sp, ip)
tu = p->p_runtime; tu = p->p_runtime;
if (p == curproc) { if (p == curproc) {
struct timeval old_switchtime;
/* /*
* Adjust for the current time slice. This is actually fairly * Adjust for the current time slice. This is actually fairly
* important since the error here is on the order of a time * important since the error here is on the order of a time
* quantum, which is much greater than the sampling error. * quantum, which is much greater than the sampling error.
*/ */
do { microuptime(&tv);
old_switchtime = PCPU_GET(switchtime); if (timevalcmp(&tv, PCPU_PTR(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, <))
printf("microuptime() went backwards (%ld.%06ld -> %ld.%06ld)\n", printf("microuptime() went backwards (%ld.%06ld -> %ld.%06ld)\n",
old_switchtime.tv_sec, PCPU_GET(switchtime.tv_sec), PCPU_GET(switchtime.tv_usec),
old_switchtime.tv_usec, tv.tv_sec, tv.tv_usec);
tv.tv_sec, tv.tv_usec);
else else
tu += (tv.tv_usec - old_switchtime.tv_usec) + tu += (tv.tv_usec - PCPU_GET(switchtime.tv_usec)) +
(tv.tv_sec - old_switchtime.tv_sec) * (tv.tv_sec - PCPU_GET(switchtime.tv_sec)) *
(int64_t)1000000; (int64_t)1000000;
} }
ptu = p->p_uu + p->p_su + p->p_iu; ptu = p->p_uu + p->p_su + p->p_iu;