-
Notifications
You must be signed in to change notification settings - Fork 2
5 Logger Information
This page is for all developers and explains the operation of the Logger module in the PRiME Framework.
The purpose of the logger module is to act as a conduit for storing and processing all the data and messages created by the modules of the framework. It is not designed to create a human-readable output. The main operation of the logger is to processes messages and filter them into those that should be stored to file and those that should be forwarded to the Visualiser to be displayed.
Logger message filtering and re-direction is currently under development. Currently, the logger will print all received messages to standard output (stdout, i.e. the terminal). To simultaneously save to file and print logger output, pipe to the tee
function. For example:
python logger.py | tee output_filename.txt
Additional python scripts are provided in the logger folder to enable static visualisation and analysis of logger trace files. The scripts must be called with the trace filename as an input argument.
The analysis_time_series.py
script plots the values of each application and device knob and monitor over time. The script generates a PDF file containing a series of graphs that plots each group of knobs and monitors, with the ID of each shown in a legend. An optional third argument can be passed to specify the number of lines that the script will process from the trace. For example:
python analysis_time_series.py example_logger_trace.txt
The analysis_pareto.py
script extracts Pareto-optimal operating points from logger trace files for a given application-device pairing.
This analysis script is currently only supported when using the profile RTM.
The mon_ops
class and the pareto_front_2D.py
script are required by the analysis_pareto.py
file. The script is run in the same way as the time series analysis script:
python analysis_pareto.py example_logger_trace.txt
The logger can be instructed to filter message based on a list passed to it from the UI. All messages will be logged before the first filter is passed. The UI filter messages are in the following format:
Type & Fields | Description |
---|---|
PRIME_UI_LOG_FILE_FILTER_MUX exec_time, data:{list[] messages}
|
Set the filter for the messages that the logger saves to file to the list "messages" at exec_time seconds. |
PRIME_UI_LOG_VISUAL_FILTER_MUX exec_time, data:{list[] messages}
|
Set the filter for the messages that the logger forwards to the visualiser to the list "messages" at exec_time seconds. |
list[] messages should be made up of API message types. E.g. [PRIME_API_APP_REG, PRIME_API_APP_KNOB_DISC_GET, PRIME_API_APP_MON_CONT_MAX]. Additionally, modules can be masked on or off by passing the modules name as part of the list. Valid modules names are: APP, RTM, DEV and UI.
Two messages exist for filter setting, one for filtering the messages saved to file and one for filtering the messages forwarded to the Visualiser so that these can be filtered separately. E.g. you could mask APP to PRIME_UI_LOG_FILE_FILTER_MUX to save only application messages to file and DEV to PRIME_UI_LOG_VISUAL_FILTER_MUX to send only device messages to the Visualiser.
In addition to all other API messages, which are automatically forwarded, the logger API specifies the additional valid messages that can be recognised and processed by the logger script. The type field uniquely identifies the message format and the meaning of the data fields contained within it. A timestamp, with a resolution of microseconds (10-6), is included with every message.
These messages are useful for sending knob or monitor data directly to the logger module.
API Function | Fields | Description |
---|---|---|
PRIME_LOG_APP_KNOB | knob_disc_t/knob_cont_t knob | Log the state of a application knob. |
PRIME_LOG_APP_MON | mon_disc_t/mon_cont_t mon | Log the state of a application monitor. |
API Function | Fields | Description |
---|---|---|
PRIME_LOG_DEV_KNOB_DISC | unsigned int id, knob_type_t type, min, max, disc_t val | Log a discrete device knob's state. |
PRIME_LOG_DEV_KNOB_CONT | unsigned int id, knob_type_t type, min, max, cont_t val | Log a continuous device knob's state. |
PRIME_LOG_DEV_MON_DISC | unsigned int id, mon_type_t type, disc_t val | Log a discrete device monitor's state. |
PRIME_LOG_DEV_MON_CONT | unsigned int id, mon_type_t type, cont_t val | Log a continuous device monitor's state. |