Profiler

The Profiler sample demonstrates the functionality of the nRF Profiler subsystem. It shows how to use the Profiler to log and visualize data about custom events that are not part of the Application Event Manager.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF9160 DK

PCA10090

nrf9160dk_nrf9160

nrf9160dk_nrf9160_ns

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF21540 DK

PCA10112

nrf21540dk_nrf52840

nrf21540dk_nrf52840

When built for an _ns build target, the sample is configured to compile and run as a non-secure application. Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.

Overview

The sample initializes the nRF Profiler and registers and periodically profiles the occurrences of the following event types:

  • Event without data (no data event) - This event is used to signal the occurrence of an event only. It does not contain additional data.

  • Event with data (data event) - There are several numerical values associated with this event. The values are updated periodically.

Configuration

See Configuring your application for information about how to permanently or temporarily change the configuration.

Building and running

This sample can be found under samples/nrf_profiler in the nRF Connect SDK folder structure.

When built as a non-secure firmware image for the _ns build target, the sample automatically includes the Trusted Firmware-M (TF-M).

To build the sample with Visual Studio Code, follow the steps listed on the Building nRF Connect SDK application quick guide page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.

Testing

After programming the sample to your development kit, you can test it by performing the following steps:

  1. Go to the scripts/nrf_profiler folder.

  2. Run the script real_time_plot.py, with the name that should be used to store the data as the argument. For example:

    real_time_plot.py test_name

    This command generates a test_name.csv file and a test_name.json file. The script opens a GUI window that displays events as dots on timelines, similar to the following diagram.

    Example of nRF Profiler backend script visualization

    Example of nRF Profiler backend script visualization

    See the Backend visualization section in the Profiler documentation for more information about the GUI.

  3. Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.

After you connect, the sample will display messages in the terminal.

Dependencies

This sample uses the following nRF Connect SDK subsystems:

In addition, it uses the following secure firmware component: