Skip to content
Back to search

hotpath-rs

Rust profiler for CPU, memory, SQL, HTTP, and async performance, with Prometheus and Grafana support.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/hotpath-rs/hotpath with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/hotpath-rs/hotpath'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/pawurb--hotpath-rs/badge.svg)](/listings/pawurb--hotpath-rs)

HTML

<a href="/listings/pawurb--hotpath-rs"><img src="/api/listings/pawurb--hotpath-rs/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

AI Setup (Recommended)

The quickest way to set up hotpath is to let your own AI coding agent do it. Install the `hotpath` CLI and run `init` inside your project repo:

cargo install hotpath --version '^0.28'
hotpath init --agent claude # or --agent codex / --agent opencode

`hotpath init` downloads the [hotpath_init agent skill](skills/hotpath_init/SKILL.md) from GitHub and starts an interactive Claude Code, Codex or OpenCode session with it as setup instructions. The agent inspects your project, adds the feature-gated dependency, instruments `main` and a starting set of functions, channels and locks, then verifies that everything compiles with profiling enabled and disabled. You review and approve each edit through the agent's regular permission prompts. Requires `curl` and the `claude`, `codex` or `opencode` CLI on `PATH`.

You can also use the skill directly, without the hotpath CLI: copy it to `~/.claude/skills/hotpath_init/SKILL.md` and run `/hotpath_init` in a Claude Code session.

Manual installation

Add to your `Cargo.toml`:

[dependencies]
hotpath = "0.28"

[features]
hotpath = ["hotpath/hotpath"]
hotpath-cpu = ["hotpath/hotpath-cpu"]
hotpath-alloc = ["hotpath/hotpath-alloc"]
hotpath-prometheus = ["hotpath/hotpath-prometheus"]

This config ensures that the lib has no compile time or runtime overhead unless explicitly enabled via a `hotpath` feature. All the lib dependencies are optional (i.e. not compiled) and all macros are noop unless profiling is enabled.

Basic setup

You'll need only `#[hotpath::main]` and `#[hotpath::measure]` macros to get started:

#[hotpath::measure]
fn sync_function(sleep: u64) {
    std::thread::sleep(Duration::from_nanos(sleep));
    let vec1 = vec![1, 2, 3];
    std::hint::black_box(&vec1); // force mem allocation
}

#[hotpath::measure]
async fn async_function(sleep: u64) {
    tokio::time::sleep(Duration::from_nanos(sleep)).await;
}

// When using with tokio, place the #[tokio::main] first
#[tokio::main]
#[hotpath::main]
async fn main() {
    for i in 0..10000 {
        sync_function(i);
        async_function(i * 2).await;

        hotpath::measure_block!("custom_block", {
            std::thread::sleep(Duration::from_nanos(i * 3))
        });
    }
}

Now, run your program with `hotpath` (and optionally `hotpath-alloc` features):

cargo run --features='hotpath,hotpath-alloc'

On exit it will print a report with timings, memory allocations and thread usage metrics:

[hotpath] 1.20s | timing, alloc, threads

timing - Function execution time metrics.
+------------------------------+-------+----------+----------+----------+---------+
| Function                     | Calls | Avg      | P95      | Total    | % Total |
+------------------------------+-------+----------+----------+----------+---------+
| docs_example::main           | 1     | 1.20 s   | 1.20 s   | 1.20 s   | 100.00% |
+------------------------------+-------+----------+----------+----------+---------+
| docs_example::async_function | 1000  | 1.15 ms  | 1.20 ms  | 1.15 s   | 96.10%  |
+------------------------------+-------+----------+----------+----------+---------+
| custom_block                 | 1000  | 18.13 µs | 31.71 µs | 18.13 ms | 1.51%   |
+------------------------------+-------+----------+----------+----------+---------+
| docs_example::sync_function  | 1000  | 16.58 µs | 27.63 µs | 16.58 ms | 1.38%   |
+------------------------------+-------+----------+----------+----------+---------+

