Skip to content

Commit 8dbbaf7

Browse files
committed
wip
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent c5c4c8d commit 8dbbaf7

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env python3
2+
import json
3+
import sys
4+
import os
5+
6+
def convert_to_markdown(json_file):
7+
"""Convert performance test JSON results to markdown format"""
8+
try:
9+
with open(json_file, 'r') as f:
10+
data = json.load(f)
11+
except FileNotFoundError:
12+
return "## Performance Test Results\n\nNo performance test results found."
13+
except json.JSONDecodeError:
14+
return "## Performance Test Results\n\nError parsing performance test results."
15+
16+
markdown = "## Performance Test Results\n\n"
17+
18+
if 'summaries' not in data or not data['summaries']:
19+
return markdown + "No test summaries available."
20+
21+
for summary in data['summaries']:
22+
name = summary.get('name', 'Unknown Test')
23+
duration = summary.get('duration', 0)
24+
processors = summary.get('numberOfProcessors', 0)
25+
max_memory = summary.get('maxMemory', 0)
26+
27+
# Convert memory from bytes to GB
28+
max_memory_gb = max_memory / (1024 ** 3) if max_memory > 0 else 0
29+
30+
markdown += f"### {name}\n\n"
31+
markdown += "| Metric | Value |\n"
32+
markdown += "|--------|-------|\n"
33+
markdown += f"| Duration | {duration} ms |\n"
34+
markdown += f"| Processors | {processors} |\n"
35+
markdown += f"| Max Memory | {max_memory_gb:.2f} GB |\n"
36+
markdown += "\n"
37+
38+
return markdown
39+
40+
if __name__ == "__main__":
41+
if len(sys.argv) != 2:
42+
print("Usage: performance-to-markdown.py <json_file>")
43+
sys.exit(1)
44+
45+
json_file = sys.argv[1]
46+
markdown = convert_to_markdown(json_file)
47+
print(markdown)

0 commit comments

Comments
 (0)