Skip to main content

EdgeLens

EdgeLens

Measure. Diagnose. Validate. Edge AI performance engineering for real pipelines.

tests PyPI Python License: MIT

EdgeLens on a Jetson Nano: benchmark, pin clocks, benchmark again, compare

Rendered by EdgeLens from two real runs on a Jetson Nano (JetPack 4.6, TensorRT, 100 iterations each), before and after sudo jetson_clocks; full numbers in docs/jetson.md.

Same Jetson Nano, same model, same code: p99 latency 148 ms → 9.4 ms after pinning clocks. FPS never showed it. EdgeLens did. (measured)

pip install edgelens
edgelens doctor                                        # is this board ready to benchmark?
edgelens benchmark --model model.onnx --deadline-ms 33
edgelens diagnose                                       # why it is slow, with evidence
edgelens validate --p99-ms 33 --max-miss-ratio 0.001    # PASS / FAIL against your requirement

Most edge monitoring tools tell you what the board is doing (CPU 47%, GPU 92%, 61 °C). That is not the engineering question. The engineering question is a loop, and EdgeLens is built around it:

Question EdgeLens v0.2 (Alpha) Later
Does my system meet its requirement? validate --p99-ms 10 --max-miss-ratio 0.001 --max-energy-mj 60: PASS / FAIL / INCONCLUSIVE per requirement, with the measured value. Assumption contracts: the conditions a result holds under (board, power mode, clocks, input rate, temperature, background load) —
If not, why? validate names the limiting stage and attaches the diagnosis; diagnose gives the full evidence concurrent stages, queues, critical path
What does it cost at the real rate, over hours? periodic (1 Hz is not back to back), soak (drift, throttling, memory growth), sweep (backends: latency, energy and whether the answer changed) —
Is it still accurate on the device? --inputs / --labels: your own data or images, RMSE or top-1 / top-5 accuracy on the board, per backend —
Did the change actually help? compare: before/after per stage, with confidence intervals; warns when the environments differ (--strict-env fails instead) —
Does the system decide in time? experimental: replay / detect / perturb / parity for windowed sensor pipelines (docs/stream.md) stable interface

Measured fact → evidence → hypothesis → experiment → measured result. Every number EdgeLens reports was measured on the board; nothing is inferred by a model, and nothing is reported with more confidence than the data allows.

$ edgelens benchmark --pipeline examples/timeseries_vibration.py --iterations 1200
  Stage               Role         Mean      p99    Share
  acquire             input        0.004 ms  0.009  1.3%
  filter              preprocess   0.008 ms  0.019  2.5%
  fft                 preprocess   0.022 ms  0.044  7.0%
  feature_extraction  preprocess   0.274 ms  0.458  87.3%
  classify            inference    0.006 ms  0.018  1.9%
  decision            decision     0.000 ms  0.001  0.0%
End-to-end: mean 0.318 ms   Throughput: 3144.65 it/s   (1200 iterations)
min 0.260 · p50 0.283 · p95 0.486 · p99 0.542 · p99.9 0.866 · max 1.354 · jitter 0.082 ms
╭─ Deadline ─ MET  deadline 51.2 ms · misses 0/1200 (0.000%) · worst 1.354 ms ─╮
Real-time factor: mean 0.0062 · p99 0.0106 · max 0.0264 (hop period 51.2 ms, headroom 99.38%)
environment_id 6bc5f4e78f66 · experiment_id 783fa6dc9268 · run_id 20261002T142630-ed4566

$ edgelens diagnose ts.json
  DEADLINE_MET  (strong evidence)
  All 1200 iterations finished within the 51.2 ms deadline; worst 1.354 ms (97% headroom).

(Real output, run on a laptop CPU. On a Jetson the same run also reports GPU load, board power and energy per window.)

See it catch a win

EdgeLens comparing CPU vs TensorRT inference on a Jetson Nano, ending in a PASS verdict

edgelens compare before.json after.json doesn't just print two numbers side by side — it tells you whether the change is a real improvement or a regression, per metric and per stage, and fails CI (--strict-env, exit code 2) if the environment changed under you.

Status

v0.2 is an Alpha. The command line, the result file (schema_version: 1) and the contract format are frozen for 0.2.x (docs/stability.md); the windowed-stream commands are experimental.

What has been checked on real hardware, and what has not (docs/jetson.md has every row):

