Expand description
Latency measurement and benchmarking utilities.
Provides tools for measuring request processing latency with percentile tracking, histogram distribution, and reporting.
§Example
ⓘ
use fastapi_core::bench::{LatencyHistogram, BenchmarkRunner, BenchmarkConfig};
let config = BenchmarkConfig::new("simple_get")
.warmup_iterations(100)
.iterations(10_000);
let report = BenchmarkRunner::run(&config, || {
// exercise some code path
});
println!("{report}");Structs§
- Benchmark
Config - Configuration for a benchmark run.
- Benchmark
Runner - Runs benchmarks and collects latency data.
- Histogram
Bucket - A single histogram bucket.
- Latency
Comparison - Comparison between current and baseline latency reports.
- Latency
Histogram - Collects latency samples and computes percentile statistics.
- Latency
Report - Summary report of latency measurements.
- Memory
Comparison - Comparison between two memory reports.
- Memory
Report - Report summarizing memory usage measurements.
- Memory
Snapshot - A snapshot of memory usage at a point in time.
- Memory
Tracker - Tracks memory usage over time with baseline, peak, and delta computation.
Functions§
- format_
bytes_ size - Format a byte count in human-readable form.
- format_
duration - Format a duration in a human-readable way.