diff options
author | jake <jake@FreeBSD.org> | 2003-02-03 17:53:15 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2003-02-03 17:53:15 +0000 |
commit | 6b3763a173b458d3138f8a5ae81d7574349cc99d (patch) | |
tree | 4ac2b707510b8d738855f9fa4a6576e6ded49a77 /sys/isa/atrtc.c | |
parent | 9689f0580db3e8ffcfba46b99c0b3a370eb9524c (diff) | |
download | FreeBSD-src-6b3763a173b458d3138f8a5ae81d7574349cc99d.zip FreeBSD-src-6b3763a173b458d3138f8a5ae81d7574349cc99d.tar.gz |
Split statclock into statclock and profclock, and made the method for driving
statclock based on profhz when profiling is enabled MD, since most platforms
don't use this anyway. This removes the need for statclock_process, whose
only purpose was to subdivide profhz, and gets the profiling clock running
outside of sched_lock on platforms that implement suswintr.
Also changed the interface for starting and stopping the profiling clock to
do just that, instead of changing the rate of statclock, since they can now
be separate.
Reviewed by: jhb, tmm
Tested on: i386, sparc64
Diffstat (limited to 'sys/isa/atrtc.c')
-rw-r--r-- | sys/isa/atrtc.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 98ef6f78..8e812a1 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -130,6 +130,8 @@ static void setup_8254_mixed_mode(void); int adjkerntz; /* local offset from GMT in seconds */ int clkintr_pending; int disable_rtc_set; /* disable resettodr() if != 0 */ +int pscnt = 1; +int psdiv = 1; int statclock_disable; #ifndef TIMER_FREQ #define TIMER_FREQ 1193182 @@ -380,7 +382,13 @@ static void rtcintr(struct clockframe frame) { while (rtcin(RTC_INTR) & RTCIR_PERIOD) { - statclock(&frame); + if (profprocs != 0) { + if (--pscnt == 0) + pscnt = psdiv; + profclock(&frame); + } + if (pscnt == psdiv) + statclock(&frame); #ifdef SMP forward_statclock(); #endif @@ -1169,13 +1177,21 @@ setup_8254_mixed_mode() #endif void -setstatclockrate(int newhz) +cpu_startprofclock(void) { - if (newhz == RTC_PROFRATE) - rtc_statusa = RTCSA_DIVIDER | RTCSA_PROF; - else - rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; + + rtc_statusa = RTCSA_DIVIDER | RTCSA_PROF; + writertc(RTC_STATUSA, rtc_statusa); + psdiv = pscnt = psratio; +} + +void +cpu_stopprofclock(void) +{ + + rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; writertc(RTC_STATUSA, rtc_statusa); + psdiv = pscnt = 1; } static int |