-
- if(callout[0].c_time <= 0) {
- p1 = &callout[0];
- while(p1->c_func != 0 && p1->c_time <= 0) {
- (*p1->c_func)(p1->c_arg);
- p1++;
- }
- p2 = &callout[0];
- while(p2->c_func = p1->c_func) {
- p2->c_time = p1->c_time;
- p2->c_arg = p1->c_arg;
- p1++;
- p2++;
+ if (USERMODE(ps)) {
+ /*
+ * CPU was in user state. Increment
+ * user time counter, and process process-virtual time
+ * interval timer.
+ */
+ bumptime(&u.u_ru.ru_utime, tick);
+ if (timerisset(&u.u_timer[ITIMER_VIRTUAL].it_value) &&
+ itimerdecr(&u.u_timer[ITIMER_VIRTUAL], tick) == 0)
+ psignal(u.u_procp, SIGVTALRM);
+ if (u.u_procp->p_nice > NZERO)
+ cpstate = CP_NICE;
+ else
+ cpstate = CP_USER;
+ } else {
+ /*
+ * CPU was in system state. If profiling kernel
+ * increment a counter. If no process is running
+ * then this is a system tick if we were running
+ * at a non-zero IPL (in a driver). If a process is running,
+ * then we charge it with system time even if we were
+ * at a non-zero IPL, since the system often runs
+ * this way during processing of system calls.
+ * This is approximate, but the lack of true interval
+ * timers makes doing anything else difficult.
+ */
+#ifdef GPROF
+ int k = pc - s_lowpc;
+ if (profiling < 2 && k < s_textsize)
+ kcount[k / sizeof (*kcount)]++;
+#endif
+ cpstate = CP_SYS;
+ if (noproc) {
+ if ((ps&PSL_IPL) != 0)
+ cpstate = CP_IDLE;
+ } else {
+ bumptime(&u.u_ru.ru_stime, tick);