summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clocksource.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2012-03-10 14:57:21 +0000
committermav <mav@FreeBSD.org>2012-03-10 14:57:21 +0000
commit1324baa4ebfff886fe68bbe354f9d6b82bfd7d82 (patch)
tree8b2b5ba74f47f4a3fabe3b9c70eb58891290db16 /sys/kern/kern_clocksource.c
parenta0d48d6f11620836250fbc0f703a3e2a00ddbe4c (diff)
downloadFreeBSD-src-1324baa4ebfff886fe68bbe354f9d6b82bfd7d82.zip
FreeBSD-src-1324baa4ebfff886fe68bbe354f9d6b82bfd7d82.tar.gz
Idle ticks optimization:
- Pass number of events to the statclock() and profclock() functions same as to hardclock() before to not call them many times in a loop. - Rename them into statclock_cnt() and profclock_cnt(). - Turn statclock() and profclock() into compatibility wrappers, still needed for arm. - Rename hardclock_anycpu() into hardclock_cnt() for unification. MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_clocksource.c')
-rw-r--r--sys/kern/kern_clocksource.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c
index d94157c..2217610 100644
--- a/sys/kern/kern_clocksource.c
+++ b/sys/kern/kern_clocksource.c
@@ -195,28 +195,34 @@ handleevents(struct bintime *now, int fake)
pc = TRAPF_PC(frame);
}
- runs = 0;
state = DPCPU_PTR(timerstate);
+ runs = 0;
while (bintime_cmp(now, &state->nexthard, >=)) {
bintime_add(&state->nexthard, &hardperiod);
runs++;
}
if (runs && fake < 2) {
- hardclock_anycpu(runs, usermode);
+ hardclock_cnt(runs, usermode);
done = 1;
}
+ runs = 0;
while (bintime_cmp(now, &state->nextstat, >=)) {
- if (fake < 2)
- statclock(usermode);
bintime_add(&state->nextstat, &statperiod);
+ runs++;
+ }
+ if (runs && fake < 2) {
+ statclock_cnt(runs, usermode);
done = 1;
}
if (profiling) {
+ runs = 0;
while (bintime_cmp(now, &state->nextprof, >=)) {
- if (!fake)
- profclock(usermode, pc);
bintime_add(&state->nextprof, &profperiod);
+ runs++;
+ }
+ if (runs && !fake) {
+ profclock_cnt(runs, usermode, pc);
done = 1;
}
} else
OpenPOWER on IntegriCloud