FreeBSD/sys/kern/kern_tc.c
/*
 * Absolute clock conversion. Low level function to convert ffcounter to
 * bintime. The ffcounter is converted using the current ffclock period estimate
 * or the "interpolated period" to ensure monotonicity.
 * NOTE: this conversion may have been deferred, and the clock updated since the
 * hardware counter has been read.
 */
Absolute clock conversion. Low level function to convert ffcounter to
bintime. The ffcounter is converted using the current ffclock period estimate
or the "interpolated period" to ensure monotonicity.
NOTE: this conversion may have been deferred, and the clock updated since the
hardware counter has been read.
Absolute clock conversion . Low level function to convert ffcounter to bintime . The ffcounter is converted using the current ffclock period estimate or the " interpolated period " to ensure monotonicity . NOTE : this conversion may have been deferred and the clock updated since the hardware counter has been read .
void
ffclock_convert_abs(ffcounter ffcount, struct bintime *bt, uint32_t flags)
{
	struct fftimehands *ffth;
	struct bintime bt2;
	ffcounter ffdelta;
	uint8_t gen;
	do {
		ffth = fftimehands;
		gen = ffth->gen;
		if (ffcount > ffth->tick_ffcount)
			ffdelta = ffcount - ffth->tick_ffcount;
		else
			ffdelta = ffth->tick_ffcount - ffcount;
		if ((flags & FFCLOCK_LERP) == FFCLOCK_LERP) {
			*bt = ffth->tick_time_lerp;
			ffclock_convert_delta(ffdelta, ffth->period_lerp, &bt2);
		} else {
			*bt = ffth->tick_time;
			ffclock_convert_delta(ffdelta, ffth->cest.period, &bt2);
		}
		if (ffcount > ffth->tick_ffcount)
			bintime_add(bt, &bt2);
		else
			bintime_sub(bt, &bt2);
	} while (gen == 0 || gen != ffth->gen);
}
void ffclock_convert_abs ( ffcounter ffcount , struct bintime * bt , uint32_t flags ) { struct fftimehands * ffth ; struct bintime bt2 ; ffcounter ffdelta ; uint8_t gen ; do { ffth = fftimehands ; gen = ffth -> gen ; if ( ffcount > ffth -> tick_ffcount ) ffdelta = ffcount - ffth -> tick_ffcount ; else ffdelta = ffth -> tick_ffcount - ffcount ; if ( ( flags & FFCLOCK_LERP ) == FFCLOCK_LERP ) { * bt = ffth -> tick_time_lerp ; ffclock_convert_delta ( ffdelta , ffth -> period_lerp , & bt2 ) ; } else { * bt = ffth -> tick_time ; ffclock_convert_delta ( ffdelta , ffth -> cest . period , & bt2 ) ; } if ( ffcount > ffth -> tick_ffcount ) bintime_add ( bt , & bt2 ) ; else bintime_sub ( bt , & bt2 ) ; } while ( gen == 0 || gen != ffth -> gen ) ; }
Absolute clock conversion.
Absolute clock conversion .
/*
	 * No locking but check generation has not changed. Also need to make
	 * sure ffdelta is positive, i.e. ffcount > tick_ffcount.
	 */