1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! A universal load testing library for Rust, with real-time tui support.
//!
//! This crate provides a simple way to create load test tools in Rust. It is designed
//! to be a universal load test framework, which means you can use rlt for various
//! services, such as Http, gRPC, Thrift, Database, or other customized services.
//!
//! ## Features
//!
//! - **Flexible**: Customize the work load with your own logic.
//! - **Easy to use**: Little boilerplate code, just focus on testing.
//! - **Rich Statistics**: Collect and display rich statistics.
//! - **High performance**: Optimized for performance and resource usage.
//! - **Real-time TUI**: Monitor testing progress with a powerful real-time TUI.
//!
//! ## Example
//!
//! A simple example of a stateless bench suite:
//!
//! ```no_run
//! use anyhow::Result;
//! use async_trait::async_trait;
//! use clap::Parser;
//! use rlt::{cli::BenchCli, IterInfo, IterReport, StatelessBenchSuite, Status};
//! use tokio::time::Instant;
//!
//! #[derive(Clone)]
//! struct SimpleBench;
//!
//! #[async_trait]
//! impl StatelessBenchSuite for SimpleBench {
//! async fn bench(&mut self, _: &IterInfo) -> Result<IterReport> {
//! let t = Instant::now();
//! // do the work here
//! let duration = t.elapsed();
//!
//! let report = IterReport {
//! duration,
//! status: Status::success(0),
//! bytes: 42, // bytes processed in current iteration
//! items: 5, // items processed in current iteration
//! };
//! Ok(report)
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! rlt::cli::run(BenchCli::parse(), SimpleBench).await
//! }
//! ```
//!
//! Stateful bench is also supported, see the [examples/http_reqwest](https://github.com/wfxr/rlt/blob/main/examples/http_reqwest.rs).
pub
pub use crate::;
pub use TuiTracingSubscriberLayer;