|
|
|
There are a set of functions defined in ```openair1/PHY/TOOLS/time_meas.c``` which can be used to measure the execution time (in micro seconds) of any block of code.
|
|
|
|
|
|
|
|
# Usage
|
|
|
|
|
|
|
|
## Creating a Measurement Object
|
|
|
|
|
|
|
|
It is done by simply creating a structure of type ```time_stats_t```
|
|
|
|
|
|
|
|
## Initialization
|
|
|
|
|
|
|
|
Before making the first measurement, the variables within the structure has to be reset. This is done by calling the ```reset_meas()``` with the created structure as the argument.
|
|
|
|
|
|
|
|
## Measure the Execution Time
|
|
|
|
|
|
|
|
The piece of code that needs to be measured is enclosed within ```start_meas()``` and ```stop_meas()``` with the created structure as the argument.
|
|
|
|
|
|
|
|
*Note: A single ```time_stats_t``` object can be used to measure multiple instances only in sequence. This means a ```start_meas()``` can only come after (in execution order) ```stop_meas()``` for the same ```time_stats_t``` object.
|
|
|
|
|
|
|
|
## Printing Measured Stats
|
|
|
|
|
|
|
|
The ```print_meas()``` and ```print_meas_log()``` functions can be called to print the measured stats onto ```stdout``` and to a ```char``` buffer respectively.
|
|
|
|
|
|
|
|
# Example
|
|
|
|
|
|
|
|
An existing usage of the timing measurement tool is found in ```nr-gnb.c``` in function ```dump_L1_meas_stats``` which prints different levels of layer 1 timings to file ```nrL1_stats.log``` |
|
|
\ No newline at end of file |