alloc - Cumulative allocations during each function call (including nested calls).
+------------------------------+-------+---------+---------+---------+---------+
| Function                     | Calls | Avg     | P95     | Total   | % Total |
+------------------------------+-------+---------+---------+---------+---------+
| docs_example::main           | 1     | 63.0 KB | 63.1 KB | 63.0 KB | 100.00% |

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 228 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # <img src="media/hotpath-logo2.png" alt="hotpath-rs logo" width="80px" align="left"> hotpath-rs - Rust Profiler for Easy Performance Debugging
  2. [![Latest Version](https://img.shields.io/crates/v/hotpath.svg)](https://crates.io/crates/hotpath) [![Downloads](https://img.shields.io/crates/d/hotpath?cacheSeconds=86400)](https://crates.io/crates/hotpath) [![hotpath-cloud](https://img.shields.io/endpoint?url=https://hotpath.rs/badge-cloud.json)](https://hotpath.rs/app/repos/hotpath-rs/hotpath) [![Sponsor](https://img.shields.io/badge/Sponsor-hotpath--rs-6f42c1)](https://hotpath.rs/sponsorship)
  3. A simple Rust profiler that shows exactly why your code is slow.
  4. **Performance profiling for developers and coding agents.** Profile CPU, memory allocations, async tasks, SQL queries, I/O, and lock contention in one place. Explore performance metrics in a live TUI, or export to Prometheus and Grafana when you need production monitoring.
  5. **Already using Criterion.rs?** Criterion tells you how fast your code runs. **hotpath-rs explains why.** Add detailed CPU and memory profiling to your existing Criterion benchmarks with minimal changes. [Explore Criterion integration →](https://hotpath.rs/criterion)
  6. Find bottlenecks locally, then use [hotpath-cloud](https://hotpath.rs/cloud) to track performance changes across pull requests.
  7. Try the TUI demo via SSH - no installation required:
  8. ```
  9. ssh demo.hotpath.rs
  10. ```
  11. Or let your AI coding agent set up profiling, paste into Claude Code, Codex, OpenCode or Cursor:
  12. ```
  13. Set up hotpath-rs profiling in this Rust project using the instructions at https://hotpath.rs/agent/setup
  14. ```
  15. [hotpath-rs](https://hotpath.rs) is an easy-to-configure Rust performance profiling toolkit that shows exactly where your code spends time, burns CPU, and allocates memory.
  16. It helps you distinguish between functions that are slow because they wait on I/O and those that are CPU-intensive. Instrument functions, channels, futures, streams, SQL queries, HTTP calls, and byte-level I/O to find bottlenecks and focus optimizations where they matter most. Get actionable insights into time, memory, and async data flow with minimal setup.
  17. Explore the full documentation at [hotpath.rs](https://hotpath.rs). See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
  18. You can use it to produce one-off performance (timing, memory or CPU) reports:
  19. ![hotpath alloc report](media/hotpath-alloc-report2.png)
  20. correlate all performance signals in Grafana with minimal profiling overhead:
  21. ![Grafana dashboard built on hotpath-rs Prometheus metrics showing slowest SQL queries, per-function allocations and requests by route](docs/src/images/grafana-dashboard.png)
  22. catch performance regressions on every pull request with a simple [CI integration](https://hotpath.rs/cloud):
  23. ![hotpath-cloud pull request comment showing wall time, allocation and RSS changes against the main branch](docs/src/images/cloud-pr-comment.webp)
  24. inspect throughput and latency of network, file or compression I/O streams:
  25. ![hotpath-rs I/O profiling report showing per-stream read counts, bytes, transfer rate, average and P95 latency](media/io_metrics.png)
  26. analyze SQL/HTTP calls performance with automatic source function attribution:
  27. ![hotpath-rs SQL query profiling report showing per-query call counts, source function attribution, average and P95 execution time](media/sql_metrics.png)
  28. monitor throughput, performance and max queue depth of instrumented channels:
  29. ![hotpath-rs channel profiling report showing throughput, send-to-receive latency and max queue depth per channel](media/channel_metrics.png)
  30. or use the live TUI dashboard to monitor real-time performance and async data flow metrics with debug info:
  31. https://github.com/user-attachments/assets/2e890417-2b43-4b1b-8657-a5ef3b458153
  32. ## Features
  33. - **Time, CPU & memory profiling** - identify expensive functions, allocation hotspots, and investigate memory leaks.
  34. - **Async observability** - futures, channels and streams.
  35. - **I/O monitoring** - bytes, throughput, latency of any sync or async IO stream like files, TCP, or compression.
  36. - **SQL query profiling** - query performance metrics for sqlx and Diesel.
  37. - **HTTP calls profiling** - per-endpoint latency and error metrics for reqwest and ureq.
  38. - **HTTP server profiling** - per-route response time and error metrics for axum.
  39. - **Concurrency metrics** - Mutex/RwLock wait time and contention.
  40. - **Tokio runtime monitoring** - workers, scheduling and queues.
  41. - **Prometheus & Grafana integration** - export profiling metrics to your existing dashboards.
  42. - **Live TUI dashboard & static reports** - real-time or one-off analysis.
  43. - **CI regression detection** - benchmark every PR automatically.
  44. - **MCP server for AI agents** - query profiling data in real time.
  45. - **Zero cost when disabled** - fully feature-gated.
  46. ## Getting Started
  47. ### AI Setup (Recommended)
  48. The quickest way to set up hotpath is to let your own AI coding agent do it. Paste this prompt into Claude Code, Codex, OpenCode, Cursor or any other coding agent, inside your project repo:
  49. ```text
  50. Set up hotpath-rs profiling in this Rust project using the instructions at https://hotpath.rs/agent/setup
  51. ```
  52. The agent inspects your project, including workspaces and any existing hotpath setup, adds the feature-gated dependency, instruments `main` and a small starting set of hot functions, channels and locks, and verifies that everything compiles with profiling enabled and disabled. When the project has a workload that exits, it runs it and shows you the first report; it does not start long-running servers just to get one. It then explains how to run profiling and the live TUI. It finally asks once whether to optionally set up [hotpath-cloud](https://hotpath.rs/cloud) to benchmark pull requests in CI.
  53. The prompt is a one-time project setup. The `hotpath-rs` [agent skill](skills/hotpath-rs/SKILL.md) is what stays: reusable hotpath knowledge your agent loads in every later session. To install it, for example in a repo that already uses hotpath, run:
  54. ```bash
  55. npx skills add hotpath-rs/hotpath --skill hotpath-rs
  56. ```
  57. The skill maps every hotpath task, from instrumenting a crate to fixing a regression flagged in CI, to the documentation page that covers it, so your agent fetches the current docs instead of relying on its memory. Your agent remains in control: you review and approve edits through its regular permission prompts.
  58. ### Manual installation
  59. Add to your `Cargo.toml`:
  60. ```toml
  61. [dependencies]
  62. hotpath = "0.32"
  63. [features]
  64. hotpath = ["hotpath/hotpath"]
  65. hotpath-cpu = ["hotpath", "hotpath/hotpath-cpu"]
  66. hotpath-callgrind = ["hotpath", "hotpath/hotpath-callgrind"]
  67. hotpath-alloc = ["hotpath", "hotpath/hotpath-alloc"]
  68. hotpath-prometheus = ["hotpath", "hotpath/hotpath-prometheus"]
  69. ```
  70. This config ensures that the lib has no compile time or runtime overhead unless explicitly enabled via one of the `hotpath` features. Every profiling feature also enables `hotpath`, so a single flag like `--features=hotpath-alloc` is enough. All the lib dependencies are optional (i.e. not compiled) and all macros are noop unless profiling is enabled.
  71. #### Basic setup
  72. You'll need only `#[hotpath::main]` and `#[hotpath::measure]` macros to get started:
  73. ```rust
  74. #[hotpath::measure]
  75. fn sync_function(sleep: u64) {
  76. std::thread::sleep(Duration::from_nanos(sleep));
  77. let vec1 = vec![1, 2, 3];
  78. std::hint::black_box(&vec1); // force mem allocation
  79. }
  80. #[hotpath::measure]
  81. async fn async_function(sleep: u64) {
  82. tokio::time::sleep(Duration::from_nanos(sleep)).await;
  83. }
  84. // When using with tokio, place the #[tokio::main] first
  85. #[tokio::main]
  86. #[hotpath::main]
  87. async fn main() {
  88. for i in 0..1000 {
  89. sync_function(i);
  90. async_function(i * 2).await;
  91. hotpath::measure_block!("custom_block", {
  92. std::thread::sleep(Duration::from_nanos(i * 3))
  93. });
  94. }
  95. }
  96. ```
  97. Now, run your program with `hotpath` (and optionally `hotpath-alloc` features):
  98. ```bash
  99. cargo run --features='hotpath-alloc'
  100. ```
  101. On exit it will print a report with timings, memory allocations and thread usage metrics:
  102. ```
  103. [hotpath] 1.20s | timing, alloc, threads
  104. timing - Function execution time metrics.
  105. +------------------------------+-------+----------+----------+----------+---------+
  106. | Function | Calls | Avg | P95 | Total | % Total |
  107. +------------------------------+-------+----------+----------+----------+---------+
  108. | docs_example::main | 1 | 1.20 s | 1.20 s | 1.20 s | 100.00% |
  109. +------------------------------+-------+----------+----------+----------+---------+
  110. | docs_example::async_function | 1,000 | 1.16 ms | 1.24 ms | 1.16 s | 96.84% |
  111. +------------------------------+-------+----------+----------+----------+---------+
  112. | custom_block | 1,000 | 16.86 µs | 29.50 µs | 16.86 ms | 1.41% |
  113. +------------------------------+-------+----------+----------+----------+---------+
  114. | docs_example::sync_function | 1,000 | 12.16 µs | 23.84 µs | 12.17 ms | 1.02% |
  115. +------------------------------+-------+----------+----------+----------+---------+
  116. alloc-bytes - Exclusive allocation bytes by each function (excluding nested calls).
  117. Total: 100.1 KB
  118. +------------------------------+-------+---------+---------+---------+---------+
  119. | Function | Calls | Avg | P95 | Total | % Total |
  120. +------------------------------+-------+---------+---------+---------+---------+
  121. | docs_example::main | 1 | 88.4 KB | 88.4 KB | 88.4 KB | 88.29% |
  122. +------------------------------+-------+---------+---------+---------+---------+
  123. | docs_example::sync_function | 1,000 | 12 B | 12 B | 11.7 KB | 11.71% |
  124. +------------------------------+-------+---------+---------+---------+---------+
  125. | custom_block | 1,000 | 0 B | 0 B | 0 B | 0.00% |
  126. +------------------------------+-------+---------+---------+---------+---------+
  127. | docs_example::async_function | 1,000 | 0 B | 0 B | 0 B | 0.00% |
  128. +------------------------------+-------+---------+---------+---------+---------+
  129. threads - Thread CPU and memory statistics. (Max RSS: 8.6 MB, Alloc: 108.5 KB, Dealloc: 123.8 KB, Diff: -15.3 KB, 5/15)
  130. +-----------------+------+------+----------+---------+----------+
  131. | Thread | Max% | Avg% | Alloc | Dealloc | Diff |
  132. +-----------------+------+------+----------+---------+----------+
  133. | main | 4.5% | 3.8% | 100.1 KB | 46.0 KB | 54.0 KB |
  134. +-----------------+------+------+----------+---------+----------+
  135. | tokio-rt-worker | 0.0% | 0.0% | 79 B | 70.1 KB | -70.0 KB |
  136. +-----------------+------+------+----------+---------+----------+
  137. | tokio-rt-worker | 0.0% | 0.0% | 4.2 KB | 471 B | 3.8 KB |
  138. +-----------------+------+------+----------+---------+----------+
  139. | tokio-rt-worker | 0.0% | 0.0% | 3.3 KB | 407 B | 2.9 KB |
  140. +-----------------+------+------+----------+---------+----------+
  141. | hp-functions | 1.3% | 1.0% | 0 B | 2.0 KB | -2.0 KB |
  142. +-----------------+------+------+----------+---------+----------+
  143. ```
  144. ## Full documentation
  145. See the full docs and advanced config tutorials at [hotpath.rs](https://hotpath.rs).
  146. Read the [complete guide to profiling Rust applications](https://hotpath.rs/blog/profiling-rust-guide) - a comprehensive overview of debugging performance issues in Rust.
  147. - [Profiling modes](https://hotpath.rs/profiling_modes) - static reports vs live TUI dashboard
  148. - [Profiling overhead](https://hotpath.rs/profiling_overhead) - per-operation instrumentation cost and time sampling
  149. - [Functions](https://hotpath.rs/functions) - measure execution time and memory allocations
  150. - [CPU profiling](https://hotpath.rs/cpu_profiling) - attribute CPU samples to instrumented functions
  151. - [Threads](https://hotpath.rs/threads) - monitor threads usage
  152. - [Async Data Flow](https://hotpath.rs/data_flow) - monitor channels, streams, and futures
  153. - [Locks](https://hotpath.rs/locks) - track Mutex and RwLock wait and hold times
  154. - [SQL queries](https://hotpath.rs/sql_tracing) - profile query execution time for sqlx and Diesel
  155. - [HTTP requests](https://hotpath.rs/http_tracing) - profile reqwest and ureq client calls per endpoint
  156. - [HTTP server (axum)](https://hotpath.rs/axum_tracing) - profile axum request latency and errors per route
  157. - [I/O tracing](https://hotpath.rs/io_tracing) - monitor bytes, throughput and duration of TCP, Redis, and file operations
  158. - [Tokio Runtime](https://hotpath.rs/tokio_runtime) - monitor Tokio runtime worker stats and task scheduling
  159. - [Debug & Metrics](https://hotpath.rs/debug) - track custom values with dbg!, val!, and gauge! macros
  160. - [Prometheus & Grafana](https://hotpath.rs/prometheus_grafana) - export metrics to Prometheus and build Grafana dashboards
  161. - [Criterion benchmarks](https://hotpath.rs/criterion) - profile existing Criterion benchmarks with timing, allocations and Callgrind instruction counts
  162. - [hotpath-cloud CI integration](https://hotpath.rs/ci_integration) - performance regression detection on every pull request
  163. - [MCP Server](https://hotpath.rs/mcp) - LLM integration via Model Context Protocol
  164. - [Cargo flamegraph alternatives](https://hotpath.rs/blog/sampling_comparison) - when to use `hotpath` vs sampling profilers like perf and samply
  165. - [Configuration](https://hotpath.rs/configuration) - explore all config options
  166. ## hotpath-cloud
  167. [hotpath-cloud](https://hotpath.rs/cloud) turns profiling data into automated performance reviews for Rust pull requests.
  168. Detect performance regressions before they ship by comparing CPU instruction counts, memory allocations, execution times, and SQL queries across PRs. Define performance budgets, get actionable feedback directly in GitHub, and investigate regressions using AI coding agents.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.