-
Notifications
You must be signed in to change notification settings - Fork 88
/
.run_combine_benchmark_results
executable file
·55 lines (45 loc) · 1.33 KB
/
.run_combine_benchmark_results
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
#!/usr/bin/python3
import json
import os
workspace_dir = "/__w/tesseract/tesseract/target_ws"
build_dir = workspace_dir + "/build"
result_files = []
search_path = build_dir + "/tesseract_collision/test/benchmarks"
for file in os.listdir(search_path):
if file.endswith(".json"):
result_files.append(os.path.join(search_path, file))
# endif
# endfor
search_path = build_dir + "/tesseract_environment/test/benchmarks"
for file in os.listdir(search_path):
if file.endswith(".json"):
result_files.append(os.path.join(search_path, file))
# endif
#endfor
cnt = 0
all_data = {}
for file in result_files:
# Opening JSON file
f = open(file, "r")
# returns JSON object as a dictionary
data = json.loads(f.read())
if cnt == 0:
all_data = data
else:
for benchmark in data["benchmarks"]:
all_data["benchmarks"].append(benchmark)
# endfor
# endif
# Closing file
f.close()
# Increment counter
cnt+=1
# endfor
# the base path to where the output must be stored
if not os.path.exists(workspace_dir + "/benchmarks"):
os.makedirs(workspace_dir + "/benchmarks")
# endif
# the json file where the output must be stored
out_file = open(workspace_dir + "/benchmarks/tesseract-benchmark_result.json", "w+")
json.dump(all_data, out_file, indent = 4)
out_file.close()