Verified Not yet verified
Jetson Nano (JetPack 4.6) the v0.1 scope: engine, statistics, deadlines, telemetry, INA3221 power and energy, CPU / CUDA / TensorRT providers, compare --strict-env the v0.2 gates (development runs only)
Jetson AGX Orin 32GB (Yocto image, shared board) onnxruntime CPU provider, repository workloads: selftest, benchmark, periodic, statistical compare (A/A and a known change), Python markers, watch and leak detection, soak leak detection, sweep (CPU row), contracts with every assumption deliberately violated, Perfetto export, the CI gate script; sum-of-rails power CUDA / TensorRT / DLA on Orin, C++ markers, ROS 2, bag replay, clock A/B (not possible on a shared board), the CI runner end to end, the experimental stream commands
Linux x86-64 (CI) the full test suite on Python 3.8–3.13 —

Known limitations: docs/limitations.md.

Install

pip install edgelens               # core: any Linux host, Python 3.8+
pip install "edgelens[onnx]"       # + onnxruntime (CPU) for --model

On Jetson, don't install the [onnx] extra. On JetPack 4.x, first run python -m pip install --upgrade pip inside a new venv: the pip that python3.8 -m venv creates is too old for current wheels and tries to compile NumPy. It pulls the CPU-only onnxruntime from PyPI, which replaces NVIDIA's GPU build. Install the JetPack-matched onnxruntime-gpu wheel (see the Jetson Zoo), then plain pip install edgelens. edgelens doctor shows which execution providers you actually have (you want Tensorrt, CUDA, CPU).

From source (contributors):

git clone https://github.com/Infinity-ops/edgelens
cd edgelens
pip install -e ".[dev,onnx]"       # on Jetson: pip install -e ".[dev]"
python3 -m pytest -q
Extra Adds When you need it
dev pytest Running tests/
onnx onnxruntime (CPU) --model on a non-Jetson host
fixtures onnx (the model library) Only to regenerate the test .onnx files
images pillow --inputs with a folder of images
rosbag rosbags Reading ROS 1/2 bags without ROS (examples/rosbag_to_windows.py)

Compatibility. Python 3.8–3.13 on Linux (x86-64 and aarch64). macOS and Windows are not supported (sysfs, /proc and CLOCK_MONOTONIC semantics are Linux-specific). Board telemetry and power need an NVIDIA Jetson; elsewhere EdgeLens measures latency, CPU and memory and says which sources are missing.

onnx is kept out of dev on purpose: recent releases pull in protobuf>=6, which broke sibling packages pinned to protobuf 5.x in real testing.

Quick start (any Linux machine, about 2 minutes)

No model, no GPU and no clone needed: a sensor pipeline in NumPy, measured, diagnosed and checked against a requirement.

python3 -m venv edgelens-try && . edgelens-try/bin/activate
pip install --upgrade pip && pip install edgelens
curl -sSLO https://raw.githubusercontent.com/Infinity-ops/edgelens/main/examples/quickstart/quickstart.py
edgelens benchmark --pipeline quickstart.py --iterations 1000 --save run.json
edgelens diagnose run.json
edgelens validate run.json --p99-ms 32 --max-miss-ratio 0     # exit code 0 = PASS

What you should see, and a checker for the parts that are the same on every machine: examples/quickstart.

On a Jetson (this block is run on a real Jetson before every release tag, see the release checklist):

python3 -m venv ~/edgelens && . ~/edgelens/bin/activate && pip install --upgrade pip
pip install edgelens                  # NOT the [onnx] extra: keep NVIDIA's onnxruntime-gpu
edgelens doctor                       # readiness: clocks, power mode, power sensor, GPU providers
git clone https://github.com/Infinity-ops/edgelens && cd edgelens
edgelens benchmark --model tests/fixtures/small_cnn.onnx --iterations 300 --deadline-ms 33 --save cnn.json
edgelens periodic --model tests/fixtures/lstm_anomaly.onnx --period-ms 1000 --iterations 30

On JetPack 4.x the power sensor is root-only: edgelens doctor prints the one-line fix.

Three ways in

  1. Just a model — edgelens benchmark --model model.onnx --deadline-ms 33 — on your own data, with accuracy on the board: --inputs val_images/ --labels subfolders --image-prep imagenet (or .npy / .bin arrays)
  2. Your own pipeline, EdgeLens drives the loop — import edgelens as el, define stages, pipe.run(...)
  3. Keep your loop, add three lines — with el.trace(...) as t: ... with t.stage("inference"): ...

Full examples for all three, plus scenario packs (vision, timeseries, custom): docs/usage.md. Which example fits your system: examples/README.md. What was measured on real boards: docs/jetson.md.

Commands

