Decode and visualise no_std embedded execution traces over RTT or any byte transport
Project description
embedded-etrace
Decode and visualise no_std embedded execution traces over RTT or any byte transport.
The companion Rust crate (execution_trace) provided by the Cargo package execution-trace
runs on your firmware and emits length-delimited protobuf frames for task activations,
ISR entries, and point-in-time markers. This Python package decodes those frames on the
host and produces interactive HTML timing diagrams.
Installation
# Core decoder only (no diagram dependencies):
pip install embedded-etrace
# With the interactive Bokeh diagram generator:
pip install embedded-etrace[diagram]
Requires Python 3.11+.
Quick start
1. Custom transport — decode a live stream
Implement a loop that appends raw bytes from your transport (RTT, UART, TCP…) into a
bytearray and call decode_tracing_stream each iteration:
from execution_trace import (
SequenceTracker, TraceEventBuffer, decode_tracing_stream, write_tracing_csv,
)
buf = bytearray()
tracker = SequenceTracker("my-device")
event_buffer = TraceEventBuffer()
while True:
buf += transport.read() # append whatever arrived
decode_tracing_stream(buf, tracker, event_buffer)
# When the session ends:
event_buffer.flush_pending() # warn about open spans
csv_path = write_tracing_csv(
event_buffer.records + event_buffer.markers, # type: ignore[operator]
output_dir="data",
)
print(f"Trace written → {csv_path}")
decode_tracing_stream consumes complete frames from buf in-place and handles
device resets transparently (the sequence number jumps backward on firmware reboot).
2. Decode a recorded binary file
Use the etrace-decode console script:
etrace-decode recording.bin
etrace-decode recording.bin --output ./data
This produces a timestamped trace_YYYYMMDD_HHMMSS.csv and updates the
trace_latest.csv symlink.
3. Generate a timing diagram
etrace-diagram # reads trace_latest.csv, writes diagram.html
etrace-diagram data/trace_latest.csv --output out/diagram.html --title "Flight run #7"
Or call the API directly:
from pathlib import Path
from execution_trace.diagram import generate_diagram
result = generate_diagram(
csv_path=Path("trace_latest.csv"),
output_path=Path("diagram.html"),
title="Flight run #7",
)
print(f"{result.n_events} events, {result.n_lanes} lanes, {result.n_missed} deadline misses")
CSV format
| Column | Type | Description |
|---|---|---|
name |
string | Span or marker name |
type |
string | task, isr, or marker |
start_us |
float | Activation timestamp in µs |
end_us |
float | Completion timestamp in µs (= start_us for markers) |
priority |
int | Scheduler priority (0 if unknown) |
deadline_us |
float | Absolute deadline in µs (optional) |
value |
int | Optional u32 marker payload |
Wire format
Each frame is a standard protobuf length-delimited record:
[ varint: payload_length ][ proto bytes: TraceEvent ]
The protobuf schema lives in :file:execution-trace/proto/tracing.proto (sibling
Rust crate in the same repository).
Development
# Editable install with all dev dependencies:
pip install -e ".[diagram,dev]"
# Run the test suite:
pytest tests/ -v
# Type-check:
mypy src/execution_trace
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file embedded_etrace-0.1.0.tar.gz.
File metadata
- Download URL: embedded_etrace-0.1.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1484e98c28e4209f860f820f52c8637c49e8f740d6233bb52d19f25138f4fe22
|
|
| MD5 |
f3ce4c491a1f44f689d4f4ea329a6952
|
|
| BLAKE2b-256 |
2c732ece529d79c334116d0a2ee852e7424f4edd6e0bb35c177ec40d7f314cc9
|
Provenance
The following attestation bundles were made for embedded_etrace-0.1.0.tar.gz:
Publisher:
release.yml on erl987/execution-trace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
embedded_etrace-0.1.0.tar.gz -
Subject digest:
1484e98c28e4209f860f820f52c8637c49e8f740d6233bb52d19f25138f4fe22 - Sigstore transparency entry: 1624527996
- Sigstore integration time:
-
Permalink:
erl987/execution-trace@d805717e2046eeb4dda9c8cf3d515acc17a8aed8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/erl987
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d805717e2046eeb4dda9c8cf3d515acc17a8aed8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file embedded_etrace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: embedded_etrace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29cd056341971f2af4bdf92e9639fc7330a3ef40b60f816004677393e4a4d774
|
|
| MD5 |
8e3cd47484dd2d740b67146634449307
|
|
| BLAKE2b-256 |
5be92bad7a128519503cd0fdd426d21437c4d43250cbff478c92991ced619ca1
|
Provenance
The following attestation bundles were made for embedded_etrace-0.1.0-py3-none-any.whl:
Publisher:
release.yml on erl987/execution-trace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
embedded_etrace-0.1.0-py3-none-any.whl -
Subject digest:
29cd056341971f2af4bdf92e9639fc7330a3ef40b60f816004677393e4a4d774 - Sigstore transparency entry: 1624528001
- Sigstore integration time:
-
Permalink:
erl987/execution-trace@d805717e2046eeb4dda9c8cf3d515acc17a8aed8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/erl987
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d805717e2046eeb4dda9c8cf3d515acc17a8aed8 -
Trigger Event:
push
-
Statement type: