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
Copy file name to clipboardExpand all lines: scripts/nrf_profiler/README.rst
+76Lines changed: 76 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,6 +137,82 @@ You can use it for visualization or calculating statistics.
137
137
An application must provide its own implementation.
138
138
See the :ref:`nrf_desktop_nrf_profiler_sync` for an example implementation used by the :ref:`nrf_desktop` application.
139
139
140
+
.. _nrf_profiler_script_calculating_statistics:
141
+
142
+
Calculating statistics
143
+
======================
144
+
145
+
The :file:`calc_stats.py` script is used to calculate and visualize the nRF Profiler event propagation statistics (statistics for time intervals between nRF Profiler events) for a given dataset.
146
+
A JSON file containing test presets specifies the events to be analyzed.
147
+
The script calculates and displays the following statistics for each test preset:
148
+
149
+
* basic statistics (min, max, mean, median, standard deviation)
150
+
* histogram plot
151
+
* plot of subsequent time intervals between events
152
+
153
+
For some of the statistics, the script also filters out time intervals that deviate from the other records.
154
+
These statistics are denoted by a ``no outliers`` suffix in the plot title and output file name.
155
+
156
+
Apart from displaying the statistics, the scipts also stores them as local files under the :file:`data_stats/` directory.
157
+
The results are organized in subdirectories based on the dataset name, time range, and test preset name.
158
+
159
+
When running the script from the command line, provide the dataset name (``test1``) and path to the JSON file containing test presets (:file:`stats_nordic_presets/app_event_manager_profiler_tracer.json`).
Before calculating statistics using the example command, you need to collect profiling data from a device running the :ref:`app_event_manager_profiling_tracer_sample` sample and store the data as the ``test1`` dataset.
167
+
Make sure to use the mentioned sample, because the test preset refers to sample-specific nRF Profiler event names.
168
+
169
+
If you want to calculate statistics for your own application, you need to create a new test preset file that refers to the nRF Profiler events used by your application.
170
+
You can use the script to calculate statistics for custom nRF Profiler events or Application Event Manager events, or both.
171
+
172
+
Test preset JSON file format
173
+
----------------------------
174
+
175
+
The test preset JSON file contains an array of test presets.
176
+
Every test preset is identified by a unique name.
177
+
The script calculates the time intervals between start and end events specified by each test preset.
178
+
The script uses the time intervals as input data for calculating statistics.
179
+
180
+
An example of an array containing a single test preset looks as follows:
181
+
182
+
.. code-block:: json
183
+
184
+
[
185
+
{
186
+
"name": "Test Name",
187
+
"start_event": {
188
+
"name": "event_name_1",
189
+
"state": "submit"
190
+
},
191
+
"end_event": {
192
+
"name": "event_name_2",
193
+
"state": "processing_end"
194
+
}
195
+
}
196
+
]
197
+
198
+
Fields:
199
+
200
+
* ``name`` - Name of the test preset (used for output files and plot titles)
201
+
* ``start_event`` - Configuration for the start event
202
+
203
+
* ``name`` - Name of the event
204
+
* ``state`` - Event state (optional, defaults to "submit")
0 commit comments