Skip to content

Commit c41ff04

Browse files
committed
[#97577] docs: live_tracing: Added steps for running live server on demo application
Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
1 parent 82c0100 commit c41ff04

1 file changed

Lines changed: 51 additions & 8 deletions

File tree

docs/source/live_tracing.md

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,53 @@
11
# Real-time tracing
22

3-
This chapter covers the usage of [Zephelin Trace Viewer](visual_interface) for live visualization of the traces being gathered during application execution.
3+
This chapter covers the usage of [Zephelin Trace Viewer](visual_interface) for live visualization of traces being gathered during application execution.
44

5-
:::{note}
65
Real-time visualization requires running a local Python server responsible for ingesting CTF traces, parsing them into TEF, and forwarding them to the visualizer.
7-
:::
86

97
## Prerequisites
108

119
Before running the server, you need to install required backend dependencies and compile the frontend visualizer.
1210

13-
**1. Install server dependencies**
11+
### Install server dependencies
1412

15-
From the root of the project, run the following command:
13+
Apart from regular dependencies of Zephelin, server dependencies need to be installed as well with the following command:
1614

1715
```bash
1816
pip install -r server/requirements.txt
1917
```
2018

21-
**2. Build the Visualizer**
19+
### Build the frontend for Trace Viewer
2220

2321
The server requires a compiled version of the [Zephelin Trace Viewer](visual_interface).
24-
After cloning the repository, build the frontend by running:
22+
First, clone the repository:
23+
24+
```bash
25+
git clone --recursive https://github.com/antmicro/zephelin-trace-viewer.git
26+
```
27+
28+
After cloning the repository, install `corepack` and install necessary dependencies with:
29+
30+
```bash
31+
cd zephelin-trace-viewer
32+
corepack enable
33+
yarn
34+
```
35+
36+
In the end, build the backend with:
37+
2538
```bash
2639
yarn build
40+
cd ..
2741
```
2842

43+
Built frontend will be available under `./zephelin-trace-viewer/dist` directory.
44+
2945
## Running the server
3046

31-
To start the Zephelin Server and host the visualizer, execute the `run_backend.py` script.
47+
To start the Zephelin Server and host the visualizer, execute the `server/run_backend.py` script.
3248

3349
### Basic usage
50+
3451
To run the server with default settings and serve the frontend, point it to the `dist` directory with the compiled frontend:
3552

3653
```bash
@@ -75,6 +92,32 @@ If the Visualizer is connected to the server, the live-tracing controls are avai
7592
* `Stop Tailing` - Stops the default behavior in which viewport follows live edge of visualized trace.
7693
* `Resume Tailing` - Snaps the viewport back to the live edge.
7794

95+
## Sample collection of traces
96+
97+
Let's run an application running profiling for TensorFlow Lite Micro model.
98+
99+
First of, let's build a sample application running two TensorFlow Lite Micro models, with increased number of iterations:
100+
101+
```bash
102+
west build -p -b max32690fthr/max32690/m4 samples/profiling/tflm_multi_model -- -DCONFIG_ZPL_TRACE_FORMAT_CTF=y -DCONFIG_TRACING_BUFFER_SIZE=10000 -DCONFIG_BOOT_BANNER=n -DCONFIG_PRINTK=n -DCONFIG_LOG=n -DCONFIG_ZPL_SAMPLE_TFLM_NUM_ITERS=200
103+
```
104+
105+
After this, run server for live tracing, providing paths to models:
106+
107+
```bash
108+
python server/run_backend.py --frontend-directory ./zephelin-trace-viewer/dist --tflm-model-paths ./samples/common/tflm/model/magic-wand.tflite ./samples/common/tflm/model/sine.tflite
109+
```
110+
111+
In the end, run collection of traces from:
112+
113+
* Renode:
114+
```bash
115+
python scripts/run_renode.py --trace-output test.ctf --send-to-remote 127.0.0.1:5000
116+
```
117+
* From actual hardware (after flash), e.g.:
118+
```bash
119+
west zpl-uart-capture <path-to-uart> 115200 ./trace-hw.ctf --send-to-remote 127.0.0.1:5000
120+
```
78121

79122
## Server API reference
80123

0 commit comments

Comments
 (0)