diff options
author | Jake Burkholder <jake@FreeBSD.org> | 2003-02-03 17:53:15 +0000 |
---|---|---|
committer | Jake Burkholder <jake@FreeBSD.org> | 2003-02-03 17:53:15 +0000 |
commit | 238dd3209a205ba106527c7bc3cc617874f23b10 (patch) | |
tree | 4ac2b707510b8d738855f9fa4a6576e6ded49a77 /sys/isa/atrtc.c | |
parent | ca26842e2af2aee467420feb874f83627c5c7027 (diff) | |
download | src-238dd3209a205ba106527c7bc3cc617874f23b10.tar.gz src-238dd3209a205ba106527c7bc3cc617874f23b10.zip |
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
Notes
Notes:
svn path=/head/; revision=110296
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 98ef6f78b0b3..8e812a1c09f2 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 |