|
1 | 1 | # Real-time tracing |
2 | 2 |
|
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. |
4 | 4 |
|
5 | | -:::{note} |
6 | 5 | 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 | | -::: |
8 | 6 |
|
9 | 7 | ## Prerequisites |
10 | 8 |
|
11 | 9 | Before running the server, you need to install required backend dependencies and compile the frontend visualizer. |
12 | 10 |
|
13 | | -**1. Install server dependencies** |
| 11 | +### Install server dependencies |
14 | 12 |
|
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: |
16 | 14 |
|
17 | 15 | ```bash |
18 | 16 | pip install -r server/requirements.txt |
19 | 17 | ``` |
20 | 18 |
|
21 | | -**2. Build the Visualizer** |
| 19 | +### Build the frontend for Trace Viewer |
22 | 20 |
|
23 | 21 | 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 | + |
25 | 38 | ```bash |
26 | 39 | yarn build |
| 40 | +cd .. |
27 | 41 | ``` |
28 | 42 |
|
| 43 | +Built frontend will be available under `./zephelin-trace-viewer/dist` directory. |
| 44 | + |
29 | 45 | ## Running the server |
30 | 46 |
|
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. |
32 | 48 |
|
33 | 49 | ### Basic usage |
| 50 | + |
34 | 51 | To run the server with default settings and serve the frontend, point it to the `dist` directory with the compiled frontend: |
35 | 52 |
|
36 | 53 | ```bash |
@@ -75,6 +92,32 @@ If the Visualizer is connected to the server, the live-tracing controls are avai |
75 | 92 | * `Stop Tailing` - Stops the default behavior in which viewport follows live edge of visualized trace. |
76 | 93 | * `Resume Tailing` - Snaps the viewport back to the live edge. |
77 | 94 |
|
| 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 | + ``` |
78 | 121 |
|
79 | 122 | ## Server API reference |
80 | 123 |
|
|
0 commit comments