Command Purpose
edgelens doctor Hardware + software fingerprint, which telemetry sources work, and benchmark readiness (clocks pinned? GPU inference? power readable?) with copyable fixes
edgelens monitor Live dashboard: CPU / GPU / RAM / temperatures / board power
edgelens benchmark --model, --pipeline or --demo; per-stage + end-to-end latency, tail, jitter, deadline, power/energy, trace
edgelens diagnose Evidence-based verdict (deadline, bottleneck, thermal, memory, pack-specific) with categorical evidence strength
edgelens report Self-contained HTML report, attachable to an issue
edgelens compare before.json after.json Before/after diff of any pipeline; PASS/REGRESSION; warns when the environment differs (--strict-env → exit code 2)
edgelens validate run.json --p99-ms 10 ... Requirements → PASS / FAIL / INCONCLUSIVE with measured values; on FAIL the limiting stage and why. Never PASSes a requirement the run cannot measure. Exit codes 0 / 1 / 2
edgelens contract init / check / run Requirements and the conditions they hold under, in one file; run measures what the contract needs and writes an evidence record
edgelens sweep One model on several backends (CPU, CUDA, TensorRT, FP16, DLA): latency, energy, and whether the outputs and decisions changed. GPU backends are implemented; sweep has not yet been run with them on a board
edgelens periodic Latency and energy at the real inference rate (e.g. 1 Hz), not back to back
edgelens soak Long runs in windows: drift, throttling, memory growth, time to out-of-memory; crash-safe JSONL
edgelens record -- CMD / watch Applications EdgeLens doesn't run: markers from C/C++ or Python, per-process CPU / memory, board telemetry
edgelens export Several runs and processes on one Perfetto timeline
edgelens selftest How much EdgeLens itself adds: harness error, span cost, sampler load on this machine
edgelens stream / replay / detect / envelope / perturb / parity Experimental: windowed sensor pipelines, decision latency, sensor faults, train/serve skew

Useful benchmark flags: --deadline-ms, --period-ms, --pace, --idle-baseline SECONDS (measures idle power first, then reports the workload's dynamic energy), --input-shape, --provider, and with --model: --inputs / --labels (real data and accuracy), --image-prep, --threads.

Exit codes: compare returns 0 (pass), 1 (regression), 2 (environments differ, with --strict-env); validate returns 0 (pass), 1 (fail), 2 (inconclusive). Both drop straight into CI.

validate requirements (any combination): --p50-ms, --p95-ms, --p99-ms (needs ≥ 100 iterations), --p99.9-ms (needs ≥ 1000), --max-latency-ms, --max-miss-ratio (needs a run with --deadline-ms), --min-fps, --max-power-w, --max-energy-mj (need a readable power sensor).

Full result schema and internals: docs/architecture.md.

Why not just jtop / Nsight / trtexec?

Tool Answers
jetson-stats (jtop) What is my board doing right now?
Nsight Systems What is my whole system doing, at the CUDA level?
trtexec How fast is this one engine?
EdgeLens Does my application meet its budget, why not, what does it cost in energy, and did my change help?

Use jtop to watch your board. Use EdgeLens to measure your application. EdgeLens does not replace these tools, and it does not import jetson-stats (AGPL); it reads the same kernel interfaces directly and stays MIT.

Contributing and citing

Bug reports with edgelens doctor output from your board are the most valuable contribution right now, especially from Jetson Orin, Xavier and Orin Nano. See CONTRIBUTING.md. If you use EdgeLens in research, please cite it (CITATION.cff; GitHub's "Cite this repository" button).

License

MIT, see LICENSE.

Metadata

Release files for edgelens 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edgelens 0.2.0
File Size Uploaded Provenance Actions
edgelens-0.2.0.tar.gz 635.6 kB With provenance Details for edgelens-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for edgelens 0.2.0
File Interpreter ABI Platform Actions
edgelens-0.2.0-py3-none-any.whl Python 3 none any Details for edgelens-0.2.0-py3-none-any.whl

Total release size: 920.0 kB

Release files / edgelens-0.2.0.tar.gz

Download URL edgelens-0.2.0.tar.gz
Size 635.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ea268f5ff33159e309233f4f9c424f4b1aa63c0fb5ee9a838d359868756f9dad
BLAKE2b-256 checksum
How to use checksums
db62ca9cc73afd2751773765c6ad710d7acbf7bd6e7639c6e1b633bd0daccced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / edgelens-0.2.0-py3-none-any.whl

Download URL edgelens-0.2.0-py3-none-any.whl
Size 284.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdefeb81378afc65af1ead91faffe68dbe6c0299c72ad84f4cacb32e097c0867
BLAKE2b-256 checksum
How to use checksums
8047566d246a47373466299de3075093e101dd545e5dfb96e40f5278805bd5d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for edgelens 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for edgelens-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page