FreeBSD/contrib/bsnmp/snmp_mibII/mibII.c
/**
 * Recompute the poll timer for the HC counters
 */
Recompute the poll timer for the HC counters
Recompute the poll timer for the HC counters
void
mibif_reset_hc_timer(void)
{
	u_int ticks;
	if ((ticks = mibif_force_hc_update_interval) == 0) {
		if (mibif_maxspeed <= IF_Mbps(10)) {
			ticks = 3000 * 100;	
		} else if (mibif_maxspeed <= IF_Mbps(100)) {
			ticks = 300 * 100;	
		} else if (mibif_maxspeed < IF_Mbps(622)) {
			ticks = 40 * 100;	
		} else if (mibif_maxspeed <= IF_Mbps(1000)) {
			ticks = 20 * 100;	
		} else {
			ticks = 100;		
		}
	}
	if (ticks == mibif_hc_update_interval)
		return;
	if (hc_update_timer != NULL) {
		timer_stop(hc_update_timer);
		hc_update_timer = NULL;
	}
	update_hc_counters(NULL);
	if ((hc_update_timer = timer_start_repeat(ticks * 10, ticks * 10,
	    update_hc_counters, NULL, module)) == NULL) {
		syslog(LOG_ERR, "timer_start(%u): %m", ticks);
		return;
	}
	mibif_hc_update_interval = ticks;
}
void mibif_reset_hc_timer ( void ) { u_int ticks ; if ( ( ticks = mibif_force_hc_update_interval ) == 0 ) { if ( mibif_maxspeed <= IF_Mbps ( 10 ) ) { ticks = 3000 * 100 ; } else if ( mibif_maxspeed <= IF_Mbps ( 100 ) ) { ticks = 300 * 100 ; } else if ( mibif_maxspeed < IF_Mbps ( 622 ) ) { ticks = 40 * 100 ; } else if ( mibif_maxspeed <= IF_Mbps ( 1000 ) ) { ticks = 20 * 100 ; } else { ticks = 100 ; } } if ( ticks == mibif_hc_update_interval ) return ; if ( hc_update_timer != NULL ) { timer_stop ( hc_update_timer ) ; hc_update_timer = NULL ; } update_hc_counters ( NULL ) ; if ( ( hc_update_timer = timer_start_repeat ( ticks * 10 , ticks * 10 , update_hc_counters , NULL , module ) ) == NULL ) { syslog ( LOG_ERR , " " , ticks ) ; return ; } mibif_hc_update_interval = ticks ; }
Recompute the poll timer for the HC counters
Recompute the poll timer for the HC counters
/* at 10Mbps overflow needs 3436 seconds */ /* 50 minutes */ /* at 100Mbps overflow needs 343 seconds */ /* 5 minutes */ /* at 622Mbps overflow needs 53 seconds */ /* 40 seconds */ /* at 1Gbps overflow needs  34 seconds */ /* 20 seconds */ /* at 10Gbps overflow needs 3.4 seconds */ /* 1 seconds */