Classes
WorkloadResult
10
▼
Results from a single workload run.
WorkloadResult
10
▼
Results from a single workload run.
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
total_requests |
int
|
— |
errors |
int
|
— |
duration_s |
float
|
— |
latencies_ms |
list[float]
|
— |
rss_mb |
float
|
— |
Methods
rps
0
float
▼
property
rps
0
float
▼
def rps(self) -> float
Returns
float
p50
0
float
▼
property
p50
0
float
▼
def p50(self) -> float
Returns
float
p95
0
float
▼
property
p95
0
float
▼
def p95(self) -> float
Returns
float
p99
0
float
▼
property
p99
0
float
▼
def p99(self) -> float
Returns
float
BenchSuite
5
▼
Results from a complete benchmark suite.
BenchSuite
5
▼
Results from a complete benchmark suite.
Attributes
| Name | Type | Description |
|---|---|---|
label |
str
|
— |
workers |
int
|
— |
connections |
int
|
— |
duration |
int
|
— |
workloads |
list[WorkloadResult]
|
— |
Functions
_find_free_port
0
int
▼
Find an available TCP port.
_find_free_port
0
int
▼
def _find_free_port() -> int
Returns
int
_get_rss_mb
1
float
▼
Get resident set size in MB for a process.
Tries platform-specific approaches …
_get_rss_mb
1
float
▼
def _get_rss_mb(pid: int) -> float
Get resident set size in MB for a process.
Tries platform-specific approaches in order:
- /proc/{pid}/status (Linux)
- ps command (macOS / BSD)
Parameters
| Name | Type | Description |
|---|---|---|
pid |
int |
Returns
float
_wait_for_server
3
bool
▼
Wait until a server is accepting connections.
_wait_for_server
3
bool
▼
def _wait_for_server(host: str, port: int, timeout: float = 10.0) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
host |
str |
|
port |
int |
|
timeout |
float |
Default:10.0
|
Returns
bool
_write_bench_app
1
None
▼
Write the benchmark ASGI app to a temporary file.
_write_bench_app
1
None
▼
def _write_bench_app(path: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
path |
str |
_emit
1
None
▼
Write a benchmark progress message to stderr.
_emit
1
None
▼
def _emit(msg: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
msg |
str |
_drive_load
7
tuple[int, int, list[flo…
▼
Drive HTTP load from multiple threads.
Returns (total_requests, errors, latenc…
_drive_load
7
tuple[int, int, list[flo…
▼
def _drive_load(host: str, port: int, path: str, method: str, body: bytes | None, duration: float, connections: int) -> tuple[int, int, list[float]]
Drive HTTP load from multiple threads.
Returns (total_requests, errors, latencies_ms).
Parameters
| Name | Type | Description |
|---|---|---|
host |
str |
|
port |
int |
|
path |
str |
|
method |
str |
|
body |
bytes | None |
|
duration |
float |
|
connections |
int |
Returns
tuple[int, int, list[float]]
_run_bench
6
BenchSuite
▼
Run a full benchmark suite against a server command.
Starts the server, runs e…
_run_bench
6
BenchSuite
▼
def _run_bench(server_cmd: list[str], label: str, duration: int, connections: int, host: str, port: int) -> BenchSuite
Run a full benchmark suite against a server command.
Starts the server, runs each workload, collects results, and stops the server.
Parameters
| Name | Type | Description |
|---|---|---|
server_cmd |
list[str] |
|
label |
str |
|
duration |
int |
|
connections |
int |
|
host |
str |
|
port |
int |
Returns
BenchSuite
_format_results
1
str
▼
Render benchmark results as a plain text table.
_format_results
1
str
▼
def _format_results(suites: list[BenchSuite]) -> str
Parameters
| Name | Type | Description |
|---|---|---|
suites |
list[BenchSuite] |
Returns
str
register_bench_command
1
None
▼
Register the ``bench`` subcommand on the CLI.
register_bench_command
1
None
▼
def register_bench_command(cli: Any) -> None
Parameters
| Name | Type | Description |
|---|---|---|
cli |
Any |