|
| 1 | +# Perfetto-to-logjet Demo |
| 2 | + |
| 3 | +End-to-end pipeline: record a Linux ftrace, import it via the perfetto-ingest |
| 4 | +plugin into a `.logjet` spool, and view the result in `ljx view`. |
| 5 | + |
| 6 | +## Build First |
| 7 | + |
| 8 | +```bash |
| 9 | +# From workspace root |
| 10 | +make dev |
| 11 | +./scripts/build-perfetto.sh |
| 12 | +``` |
| 13 | + |
| 14 | +## Run |
| 15 | + |
| 16 | +```bash |
| 17 | +cd demo/perfetto/perfetto-to-logjet |
| 18 | +./run-demo.sh |
| 19 | +``` |
| 20 | + |
| 21 | +Requires sudo for ftrace access. |
| 22 | + |
| 23 | +## What Happens |
| 24 | + |
| 25 | +1. `traced` + `traced_probes` start in the background. |
| 26 | +2. `tracebox` records 5s of scheduler events (CPU switches) via ftrace. |
| 27 | +3. `ljd` loads the perfetto-ingest plugin, which spawns `trace_processor`, |
| 28 | + exports the trace as SQLite, maps `sched_slice` rows to OTel log records |
| 29 | + with CPU/state/duration, and streams them into a `.logjet` spool. |
| 30 | +4. `ljx view` opens the spool — each CPU scheduling event appears as one line. |
| 31 | + |
| 32 | +## What You Should See |
| 33 | + |
| 34 | +- Thousands of log lines, each showing a CPU scheduling event: |
| 35 | + ``` |
| 36 | + May 7 10:43:15 I cpu=7 dur=7.2us state=R utid=19 ts=... |
| 37 | + May 7 10:43:15 I cpu=7 dur=2.0us state=R utid=21 ts=... |
| 38 | + ``` |
| 39 | +- Press `Enter` to see full OTel attributes (perfetto.sched.id, cpu, end_state). |
| 40 | +- Press `F` for field filter, `/` to search, `q` to quit. |
| 41 | + |
| 42 | +## Troubleshooting |
| 43 | + |
| 44 | +- **0 records**: The trace needs ftrace events — they require root. The script |
| 45 | + uses `sudo tracebox`. If passwordless sudo isn't configured, run `sudo ./run-demo.sh`. |
| 46 | +- **Fewer records than expected in ljx view**: Delete stale index cache: |
| 47 | + `rm -rf ~/.cache/ljx && ./run-demo.sh` |
0 commit comments