Expand description
hotpath-rs is a simple async Rust profiler. It instruments functions, channels, futures, and streams to quickly find bottlenecks and focus optimizations where they matter most. It can provide actionable insights into time, memory, and data flow with minimal setup.
§Setup & Usage
For a complete setup guide, examples, and advanced configuration, visit hotpath.rs.
Re-exports§
pub use json::Route;
Modules§
- channels
- Channel instrumentation module - tracks message flow, queue sizes, and channel state.
- cpu_
baseline - data_
flow - Unified data flow module - provides shared counter and types for channels, streams, and futures.
- debug
- Debug subsystem - value logging, debug logging, and gauges.
- functions
- Function profiling module - measures execution time and memory allocations per function.
- futures
- Futures instrumentation module - tracks async Future lifecycle and poll statistics.
- hotpath_
guard - json
- JSON serializable types for TUI and CLI consumers.
- streams
- Stream instrumentation module - tracks items yielded and stream lifecycle.
- threads
- This module provides real-time thread monitoring capabilities, collecting CPU usage statistics for all threads in the current process.
Macros§
- channel
- Instrument a channel creation to wrap it with debugging proxies.
- dbg
- Debug macro that tracks debug output in the profiler.
- future
- Instrument a future to inspect future’s lifecycle events.
- gauge
- Gauge macro for tracking numeric values with set/inc/dec operations.
- measure_
block - Measures the execution time or memory allocations of a code block.
- stream
- Instrument a stream to track its item yields.
- tokio_
runtime - val
- Value tracking macro that logs key-value pairs to the profiler.
Structs§
- Function
Logs List - Response containing recent logs for a function
- Function
Stats - Hotpath
Guard - RAII guard that owns the profiler lifetime.
- Hotpath
Guard Builder - Builder for
HotpathGuard— a programmatic alternative to the#[hotpath::main]macro for configuring and initializing the profiler. - Measurement
Guard - Measurement
Guard With Log
Enums§
- Format
- Output format for profiling reports.
- Metric
Type - Represents different types of profiling metrics with their values.
- Output
Destination - Destination for profiling report output.
- Profiling
Mode - Profiling mode indicating what type of measurements were collected.
- Section
Constants§
Traits§
- IntoF64
- Metrics
Provider - Trait for accessing profiling metrics data.
Functions§
- ceil_
char_ boundary - floor_
char_ boundary - format_
bytes - Formats a byte count into a human-readable string (e.g., “1.5 MB”).
- format_
debug_ truncated - format_
duration - Formats a duration in nanoseconds into a human-readable string with appropriate units.
- parse_
bytes - Parses a human-readable byte string back to a byte count.
Inverse of
format_bytes. - parse_
duration - Parses a human-readable duration string back to nanoseconds.
Inverse of
format_duration. - shorten_
function_ name
Type Aliases§
- Functions
Data - Structured per-function profiling metrics data as an ordered list.
Attribute Macros§
- future_
fn - Instruments an async function to track its lifecycle as a Future.
- main
- Initializes the hotpath profiling system and generates a performance report on program exit.
- measure
- Instruments a function to measure execution time or memory allocations.
- measure_
all - Instruments all functions in a module or impl block with the
measureprofiling macro. - skip
- Marks a function to be excluded from profiling when used with
measure_all.