Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/init_main.c
| Show First 20 Lines • Show All 637 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL); | SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL); | ||||
| /* ARGSUSED*/ | /* ARGSUSED*/ | ||||
| static void | static void | ||||
| proc0_post(void *dummy __unused) | proc0_post(void *dummy __unused) | ||||
| { | { | ||||
| struct proc *p; | struct proc *p; | ||||
| struct rusage ru; | |||||
| struct thread *td; | struct thread *td; | ||||
| /* | /* | ||||
| * Now we can look at the time, having had a chance to verify the | * Now we can look at the time, having had a chance to verify the | ||||
| * time from the filesystem. Pretend that all current threads | * time from the filesystem. Pretend that all current threads | ||||
| * started now. | * started now. | ||||
| */ | */ | ||||
| sx_slock(&allproc_lock); | sx_slock(&allproc_lock); | ||||
| FOREACH_PROC_IN_SYSTEM(p) { | FOREACH_PROC_IN_SYSTEM(p) { | ||||
| PROC_LOCK(p); | PROC_LOCK(p); | ||||
| if (p->p_state == PRS_NEW) { | if (p->p_state == PRS_NEW) { | ||||
| PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
| continue; | continue; | ||||
| } | } | ||||
| microuptime(&p->p_stats->p_start); | microuptime(&p->p_stats->p_start); | ||||
| PROC_STATLOCK(p); | PROC_STATLOCK(p); | ||||
| rufetch(p, &ru); /* Clears thread stats */ | |||||
| ruxreset(&p->p_rux); | ruxreset(&p->p_rux); | ||||
| FOREACH_THREAD_IN_PROC(p, td) { | FOREACH_THREAD_IN_PROC(p, td) { | ||||
| td->td_runtime = 0; | |||||
| thread_lock(td); | thread_lock(td); | ||||
| td->td_incruntime = 0; | |||||
| td->td_runtime = 0; | |||||
| td->td_pticks = 0; | |||||
| td->td_sticks = 0; | |||||
| td->td_iticks = 0; | |||||
| td->td_uticks = 0; | |||||
| ruxreset(&td->td_rux); | ruxreset(&td->td_rux); | ||||
| thread_unlock(td); | thread_unlock(td); | ||||
| } | } | ||||
| PROC_STATUNLOCK(p); | PROC_STATUNLOCK(p); | ||||
| PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
| } | } | ||||
| sx_sunlock(&allproc_lock); | sx_sunlock(&allproc_lock); | ||||
| PCPU_SET(switchtime, cpu_ticks()); | PCPU_SET(switchtime, cpu_ticks()); | ||||
| ▲ Show 20 Lines • Show All 239 Lines • Show Last 20 Lines | |||||