| Crates.io | rustmeter |
| lib.rs | rustmeter |
| version | 0.2.0 |
| created_at | 2025-12-10 08:51:51.74042+00 |
| updated_at | 2026-01-25 14:33:58.56856+00 |
| description | RustMeter CLI application to interact with RustMeter beacons and export Perfetto traces. |
| homepage | |
| repository | https://github.com/Christopher-06/rustmeter |
| max_upload_size | |
| id | 1977699 |
| size | 288,547 |
RustMeter is a comprehensive profiling, tracing, and monitoring system designed specifically for Embedded Rust applications. It is highly integrated with the Embassy async framework and defmt logging system. The collected data is converted into a format that can be directly visualized in the Perfetto UI, providing detailed insights into runtime behavior, task scheduling, and firmware performance.

#[monitor_fn] to measure execution times of functions and granular measurement of specific code blocks using monitor_scoped!.monitor_value!.The repository consists of two main components:
rustmeter-beacon: The library included in your embedded firmware. It provides macros and hooks for embassy-executor and defmt.
rustmeter-cli: The command-line tool for the developer PC. It runs the project, collects tracing data, and creates the JSON file for Perfetto.
Add rustmeter-beacon to your embedded project's Cargo.toml and initialize it in your code. Follow the instructions in the rustmeter-beacon README for detailed setup and usage.
Install the host tool locally:
cargo install rustmeter
and run your embedded project with:
rustmeter run --release --chip <YOUR_CHIP>
or adjust your cargo runner in .cargo/config.toml:
[target.XXX-XXX-XXX]
runner = "rustmeter run --chip <YOUR_CHIP>" # Adjust target accordingly
and use cargo run as usual:
cargo run --release
Any tracing system introduces some overhead. RustMeter is designed to be lightweight, but it's essential to understand its impact on your application. Any measurement or event emitted incurs a small time cost. The future goal is to even lower the following overheads; especially on Cortex-M based MCUs to <1us. RustMeter uses a lock-free ringbuffer per core to fastly enqueue events, which are then sent out via RTT or UART/Serial JTAG in the background. This approach minimizes the blocking time in your application code and allows high-frequency logging; e.q. multiple tasks running each millisecond!
Espressif MCUs have been optimized to cost around 0.4 - 1.2us per event, depending on the clock speed and bus usage (e.q. tested on ESP32 @ 100 Mhz and ESP32-S3 @ 240 Mhz).
Cortex-M based MCUs like STM32 and RP2040 currently have a higher overhead of around 1 - 8us per event due to lower frequencies, the lack of optimized atomic operations and cache mechanisms. Further optimizations are planned in future releases (e.q. tested on STM32F446 @ 80 Mhz and RP2040 @ 100 Mhz).
All measured times then include not only the actual event time, but also this overhead, which determines the accuracy of rustmeter. So any instrumentation should be used judiciously in performance-critical sections. However, for many applications, the overhead is negligible compared to the insights gained from detailed profiling. Any measurement value
trace feature is enabled for embassy-executor in your Cargo.toml.#[monitor_fn] on a simple function and logging via defmt. Ensure that you are not using incompatible crates like esp-println or rtt-target which interfere communication.This project is licensed under the MIT License. See LICENCE for details.
Note: This tool is still under heavy development. APIs are subject to change.