summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2006-02-07 21:22:02 +0000
committerphk <phk@FreeBSD.org>2006-02-07 21:22:02 +0000
commitbb2f62f5367d29657fc52a4cfcd3573c39679b70 (patch)
tree95918de865b5c6e707ecd4ce458d058d287406e9 /sys/kern/subr_trap.c
parentc7f3a565d2e7b4fed16d19bfe4b300ca8ef7ad27 (diff)
downloadFreeBSD-src-bb2f62f5367d29657fc52a4cfcd3573c39679b70.zip
FreeBSD-src-bb2f62f5367d29657fc52a4cfcd3573c39679b70.tar.gz
Modify the way we account for CPU time spent (step 1)
Keep track of time spent by the cpu in various contexts in units of "cputicks" and scale to real-world microsec^H^H^H^H^H^H^H^Hclock_t only when somebody wants to inspect the numbers. For now "cputicks" are still derived from the current timecounter and therefore things should by definition remain sensible also on SMP machines. (The main reason for this first milestone commit is to verify that hypothesis.) On slower machines, the avoided multiplications to normalize timestams at every context switch, comes out as a 5-7% better score on the unixbench/context1 microbenchmark. On more modern hardware no change in performance is seen.
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 7b6c5b8..f4e0a53 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -238,7 +238,7 @@ ast(struct trapframe *framep)
PROC_LOCK(p);
lim_rlimit(p, RLIMIT_CPU, &rlim);
mtx_lock_spin(&sched_lock);
- if (p->p_rux.rux_runtime.sec >= rlim.rlim_max) {
+ if (p->p_rux.rux_runtime >= rlim.rlim_max * cpu_tickrate()) {
mtx_unlock_spin(&sched_lock);
killproc(p, "exceeded maximum CPU limit");
} else {
OpenPOWER on IntegriCloud