You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change moves nRF Profiler Python scripts documentation to a separate
`README.rst` file. Change also updates existing documentation related to
nRF Profiler to take into account the newly introduced page.
Jira: NCSDK-32015
Signed-off-by: Marek Pieta <[email protected]>
Signed-off-by: Divya Pillai <[email protected]>
Signed-off-by: Pekka Niskanen <[email protected]>
The nRF Profiler provides an interface for logging and visualizing data for performance measurements, while the system is running.
10
+
The nRF Profiler library allows for performance measurements of an embedded device.
11
+
The library provides an interface for lightweight logging of nRF Profiler events together with associated timestamp and data.
12
+
This allows you to deliver information about the system state with minimal negative impact on performance.
11
13
You can use the module to profile :ref:`app_event_manager` events or custom events.
12
-
The output is provided using RTT and can be visualized in a custom Python backend.
14
+
15
+
The nRF Profiler supports one backend that provides output to the host computer using RTT.
16
+
You can use a dedicated set of host tools available in the |NCS| to visualize and analyze the collected nRF Profiler events.
17
+
See the :ref:`nrf_profiler_script` page for details.
13
18
14
19
See the :ref:`nrf_profiler_sample` sample for an example of how to use the nRF Profiler.
15
20
@@ -18,7 +23,7 @@ See the :ref:`nrf_profiler_sample` sample for an example of how to use the nRF P
18
23
Configuration
19
24
*************
20
25
21
-
Since Application Event Manager events are converted to nRF Profiler events, the nRF Profiler can be configured to profile custom events or Application Event Manager events, or both.
26
+
Since Application Event Manager events are converted to nRF Profiler events by the :ref:`app_event_manager_profiler_tracer`, you can configure the nRF Profiler to profile custom events or Application Event Manager events, or both.
22
27
23
28
Configuring for use with custom events
24
29
======================================
@@ -89,119 +94,15 @@ To profile custom events, complete the following steps:
89
94
nrf_profiler_log_send(&buf, data_event_id);
90
95
}
91
96
92
-
.. note::
93
-
94
-
The ``data_event_id`` and the data that is profiled with the event must be consistent with the registered event type.
95
-
The data for every data field must be provided in the correct order.
97
+
.. note::
98
+
The ``data_event_id`` and the data that is profiled with the event must be consistent with the registered event type.
99
+
The data for every data field must be provided in the correct order.
96
100
97
101
Configuration for use with Application Event Manager
If you are using the Application Event Manager, in order to use the nRF Profiler follow the steps in
101
-
:ref:`app_event_manager_profiler_tracer_em_implementation` and :ref:`app_event_manager_profiler_tracer_config` on the :ref:`app_event_manager_profiler_tracer` documentation page.
102
-
103
-
.. _nrf_profiler_backends:
104
-
105
-
Enabling supported backend
106
-
**************************
107
-
108
-
The nRF Profiler supports a custom backend that is based around Python scripts to visualize the output data.
109
-
The backend communicates with the host using RTT.
110
-
111
-
To save profiling data, the scripts use CSV files for event occurrences and JSON files for event descriptions.
112
-
113
-
Available scripts
114
-
=================
115
-
116
-
The scripts can be found under :file:`scripts/nrf_profiler/` in the |NCS| folder structure.
117
-
The following script files are available:
118
-
119
-
* :file:`data_collector.py` - This script connects to the device using RTT, receives profiling data, and saves it to files.
120
-
When running the script from the command line, provide the time for collecting data (in seconds) and the dataset name.
121
-
For example:
122
-
123
-
.. parsed-literal::
124
-
:class: highlight
125
-
126
-
python3 data_collector.py 5 test1
127
-
128
-
In this command, ``5`` is the time value for collecting data and ``test1`` is the dataset name.
129
-
* :file:`plot_from_files.py` - This script plots events from the dataset that is provided as the command-line argument.
130
-
For example:
131
-
132
-
.. parsed-literal::
133
-
:class: highlight
134
-
135
-
python3 plot_from_files.py test1
136
-
137
-
In this command, ``test1`` is the dataset name.
138
-
* :file:`real_time_plot.py` - This script connects to the device using RTT, plots data in real-time, and saves the data.
139
-
When running the script from the command line, provide the dataset name.
140
-
For example:
141
-
142
-
.. parsed-literal::
143
-
:class: highlight
144
-
145
-
python3 real_time_plot.py test1
146
-
147
-
* :file:`merge_data.py` - This script combines data from ``test_p`` and ``test_c`` datasets into one dataset ``test_merged``.
148
-
It also provides clock drift compensation based on the synchronization events: ``sync_event_p`` and ``sync_event_c``.
149
-
This enables you to observe times between events for the two connected devices.
150
-
As command-line arguments, provide names of events used for synchronization for a Peripheral (``sync_event_p``) and a Central (``sync_event_c``), as well as names of datasets for the Peripheral (``test_p``), the Central (``test_c``), and the merge result (``test_merged``).
To enable and run the custom backend, complete the following steps:
163
-
164
-
1. Connect device to the computer.
165
-
2. Complete the configuration steps for use with either custom events or Application Event Manager, as described in the :ref:`nrf_profiler_configuration` section.
166
-
#. From the list of `Available scripts`_, choose the Python script that you want to use for event visualization, analysis, and calculating statistics.
167
-
#. Run the script from the command line using its related command.
168
-
169
-
.. _nrf_profiler_backends_custom_visualization:
170
-
171
-
Backend visualization
172
-
=====================
173
-
174
-
When you run either the :file:`plot_from_files.py` or the :file:`real_time_plot.py` script, the profiled events are visualized in a GUI window.
175
-
176
-
The visual output can look like the following diagram:
:alt:Example of nRF Profiler backend script visualization
183
-
184
-
Example of nRF Profiler backend script visualization
185
-
186
-
.. nrf_profiler_GUI_end
187
-
188
-
In this diagram:
189
-
190
-
* Red dots indicate the submissions for the related events.
191
-
* Blue vertical rectangles indicate the processing of the events, with their width corresponding to the processing time length.
192
-
* The :guilabel:`Start/Stop` button can be used to pause or resume the real-time plot translation.
193
-
194
-
The GUI also supports the following actions:
195
-
196
-
* Scrolling on the diagram using the mouse wheel zooms it in or out.
197
-
198
-
* When plotting is paused, scrolling zooms to the cursor location.
199
-
* When plotting in running, scrolling zooms to the right edge of the plot.
200
-
201
-
* Middle mouse button can be used to mark an event submission or processing for tracking, and to display the event data.
202
-
* When plotting is paused, you can click and drag with the left mouse button to pan the plot.
203
-
* You can click the left or right mouse button to place a vertical line at the cursor location.
204
-
When two lines are present, the application measures the time between them and displays it.
104
+
To use the nRF Profiler for Application Event Manager events, refer to the :ref:`app_event_manager_profiler_tracer` documentation.
105
+
The Application Event Manager profiler tracer automatically initializes the nRF Profiler and then acts as a linking layer between :ref:`app_event_manager` and the nRF Profiler.
#. Use scroll wheel to zoom into interesting parts on a GUI.
90
-
See the :ref:`nrf_profiler_backends_custom_visualization` in the Profiler documentation for more information about how to work with the diagram.
91
+
#. Use the scroll wheel to zoom into interesting parts on a plot.
92
+
See the :ref:`nrf_profiler_script_visualization_GUI` section in the nRF Profiler host tools documentation for more information about how to navigate in the GUI window.
91
93
#. Click the middle mouse button to highlight an event submission or processing for tracking, and to display the event data as on a figure:
On this image, the zoom focuses on actions triggered by the fifth one-second event.
100
102
The five-second event triggers 50 burst events.
101
103
One event submission and corresponding processing time is highlighted in green.
102
104
#. Check the results for the generated :file:`test_name.csv` and :file:`test_name.json` files.
103
-
#. See how events are logged with data transmitted by the event.
105
+
See how events are logged with data transmitted by the event.
104
106
#. Calculate the nRF Profiler event propagation statistics (statistics for time intervals between nRF Profiler events) from the previously collected dataset using the following command:
0 commit comments