sources/bind9/lib/dns/rbtdb.c
/*%
 * Work out how many nodes can be deleted in the time between two
 * requests to the nameserver.  Smooth the resulting number and use it
 * as a estimate for the number of nodes to be deleted in the next
 * iteration.
 */
%
Work out how many nodes can be deleted in the time between two
requests to the nameserver.  Smooth the resulting number and use it
as a estimate for the number of nodes to be deleted in the next
iteration.
% Work out how many nodes can be deleted in the time between two requests to the nameserver . Smooth the resulting number and use it as a estimate for the number of nodes to be deleted in the next iteration .
static unsigned int
adjust_quantum(unsigned int old, isc_time_t *start) {
	unsigned int pps = dns_pps;     
	unsigned int interval;
	isc_uint64_t usecs;
	isc_time_t end;
	unsigned int new;
	if (pps < 100)
		pps = 100;
	isc_time_now(&end);
	interval = 1000000 / pps;       
	if (interval == 0)
		interval = 1;
	usecs = isc_time_microdiff(&end, start);
	if (usecs == 0) {
		old *= 2;
		if (old > 1000)
			old = 1000;
		return (old);
	}
	new = old * interval;
	new /= (unsigned int)usecs;
	if (new == 0)
		new = 1;
	else if (new > 1000)
		new = 1000;
	new = (new + old * 3) / 4;
	isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE,
		      ISC_LOG_DEBUG(1), "adjust_quantum -> %d", new);
	return (new);
}
static unsigned int adjust_quantum ( unsigned int old , isc_time_t * start ) { unsigned int pps = dns_pps ; unsigned int interval ; isc_uint64_t usecs ; isc_time_t end ; unsigned int new ; if ( pps < 100 ) pps = 100 ; isc_time_now ( & end ) ; interval = 1000000 / pps ; if ( interval == 0 ) interval = 1 ; usecs = isc_time_microdiff ( & end , start ) ; if ( usecs == 0 ) { old *= 2 ; if ( old > 1000 ) old = 1000 ; return ( old ) ; } new = old * interval ; new /= ( unsigned int ) usecs ; if ( new == 0 ) new = 1 ; else if ( new > 1000 ) new = 1000 ; new = ( new + old * 3 ) / 4 ; isc_log_write ( dns_lctx , DNS_LOGCATEGORY_DATABASE , DNS_LOGMODULE_CACHE , ISC_LOG_DEBUG ( 1 ) , " " , new ) ; return ( new ) ; }
%
 Work out how many nodes can be deleted in the time between two
 requests to the nameserver.
% Work out how many nodes can be deleted in the time between two requests to the nameserver .
/* packets per second */ /* interval in usec */ /*
		 * We were unable to measure the amount of time taken.
		 * Double the nodes deleted next time.
		 */ /* Smooth */