Skip to content

Commit

Permalink
Stats Improvement
Browse files Browse the repository at this point in the history
Agent informs if the non-Wi-5 equipment is AP or STA using FROM_DS flag
  • Loading branch information
rubenmunilla committed Jul 25, 2017
1 parent 9b5ab1d commit bac9e0f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
Binary file modified click_binary_file/click_for_AR71xx
Binary file not shown.
41 changes: 35 additions & 6 deletions src/odinagent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ OdinAgent::OdinAgent()
_tx_power(0),
_hidden(0),
_multichannel_agents(1),
_interval_ms_default(100), // Inter-Beacon Interval for normal mode
_interval_ms_burst(10) // Inter-Beacon Interval for burst mode
_interval_ms_default(10), // Inter-Beacon Interval for normal mode
_interval_ms_burst(10) // Inter-Beacon Interval for burst mode
{
_clean_stats_timer.assign(&cleanup_lvap, (void *) this);
_general_timer.assign (&misc_thread, (void *) this);
Expand Down Expand Up @@ -1456,6 +1456,7 @@ OdinAgent::update_tx_stats(Packet *p)

// store the timestamp of this packet as the one of the last packet
stat._time_last_packet.assign_now();
stat._equipment = "AP";

/*
if (_debug_level % 10 > 1){
Expand Down Expand Up @@ -1531,6 +1532,17 @@ OdinAgent::update_rx_stats(Packet *p)
fclose(fp);
}
*/

uint8_t fromDs;

fromDs = w->i_fc[1] & WIFI_FC1_DIR_FROMDS;

if (fromDs == WIFI_FC1_DIR_FROMDS) {
stat._equipment = "AP";

}else{
stat._equipment = "STA";
}
match_against_subscriptions(stat, src);

// update the statistics table
Expand Down Expand Up @@ -1592,6 +1604,17 @@ OdinAgent::update_scanned_station_stats(Packet *p)
// store the timestamp of this packet as the one of the last packet
stat._time_last_packet.assign_now();

uint8_t fromDs;

fromDs = w->i_fc[1] & WIFI_FC1_DIR_FROMDS;

if (fromDs == WIFI_FC1_DIR_FROMDS) {
stat._equipment = "AP";

}else{
stat._equipment = "STA";
}

// update the statistics table
_scanned_station_stats.set (src, stat);
}
Expand Down Expand Up @@ -2117,7 +2140,9 @@ OdinAgent::read_handler(Element *e, void *user_data)
sa << " air_time:" << n._air_time; // time in seconds

sa << " first_received:" << n._time_first_packet; // time in long format
sa << " last_received:" << n._time_last_packet << "\n"; // time in long format
sa << " last_received:" << n._time_last_packet; // time in long format

sa << " equipment:" << n._equipment << "\n"; // type of equipment

stats_time = n._time_last_packet;
agent->_tx_stats.find(iter.key()).value() = reset_stats;
Expand Down Expand Up @@ -2150,7 +2175,9 @@ OdinAgent::read_handler(Element *e, void *user_data)
sa << " air_time:" << n._air_time; // time in seconds

sa << " first_received:" << n._time_first_packet; // time in long format
sa << " last_received:" << n._time_last_packet << "\n"; // time in long format
sa << " last_received:" << n._time_last_packet; // time in long format

sa << " equipment:" << n._equipment << "\n"; // type of equipment

stats_time = n._time_last_packet;
agent->_rx_stats.find(iter.key()).value() = reset_stats;
Expand Down Expand Up @@ -2219,7 +2246,9 @@ OdinAgent::read_handler(Element *e, void *user_data)
sa << " air_time:" << n._air_time; // time in seconds

sa << " first_received:" << n._time_first_packet; // time in long format
sa << " last_received:" << n._time_last_packet << "\n"; // time in long format
sa << " last_received:" << n._time_last_packet; // time in long format

sa << " equipment:" << n._equipment << "\n"; // type of equipment

}
}
Expand Down Expand Up @@ -3059,4 +3088,4 @@ OdinAgent::convert_channel_to_frequency(int chan) {

CLICK_ENDDECLS
EXPORT_ELEMENT(OdinAgent)
ELEMENT_REQUIRES(userlevel)
ELEMENT_REQUIRES(userlevel)
3 changes: 2 additions & 1 deletion src/odinagent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public:
double _air_time; //airtime consumed by this STA, calculated as 8 * _len_pkt / _rate
Timestamp _time_first_packet; //timestamp of the first packet included in the statistics
Timestamp _time_last_packet; //timestamp of the last packet included in the statistics
String _equipment; //identify the equipment that transmit
StationStats() {
memset(this, 0, sizeof(*this));
}
Expand Down Expand Up @@ -261,4 +262,4 @@ private:


CLICK_ENDDECLS
#endif
#endif

0 comments on commit bac9e0f

Please sign in to comment.