# Print the results print("\nExample 2: Tx MPDU Counts:"); print("{0:18}\t{1:>7}\t{2:>10}\t{3}".format( "Dest Addr", "# Pkts", "# Bytes", "MAC Addr Type")) for k in sorted(tx_counts.keys()): # Use the string version of the MAC address as the key for readability print("{0:18}\t{1:>7}\t{2:>10}\t{3}".format( wlan_exp_util.mac_addr_to_str(k), tx_counts[k][0], tx_counts[k][1], wlan_exp_util.mac_addr_desc(k))) ################################################################################################# # Example 3: Calculate total number of packets and bytes received from each distinct MAC address # Skip this example if the log doesn't contain RX events if('RX_OFDM' in log_np.keys()): # Extract all receptions log_rx = log_np['RX_OFDM'] # For this experiment, only look at Good = 0 or Bad = 1 receptions # Extract only Rx entries with good checksum (FCS = good) rx_good_fcs = log_rx[log_rx['fcs_result'] == log_entry_types['RX_OFDM'].consts['FCS_GOOD']] # Extract addr2 field from all good packets
# Print the results if (tx == 'TX_HIGH'): print("\nExample 2: Tx Counts (CPU High):") else: print( "\nExample 2: Tx Counts (CPU Low - includes retransmissions):") print("{0:18}\t{1:>7}\t{2:>10}\t{3}".format("Dest Addr", "# Pkts", "# Bytes", "MAC Addr Type")) for k in sorted(tx_counts.keys()): # Use the string version of the MAC address as the key for readability print("{0:18}\t{1:>7}\t{2:>10}\t{3}".format( wlan_exp_util.mac_addr_to_str(k), tx_counts[k][0], tx_counts[k][1], wlan_exp_util.mac_addr_desc(k))) ################################################################################################# # Example 3: Calculate total number of packets and bytes received from each distinct MAC address # Skip this example if the log doesn't contain RX events if ('RX_OFDM' in log_np.keys()): # Extract all receptions log_rx = log_np['RX_OFDM'] # Get RX_OFDM entry constants RX_CONSTS = log_util.get_entry_constants('RX_OFDM') # Extract only Rx entries with: # - Good checksum (FCS = good)
# Count the number of bytes to this address tx_bytes_to_addr = np.sum(log_tx['length'][addr_idx]) # Record the results in the output dictionary tx_counts[addr] = (tx_pkts_to_addr, tx_bytes_to_addr) # Print the results print("\nExample 2: Tx MPDU Counts:") print("{0:18}\t{1:>7}\t{2:>10}\t{3}".format("Dest Addr", "# Pkts", "# Bytes", "MAC Addr Type")) for k in sorted(tx_counts.keys()): # Use the string version of the MAC address as the key for readability print("{0:18}\t{1:>7}\t{2:>10}\t{3}".format( wlan_exp_util.mac_addr_to_str(k), tx_counts[k][0], tx_counts[k][1], wlan_exp_util.mac_addr_desc(k))) ################################################################################################# # Example 3: Calculate total number of packets and bytes received from each distinct MAC address # Skip this example if the log doesn't contain RX events if ('RX_OFDM' in log_np.keys()): # Extract all receptions log_rx = log_np['RX_OFDM'] # For this experiment, only look at Good = 0 or Bad = 1 receptions # Extract only Rx entries with good checksum (FCS = good) rx_good_fcs = log_rx[log_rx['fcs_result'] == log_entry_types['RX_OFDM'].consts['FCS_GOOD']]