summaryrefslogtreecommitdiffstats
path: root/sys/mips/mips/tick.c
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2010-05-28 02:00:15 +0000
committerneel <neel@FreeBSD.org>2010-05-28 02:00:15 +0000
commitbc054a3a486027065ffff36224710be3038b6c5e (patch)
tree1776a0b229c22da40ee55648f6f59a642ee84a29 /sys/mips/mips/tick.c
parentb4dba7d518c74ff7f86fdbc12ab24570478f06c3 (diff)
downloadFreeBSD-src-bc054a3a486027065ffff36224710be3038b6c5e.zip
FreeBSD-src-bc054a3a486027065ffff36224710be3038b6c5e.tar.gz
If 'timer2hz' is zero then we don't need to call 'timer2clock()' directly. It
will be called automatically by 'timer1clock()'. Do profiling as often as possible by running it as the same frequency as 'timer1hz'. The statistics clock is run as close to 128Hz as possible. Pointed out by: mav@
Diffstat (limited to 'sys/mips/mips/tick.c')
-rw-r--r--sys/mips/mips/tick.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/mips/mips/tick.c b/sys/mips/mips/tick.c
index 51270b4..5432c42 100644
--- a/sys/mips/mips/tick.c
+++ b/sys/mips/mips/tick.c
@@ -127,9 +127,6 @@ void
mips_timer_init_params(uint64_t platform_counter_freq, int double_count)
{
- stathz = hz;
- profhz = hz;
-
/*
* XXX: Do not use printf here: uart code 8250 may use DELAY so this
* function should be called before cninit.
@@ -143,6 +140,17 @@ mips_timer_init_params(uint64_t platform_counter_freq, int double_count)
if (double_count != 0)
counter_freq /= 2;
+ /*
+ * We want to run stathz in the neighborhood of 128hz. We would
+ * like profhz to run as often as possible, so we let it run on
+ * each clock tick. We try to honor the requested 'hz' value as
+ * much as possible.
+ *
+ * If 'hz' is above 1500, then we just let the timer
+ * (and profhz) run at hz. If 'hz' is below 1500 but above
+ * 750, then we let the timer run at 2 * 'hz'. If 'hz'
+ * is below 750 then we let the timer run at 4 * 'hz'.
+ */
if (hz >= 1500)
timer1hz = hz;
else if (hz >= 750)
@@ -150,6 +158,12 @@ mips_timer_init_params(uint64_t platform_counter_freq, int double_count)
else
timer1hz = hz * 4;
+ if (timer1hz < 128)
+ stathz = timer1hz;
+ else
+ stathz = timer1hz / (timer1hz / 128);
+ profhz = timer1hz;
+
cycles_per_tick = counter_freq / timer1hz;
cycles_per_usec = counter_freq / (1 * 1000 * 1000);
@@ -285,7 +299,6 @@ clock_intr(void *arg)
while (lost_ticks >= cycles_per_tick) {
timer1clock(TRAPF_USERMODE(tf), tf->pc);
- timer2clock(TRAPF_USERMODE(tf), tf->pc);
lost_ticks -= cycles_per_tick;
}
DPCPU_SET(lost_ticks, lost_ticks);
@@ -301,7 +314,6 @@ clock_intr(void *arg)
(*cyclic_clock_func[cpu])(tf);
#endif
timer1clock(TRAPF_USERMODE(tf), tf->pc);
- timer2clock(TRAPF_USERMODE(tf), tf->pc);
critical_exit();
return (FILTER_HANDLED);
}
OpenPOWER on IntegriCloud