forked from microsoft/agent-governance-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_all.py
More file actions
59 lines (46 loc) · 1.53 KB
/
run_all.py
File metadata and controls
59 lines (46 loc) · 1.53 KB
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
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Run all Agent SRE performance benchmarks.
Usage:
python benchmarks/run_all.py [--iterations N]
"""
from __future__ import annotations
import argparse
import sys
from benchmarks.bench_chaos import run_all as chaos_benchmarks
from benchmarks.bench_delivery import run_all as delivery_benchmarks
from benchmarks.bench_slo import run_all as slo_benchmarks
HEADER = (
f"{'Benchmark':30s} {'Throughput':>14s} {'p50':>10s} {'p99':>10s}"
)
SEP = "-" * len(HEADER)
def main() -> None:
parser = argparse.ArgumentParser(description="Agent SRE performance benchmarks")
parser.add_argument(
"--iterations", "-n", type=int, default=10_000, help="Iterations per benchmark"
)
args = parser.parse_args()
n = args.iterations
print()
print("Agent SRE — Performance Benchmarks")
print(f"Iterations per benchmark: {n:,}")
print()
print(HEADER)
print(SEP)
sections = [
("SLO Engine", slo_benchmarks),
("Chaos Engine", chaos_benchmarks),
("Progressive Delivery", delivery_benchmarks),
]
for section_name, runner in sections:
print(f"\n [{section_name}]")
for r in runner(n):
throughput = f"{r.throughput:,.0f} ops/sec"
p50 = f"{r.p50_us:.2f}µs"
p99 = f"{r.p99_us:.2f}µs"
print(f" {r.name:28s} {throughput:>14s} {p50:>10s} {p99:>10s}")
print()
print("Done.")
if __name__ == "__main__":
main()