FreeBSD/sys/x86/isa/atrtc.c
/*
 * This routine receives statistical clock interrupts from the RTC.
 * As explained above, these occur at 128 interrupts per second.
 * When profiling, we receive interrupts at a rate of 1024 Hz.
 *
 * This does not actually add as much overhead as it sounds, because
 * when the statistical clock is active, the hardclock driver no longer
 * needs to keep (inaccurate) statistics on its own.  This decouples
 * statistics gathering from scheduling interrupts.
 *
 * The RTC chip requires that we read status register C (RTC_INTR)
 * to acknowledge an interrupt, before it will generate the next one.
 * Under high interrupt load, rtcintr() can be indefinitely delayed and
 * the clock can tick immediately after the read from RTC_INTR.  In this
 * case, the mc146818A interrupt signal will not drop for long enough
 * to register with the 8259 PIC.  If an interrupt is missed, the stat
 * clock will halt, considerably degrading system performance.  This is
 * why we use 'while' rather than a more straightforward 'if' below.
 * Stat clock ticks can still be lost, causing minor loss of accuracy
 * in the statistics, but the stat clock will no longer stop.
 */
This routine receives statistical clock interrupts from the RTC.
As explained above, these occur at 128 interrupts per second.
When profiling, we receive interrupts at a rate of 1024 Hz.

This does not actually add as much overhead as it sounds, because
when the statistical clock is active, the hardclock driver no longer
needs to keep (inaccurate) statistics on its own.  This decouples
statistics gathering from scheduling interrupts.

The RTC chip requires that we read status register C (RTC_INTR)
to acknowledge an interrupt, before it will generate the next one.
Under high interrupt load, rtcintr() can be indefinitely delayed and
the clock can tick immediately after the read from RTC_INTR.  In this
case, the mc146818A interrupt signal will not drop for long enough
to register with the 8259 PIC.  If an interrupt is missed, the stat
clock will halt, considerably degrading system performance.  This is
why we use 'while' rather than a more straightforward 'if' below.
Stat clock ticks can still be lost, causing minor loss of accuracy
in the statistics, but the stat clock will no longer stop.
This routine receives statistical clock interrupts from the RTC . As explained above these occur at 128 interrupts per second . When profiling we receive interrupts at a rate of 1024 Hz . This does not actually add as much overhead as it sounds because when the statistical clock is active the hardclock driver no longer needs to keep ( inaccurate ) statistics on its own . This decouples statistics gathering from scheduling interrupts . The RTC chip requires that we read status register C ( RTC_INTR ) to acknowledge an interrupt before it will generate the next one . Under high interrupt load rtcintr () can be indefinitely delayed and the clock can tick immediately after the read from RTC_INTR . In this case the mc146818A interrupt signal will not drop for long enough to register with the 8259 PIC . If an interrupt is missed the stat clock will halt considerably degrading system performance . This is why we use ' while ' rather than a more straightforward ' if ' below . Stat clock ticks can still be lost causing minor loss of accuracy in the statistics but the stat clock will no longer stop .
static int
rtc_intr(void *arg)
{
	struct atrtc_softc *sc = (struct atrtc_softc *)arg;
	int flag = 0;
	while (rtcin(RTC_INTR) & RTCIR_PERIOD) {
		flag = 1;
		if (sc->et.et_active)
			sc->et.et_event_cb(&sc->et, sc->et.et_arg);
	}
	return(flag ? FILTER_HANDLED : FILTER_STRAY);
}
static int rtc_intr ( void * arg ) { struct atrtc_softc * sc = ( struct atrtc_softc * ) arg ; int flag = 0 ; while ( rtcin ( RTC_INTR ) & RTCIR_PERIOD ) { flag = 1 ; if ( sc -> et . et_active ) sc -> et . et_event_cb ( & sc -> et , sc -> et . et_arg ) ; } return ( flag ? FILTER_HANDLED : FILTER_STRAY ) ; }
This routine receives statistical clock interrupts from the RTC.
This routine receives statistical clock interrupts from the RTC .