new: observing and reporting total number of peers met per each epoch

This commit is contained in:
Simone Margaritelli 2019-10-24 15:18:04 +02:00
parent 30f9c16778
commit 608aad4820

View File

@ -37,6 +37,8 @@ class Epoch(object):
self.num_hops = 0 self.num_hops = 0
# number of seconds sleeping # number of seconds sleeping
self.num_slept = 0 self.num_slept = 0
# number of peers seen during this epoch
self.num_peers = 0
# any activity at all during this epoch? # any activity at all during this epoch?
self.any_activity = False self.any_activity = False
# when the current epoch started # when the current epoch started
@ -74,10 +76,11 @@ class Epoch(object):
else: else:
self.blind_for = 0 self.blind_for = 0
self.num_peers = len(peers)
num_aps = len(aps) + 1e-10 num_aps = len(aps) + 1e-10
num_sta = sum(len(ap['clients']) for ap in aps) + 1e-10 num_sta = sum(len(ap['clients']) for ap in aps) + 1e-10
num_peers = len(peers) + 1e-10 num_peers = self.num_peers + 1e-10 # avoid division by 0
aps_per_chan = [0.0] * wifi.NumChannels aps_per_chan = [0.0] * wifi.NumChannels
sta_per_chan = [0.0] * wifi.NumChannels sta_per_chan = [0.0] * wifi.NumChannels
peers_per_chan = [0.0] * wifi.NumChannels peers_per_chan = [0.0] * wifi.NumChannels
@ -162,6 +165,7 @@ class Epoch(object):
'active_for_epochs': self.active_for, 'active_for_epochs': self.active_for,
'missed_interactions': self.num_missed, 'missed_interactions': self.num_missed,
'num_hops': self.num_hops, 'num_hops': self.num_hops,
'num_peers': self.num_peers,
'num_deauths': self.num_deauths, 'num_deauths': self.num_deauths,
'num_associations': self.num_assocs, 'num_associations': self.num_assocs,
'num_handshakes': self.num_shakes, 'num_handshakes': self.num_shakes,
@ -173,7 +177,7 @@ class Epoch(object):
self._epoch_data['reward'] = self._reward(self.epoch + 1, self._epoch_data) self._epoch_data['reward'] = self._reward(self.epoch + 1, self._epoch_data)
self._epoch_data_ready.set() self._epoch_data_ready.set()
logging.info("[epoch %d] duration=%s slept_for=%s blind=%d inactive=%d active=%d hops=%d missed=%d " logging.info("[epoch %d] duration=%s slept_for=%s blind=%d inactive=%d active=%d peers=%d hops=%d missed=%d "
"deauths=%d assocs=%d handshakes=%d cpu=%d%% mem=%d%% temperature=%dC reward=%s" % ( "deauths=%d assocs=%d handshakes=%d cpu=%d%% mem=%d%% temperature=%dC reward=%s" % (
self.epoch, self.epoch,
utils.secs_to_hhmmss(self.epoch_duration), utils.secs_to_hhmmss(self.epoch_duration),
@ -181,6 +185,7 @@ class Epoch(object):
self.blind_for, self.blind_for,
self.inactive_for, self.inactive_for,
self.active_for, self.active_for,
self.num_peers,
self.num_hops, self.num_hops,
self.num_missed, self.num_missed,
self.num_deauths, self.num_deauths,
@ -195,6 +200,7 @@ class Epoch(object):
self.epoch_started = now self.epoch_started = now
self.did_deauth = False self.did_deauth = False
self.num_deauths = 0 self.num_deauths = 0
self.num_peers = 0
self.did_associate = False self.did_associate = False
self.num_assocs = 0 self.num_assocs = 0
self.num_missed = 0 self.num_missed = 0