wiki:802.11/wlan_exp/log/util

Version 4 (modified by murphpo, 10 years ago) (diff)

--

Future home of wlan_exp_log.log_util documentation.

Log Index Generation

The gen_log_data_index method generates an index of log entries in a given log data buffer. The log data index can be generated when the log data is stored and is used to quickly summarize log contents and to access individual entries without re-parsing the full log data buffer.

The log data index is represented as a dictionary. Each dictionary entry has an entry type ID as its key and a list of byte indexes as its value.

For example, consider the log data illustrated below:

The corresponding log index would be the dictionary below (where the TYPE_ID_ values are the integer entry type IDs contained in the log data):

{
  TYPE_ID_RED:     [8, 88],
  TYPE_ID_GREEN: [36, 74],
  TYPE_ID_YLW:     [56,]
} 

Important: the log data index can be generated without any knowledge of the meaning of each log entry type. The index is keyed by the integer log entry type IDs contained in the log data itself. The log data index and log data always correspond 1:1 - once generated, the log data index can be saved alongside the log data and re-used as needed. Refer to the log_data_to_hdf5 utility for an example implementation.

Log Index Translation & Filtering

The filter_log_index method applies filters to a log data index, generating a new dictionary suitable for use by downstream utilities. This utility has two functions:

  • Index key translation: the integer entry type IDs are translated into instances of the WlanExpLogEntryType object that represents the underlying entry type
  • Entry type filtering: the input index can be filtered, with individual entry types included, excluded and merged as required by the experiment

A few example uses of filter_log_index:

import warpnet.wlan_exp_log.log_util as log_util

#log_data_index is a dictionary returned by gen_log_data_index

#No filtering, just map entry_type_id values (log_data_index keys) to entry type classes (log_index keys)
log_index = log_util.filter_log_index(log_data_index)

#Create index with only RX_OFDM entries
log_index = log_util.filter_log_index(log_data_index, include_only=['RX_OFDM'])

#Create index with only RX_OFDM and TX entries
log_index = log_util.filter_log_index(log_data_index, include_only=['RX_OFDM', 'TX'])

#Create index for type RX_ALL composed of all RX_OFDM and RX_DSSS entries
log_index = log_util.filter_log_index(log_data_index, merge={'RX_ALL':['RX_OFDM', 'RX_DSSS']})

#Create index for all TX and RX entries, with RX_OFDM and RX_DSSS entries merged into RX_ALL
log_index = log_util.filter_log_index(log_data_index, include_only=['RX_ALL', 'TX'], merge={'RX_ALL':['RX_OFDM', 'RX_DSSS']})