Skip to content

Latest commit

 

History

History
136 lines (101 loc) · 5.77 KB

performance_monitoring.md

File metadata and controls

136 lines (101 loc) · 5.77 KB

Tools for performance monitoring

Several tools can be used for performance analysis of OpenAirInterface. Different tools have different purposes.

Debugging purpose

  • A profiler such as perf enables to dissect the contribution of processes and their different parts to processing times and computing resource usage.
  • A tracers such as Tracy enables an inclusive and in depth monitoring of the performance of a specified part of software.

Benchmarking purpose

  • The time stats tool is an embedded processing time recorder for macroscopic computing blocks. It is thought for high-level benchmarking and research purposes as it provides a high-level view of processing times of typical air interface processing blocks.

Performance analysis with the Tracy profiler

Overview

From the Tracy manual:

Tracy is a real-time, nanosecond resolution hybrid frame and sampling profiler that you can use for remote or embedded telemetry of games and other applications. It can profile CPU, GPU, memory allocations, locks, context switches, [...]

OAI Integration

To enable Tracy, compile -DTRACY_ENABLE=ON in cmake. Note that build_oai has no native switch, but you can use --cmake-opt -DTRACY_ENABLE=ON instead.

Furthermore, you will need the Tracy profiler:

  • Windows hosts: There is a precompiled tracy-profiler.exe on Github
  • Linux hosts: Compile tracy-profiler from source as described in the manual.

Start the OAI executable you want to profile. Then, open the profiler, and click on connect to connect to the executable.

It is also possible to collect data from within docker containers:

  • Open port 8086.
  • To collect CPU data, make sure that you run docker with --privileged --mount "type=bind,source=/sys/kernel/debug,target=/sys/kernel/debug,readonly" --user 0:0 --pid=host or provide the corresponding options in docker-compose.

Instrumentation

Instrumentation is done via the header common/instrumentation.h. A couple of places in OAI have been instrumented already, search for the macros mentioned in common/instrumentation.h.

In short, main features already in use:

  • Measure specific code regions by surrounding them with TracyCZone(ctx, true); and TracyCZoneEnd(ctx);.
  • Record individual "Tracy frames" (in the OAI context, that's likely one 4G/5G slot) with TracyCFrameMark;
  • Plot values using TracyCPlot(name, val);

More information about these macros can be found in the manual.

Make sure to link utils into the static library you are modifying to get tracy header definitions.

Processing times statistics with the time stats

Purpose

The time stats tool is thought as an internal tool for recording statistics on processing stats of macroscopic computing blocks mostly for research purposes. As internal tool, it is or can be freely adapted to measure timings according to specific needs of researchers or engineers.

It is not intended for debugging. For performance debugging tools, refer to the debugging tools section.

Features

  • Timer based on Posix real time clocks.
  • Accumulate successive measurements. Merge function enables to merge several timers measuring parallel processes (see time_single_t below).
  • Provides average time, standard deviation and, optionally, time distribution.
  • May be started and stopped on full DL or UL slots only for clean and relevant measurements.
  • Already embedded in the stack to provide processing times of typical air interface processing blocks.

Usage

A number of timers are already included in the nr-softmodem and PHY simulators to provide statistics on the main macroscopic blocks:

  • In PHY simulators, option -P enables to display the statistics in the log.
  • In the nr-softmodem, the time statistics are displayed in file nrL1_stats.log when option -q is provided. This option may take an argument to display different statistics:
    • Option -q without argument displays statistics accumulated from softmodem start with a refresh every second.
    • Option -q n, n being any positive integer, displays statistics accumulated over n seconds with a refresh every n seconds.

The time stats tool is available through the header time_meas.h. It is implemented in this header and in the source file time_meas.c. A timer is a typedef struct time_stats_t that can be started with start_meas, stopped with stop_meas, merged in another timer with merge_meas and reset with reset_meas. The start, stop and merge functions have _on_dl and _on_ul variants to measure only full DL or UL slots. Tracking the full distribution of processing times is enabled by default using histograms. The histogram is automatically managed when a timer is reset and does not require explicit initialization or freeing. Each timer contains a histogram structure (time_hist_t) that records the distribution of processing times in configurable bins.

Warning: For measuring one function in several parallel threads, one should use several time_single_t timers. This timer holds only one measurement. It can be started with start_single_meas, stopped with stop_single_meas, merged in a time_stats_t with merge_single_meas and reset with reset_single_meas. This way, one avoids to create many time_stats_t that are rather large structures.