diff options
author | jeff <jeff@FreeBSD.org> | 2007-06-01 01:12:45 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2007-06-01 01:12:45 +0000 |
commit | a7a8bac81f171b93c4770f51c694b15c84a2f9f8 (patch) | |
tree | 9c09dcc76185c3dc30b048a5f2eb972f3bb8a849 /sys/kern/kern_clock.c | |
parent | 062ed7352f59fb6db93a3f51ca6e64ec0cefca22 (diff) | |
download | FreeBSD-src-a7a8bac81f171b93c4770f51c694b15c84a2f9f8.zip FreeBSD-src-a7a8bac81f171b93c4770f51c694b15c84a2f9f8.tar.gz |
- Move rusage from being per-process in struct pstats to per-thread in
td_ru. This removes the requirement for per-process synchronization in
statclock() and mi_switch(). This was previously supported by
sched_lock which is going away. All modifications to rusage are now
done in the context of the owning thread. reads proceed without locks.
- Aggregate exiting threads rusage in thread_exit() such that the exiting
thread's rusage is not lost.
- Provide a new routine, rufetch() to fetch an aggregate of all rusage
structures from all threads in a process. This routine must be used
in any place requiring a rusage from a process prior to it's exit. The
exited process's rusage is still available via p_ru.
- Aggregate tick statistics only on demand via rufetch() or when a thread
exits. Tick statistics are kept in the thread and protected by sched_lock
until it exits.
Initial patch by: attilio
Reviewed by: attilio, bde (some objections), arch (mostly silent)
Diffstat (limited to 'sys/kern/kern_clock.c')
-rw-r--r-- | sys/kern/kern_clock.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index ac404dc..0f7366a 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -394,10 +394,9 @@ stopprofclock(p) } /* - * Statistics clock. Grab profile sample, and if divider reaches 0, - * do process and kernel statistics. Most of the statistics are only - * used by user-level statistics programs. The main exceptions are - * ke->ke_uticks, p->p_rux.rux_sticks, p->p_rux.rux_iticks, and p->p_estcpu. + * Statistics clock. Updates rusage information and calls the scheduler + * to adjust priorities of the active thread. + * * This should be called by all active processors. */ void @@ -466,10 +465,9 @@ statclock(int usermode) sched_clock(td); /* Update resource usage integrals and maximums. */ - MPASS(p->p_stats != NULL); MPASS(p->p_vmspace != NULL); vm = p->p_vmspace; - ru = &p->p_stats->p_ru; + ru = &td->td_ru; ru->ru_ixrss += pgtok(vm->vm_tsize); ru->ru_idrss += pgtok(vm->vm_dsize); ru->ru_isrss += pgtok(vm->vm_ssize); |