FreeBSD/sys/kern/kern_tc.c
/*
 * Sub-routine to convert a time interval measured in RAW counter units to time
 * in seconds stored in bintime format.
 * NOTE: bintime_mul requires u_int, but the value of the ffcounter may be
 * larger than the max value of u_int (on 32 bit architecture). Loop to consume
 * extra cycles.
 */
Sub-routine to convert a time interval measured in RAW counter units to time
in seconds stored in bintime format.
NOTE: bintime_mul requires u_int, but the value of the ffcounter may be
larger than the max value of u_int (on 32 bit architecture). Loop to consume
extra cycles.
Sub - routine to convert a time interval measured in RAW counter units to time in seconds stored in bintime format . NOTE : bintime_mul requires u_int but the value of the ffcounter may be larger than the max value of u_int ( on 32 bit architecture ) . Loop to consume extra cycles .
static void
ffclock_convert_delta(ffcounter ffdelta, uint64_t period, struct bintime *bt)
{
	struct bintime bt2;
	ffcounter delta, delta_max;
	delta_max = (1ULL << (8 * sizeof(unsigned int))) - 1;
	bintime_clear(bt);
	do {
		if (ffdelta > delta_max)
			delta = delta_max;
		else
			delta = ffdelta;
		bt2.sec = 0;
		bt2.frac = period;
		bintime_mul(&bt2, (unsigned int)delta);
		bintime_add(bt, &bt2);
		ffdelta -= delta;
	} while (ffdelta > 0);
}
static void ffclock_convert_delta ( ffcounter ffdelta , uint64_t period , struct bintime * bt ) { struct bintime bt2 ; ffcounter delta , delta_max ; delta_max = ( 1ULL << ( 8 * sizeof ( unsigned int ) ) ) - 1 ; bintime_clear ( bt ) ; do { if ( ffdelta > delta_max ) delta = delta_max ; else delta = ffdelta ; bt2 . sec = 0 ; bt2 . frac = period ; bintime_mul ( & bt2 , ( unsigned int ) delta ) ; bintime_add ( bt , & bt2 ) ; ffdelta -= delta ; } while ( ffdelta > 0 ) ; }
Sub-routine to convert a time interval measured in RAW counter units to time
 in seconds stored in bintime format.
Sub - routine to convert a time interval measured in RAW counter units to time in seconds stored in bintime format .