forked from vshn/k8s-storage-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.py
executable file
·30 lines (23 loc) · 942 Bytes
/
render.py
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
#!/usr/bin/env python3.8
import json
import sys
from datetime import datetime
from graphs import render_results
if __name__ == "__main__":
if len(sys.argv) < 2 or sys.argv[1] in ["-h", "--help"]:
print(f"Usage: {sys.argv[0]} <results-file> [<results-file> [...]]\n")
print(
"This command can be used to plot the benchmark results provided in the\n"
+ "<results-file> arguments. The command expects that the results are in\n"
+ "the JSON format emitted by the bundled `bench.py` script."
)
sys.exit(1)
results = []
for fname in sys.argv[1:]:
try:
with open(fname) as resf:
results.extend(json.load(resf))
except Exception as e:
print(f"Unable to load data from {fname}: {e}")
timestamp = datetime.now().strftime("%Y_%m_%d_%H%M%S")
render_results(results, filename=f"results_{timestamp}.pdf")