Switch/ext/ebtree/ebtree/common/time.h
static inline void measure_idle()
{
	/* Let's compute the idle to work ratio. We worked between after_poll
	 * and before_poll, and slept between before_poll and date. The idle_pct
	 * is updated at most twice every second. Note that the current second
	 * rarely changes so we avoid a multiply when not needed.
	 */
	int delta;

	if ((delta = date.tv_sec - before_poll.tv_sec))
		delta *= 1000000;
	idle_time += delta + (date.tv_usec - before_poll.tv_usec);

	if ((delta = date.tv_sec - after_poll.tv_sec))
		delta *= 1000000;
	samp_time += delta + (date.tv_usec - after_poll.tv_usec);

	after_poll.tv_sec = date.tv_sec; after_poll.tv_usec = date.tv_usec;
	if (samp_time < 500000)
		return;

	idle_pct = (100 * idle_time + samp_time / 2) / samp_time;
	idle_time = samp_time = 0;
}
/* Update the idle time value twice a second, to be called after
 * tv_update_date() when called after poll(). It relies on <before_poll> to be
 * updated to the system time before calling poll().
 */
Update the idle time value twice a second, to be called after
tv_update_date() when called after poll(). It relies on  to be
updated to the system time before calling poll().
Update the idle time value twice a second to be called after tv_update_date () when called after poll () . It relies on to be updated to the system time before calling poll () .
static inline void measure_idle()
{
	int delta;
	if ((delta = date.tv_sec - before_poll.tv_sec))
		delta *= 1000000;
	idle_time += delta + (date.tv_usec - before_poll.tv_usec);
	if ((delta = date.tv_sec - after_poll.tv_sec))
		delta *= 1000000;
	samp_time += delta + (date.tv_usec - after_poll.tv_usec);
	after_poll.tv_sec = date.tv_sec; after_poll.tv_usec = date.tv_usec;
	if (samp_time < 500000)
		return;
	idle_pct = (100 * idle_time + samp_time / 2) / samp_time;
	idle_time = samp_time = 0;
}
static inline void measure_idle ( ) { int delta ; if ( ( delta = date . tv_sec - before_poll . tv_sec ) ) delta *= 1000000 ; idle_time += delta + ( date . tv_usec - before_poll . tv_usec ) ; if ( ( delta = date . tv_sec - after_poll . tv_sec ) ) delta *= 1000000 ; samp_time += delta + ( date . tv_usec - after_poll . tv_usec ) ; after_poll . tv_sec = date . tv_sec ; after_poll . tv_usec = date . tv_usec ; if ( samp_time < 500000 ) return ; idle_pct = ( 100 * idle_time + samp_time / 2 ) / samp_time ; idle_time = samp_time = 0 ; }
Update the idle time value twice a second, to be called after
 tv_update_date() when called after poll().
Update the idle time value twice a second to be called after tv_update_date () when called after poll () .
/* Let's compute the idle to work ratio. We worked between after_poll
	 * and before_poll, and slept between before_poll and date. The idle_pct
	 * is updated at most twice every second. Note that the current second
	 * rarely changes so we avoid a multiply when not needed.
	 */