[scripts] AggCheck: -n prints transmitters

When called with -n, owlps-aggcheck now prints the transmitter of each
request as the first column.
Matteo Cypriani 10 years ago
parent a56a8d3d5d
commit 8c5e8c62f6

@ -45,7 +45,10 @@ Print signal strength distribution in CSV format.
=item B<-n>
Print per-request statistics in CSV format, as well as the total number of
packets received by each capture point.
packets received by each capture point. Please note that this display is ordered
by timestamp (unlike the default display which respects the order of the lines
in the input file); this might not correspond to the actual order of
transmission if the devices' clocks are not synchronised.
=item B<-v>
@ -89,6 +92,11 @@ use constant PREFIX_FIELDS => 9;
# Line number
my $line_nb = 0;
# Association between timestamp and transmitter of each request
# key = timestamp
# value = transmitter's MAC address
my %transmitters;
# Structure that holds the global count of packets
# key = timestamp
# value = dictionary {key = CP's MAC address
@ -231,6 +239,7 @@ while (<>) {
# Save the values for the stats
$transmitters{$timestamp} = $mac_trx;
$global_stats{$timestamp} = {%present_cps};
# Print the number of packets for each CP and count the number of CPs
@ -257,13 +266,13 @@ if ($print_stats) {
# Print the header line
my @cps_names = sort keys %global_present_cps;
print "Timestamp";
print "Transmitter;Timestamp";
print ";$_" foreach (@cps_names);
print "\n";
# Print the requests
foreach my $timestamp (sort keys %global_stats) {
print "$timestamp";
print "$transmitters{$timestamp};$timestamp";
my $present_cps = $global_stats{$timestamp};
# Print the CPs in the same order as in the header and count the totals
foreach my $mac (@cps_names) {
@ -275,7 +284,7 @@ if ($print_stats) {
# Print the totals
print "Total";
print "Total;";
print ";$total_nb_pkts{$_}" foreach (@cps_names);
print "\n";