DEBUG_CHATTER("[MeasurementsWifi %s] Received packet of length %d from %s (route %s). Sizes: click_wifi=%d, acne=%d", Timestamp::now().unparse().c_str(),
DEBUG_CHATTER("[MeasurementsWifi %s] Token %d has expired", _now.unparse().c_str(), it.key());
token_timeout.push_back(it.key());
}
}
for(int i=0;i<token_timeout.size();i++)
clear_counters(token_timeout[i]);
if(_active_tokens.size() == 0)
reinitialize_counters();
reinitialize_counters(token);
//_iw_survey_begin = exec("iw dev wlan0 survey dump|grep \"in use\" -A 5");
#ifdef __linux
netlink_main();
#endif
if (interval > 0) // if interval == 0, compute_airtime() must be triggered
_get_airtime_timer.schedule_after_msec(interval);
_active_tokens.set(token,_now);
_active_begin.set(token, _active_loc);
_busy_begin.set(token, _busy_loc);
DEBUG_CHATTER("[MeasurementsWifi %s] Initialization of airtime for token %d (%d tokens active): new active %lld, new busy %lld. Timer will fire in %d ms...",
// add an estimation of backoff: - first suppose unsaturated traffic (avg backoff is (CW-1)/2 = 7.5)
// - if above threshold, use Bianchi's model for avg backoff when saturated
gamma_type backoff_coeff;
//gamma_type backoff_time;
//backoff_time = int_divide((nb_data - nb_data_init[token])*array_backoff_times_bianchi_wifi[0]*9,100*1000); // slot time of 9us; divided by 100 for backoff scaling
//backoff_time = 0;
/*
if (((GAMMA_SCALE*(busy+backoff_time)) / (active_end - active_begin)) < SATURATED_THRES) {
busy += backoff_time;
_now.assign_now();
String str = "[MeasurementsWifi "+_now.unparse()+"] Compute airtime (done in "+(_now-begin_ts).unparse()+"s) with unsaturated conditions, "+String(nb_data)+" packets: busy "+String(busy)+
" ms (backoff "+String(backoff_time)+"ms), active "+String(active_end - active_begin)+" ms";
String str = "Airtime for token "+String(token)+" is "+String(_airtime[token])+" (done in "+(_now-begin_ts).unparse()+"s, "+String(_active_tokens.size()-1)+
" tokens still active) with "+String(nb_STAs+1)+" stations contending, backoff is "+String(backoff_coeff)+"), "
+packets_str.take_string()+": busy "+String(busy)+" ms ("+String(_busy_end[token] - _busy_begin[token])+" from iw), active "+String(active)+" ms.";