Skip to main content

Module profiling

Module profiling 

Source
Expand description

Process-global live profiling.

Unlike Python’s package imports, Rust module declarations are resolved statically and do not execute in source order. The profiler can therefore stay in the normal crate module graph without a late-import workaround for circular initialization. Lightweight live profiling compatible with Reticulum’s profiler results.

Create a guard with profile or profile_with_parent. A capture is registered immediately and completed when the guard is dropped, which makes nested and reentrant calls independently visible without reporting partial durations. Results are process-global and bounded per tag so the daemon can expose them indefinitely over local and remote status APIs.

Structs§

ProfileGuard
A timing sample that is completed when the guard is dropped.
ProfilingResult
ProfilingStats

Constants§

MAX_CAPTURES
Default maximum retained samples for each tag across all threads.

Functions§

profile
Start profiling a top-level tag with the default retention limit.
profile_function
Run a function or closure under a profiling tag and return its result.
profile_function_with_limit
Run a function or closure under a profiling tag with a custom retention limit and return its result.
profile_with_limit
Start profiling a top-level tag with a custom per-tag retention limit.
profile_with_parent
Start profiling a tag nested under parent in formatted results.
profile_with_parent_and_limit
Start nested profiling with a custom per-tag retention limit.
ran
Return whether at least one timing sample has completed.
results
Return a stable, tag-sorted snapshot of all retained completed samples.
results_msgpack
Snapshot results in the dictionary shape used by remote management.
results_pickle
Snapshot results in the dictionary shape used by Python’s local RPC.