diff options
author | phk <phk@FreeBSD.org> | 2006-02-08 08:09:17 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2006-02-08 08:09:17 +0000 |
commit | 74f8e63a104485f17205e2a3e446e00f968c324c (patch) | |
tree | dcc7f358367ea74ccf47cede57e272875e9b589d /sys/kern | |
parent | 4d8070a25b5c7585b416e8a3db16fc15f2e3cd13 (diff) | |
download | FreeBSD-src-74f8e63a104485f17205e2a3e446e00f968c324c.zip FreeBSD-src-74f8e63a104485f17205e2a3e446e00f968c324c.tar.gz |
Simplify system time accounting for profiling.
Rename struct thread's td_sticks to td_pticks, we will need the
other name for more appropriately named use shortly. Reduce it
from uint64_t to u_int.
Clear td_pticks whenever we enter the kernel instead of recording
its value as reference for userret(). Use the absolute value of
td->pticks in userret() and eliminate third argument.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_clock.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 2 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 14 |
3 files changed, 6 insertions, 12 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 33336b9..0316c3e 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -440,7 +440,7 @@ statclock(int usermode) } else { if (p->p_flag & P_SA) thread_statclock(0); - td->td_sticks++; + td->td_pticks++; p->p_rux.rux_sticks++; if (td != PCPU_GET(idlethread)) cp_time[CP_SYS]++; diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index bbaac6c..dfbd315 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -825,7 +825,7 @@ fork_return(td, frame) struct trapframe *frame; { - userret(td, frame, 0); + userret(td, frame); #ifdef KTRACE if (KTRPOINT(td, KTR_SYSRET)) ktrsysret(SYS_fork, 0, 0); diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index f4e0a53..686f613 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -74,10 +74,7 @@ __FBSDID("$FreeBSD$"); * MPSAFE */ void -userret(td, frame, oticks) - struct thread *td; - struct trapframe *frame; - u_int oticks; +userret(struct thread *td, struct trapframe *frame) { struct proc *p = td->td_proc; @@ -127,10 +124,8 @@ userret(td, frame, oticks) * Charge system time if profiling. */ if (p->p_flag & P_PROFIL) { - quad_t ticks; - ticks = td->td_sticks - oticks; - addupc_task(td, TRAPF_PC(frame), (u_int)ticks * psratio); + addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio); } /* @@ -153,7 +148,6 @@ ast(struct trapframe *framep) struct proc *p; struct ksegrp *kg; struct rlimit rlim; - u_int sticks; int sflag; int flags; int sig; @@ -173,7 +167,7 @@ ast(struct trapframe *framep) mtx_assert(&Giant, MA_NOTOWNED); mtx_assert(&sched_lock, MA_NOTOWNED); td->td_frame = framep; - sticks = td->td_sticks; + td->td_pticks = 0; if ((p->p_flag & P_SA) && (td->td_mailbox == NULL)) thread_user_enter(td); @@ -276,6 +270,6 @@ ast(struct trapframe *framep) PROC_UNLOCK(p); } - userret(td, framep, sticks); + userret(td, framep); mtx_assert(&Giant, MA_NOTOWNED); } |