blob: 4190ef2d9b7c99b8a2204cc1d5878ee9a75bbf46 (
plain)
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
|
import sys
import glob
import os
import subprocess
"""
Benchmarks provides a more convenient way to access benchmark info laid out in results_dir. """
class Benchmark:
def __init__(self, name, node_path):
self._name = name
self._node_path = node_path
@property
def name(self):
return self._name
@property
def exe_path(self):
exe_paths = glob.glob("{0}/perf.*.data/.debug/**/{1}/**/elf".format(self._node_path, self.name), recursive=True)
if len(exe_paths) == 0:
raise AssertionError("For {0}, no exe found".format(self.name))
elif len(exe_paths) > 1:
raise AssertionError("Multiple paths found for {0}: {1}".format(self.name, exe_paths))
assert len(exe_paths) == 1
return exe_paths[0]
@property
def exe_name(self):
return self.exe_path.split("/")[-3]
@property
def libs(self):
root_libpath = self._node_path + "/perf.*.data/.debug/home/tcwg-benchmark/sysroot/lib"
libpaths = glob.glob("{0}/*/*/elf".format(root_libpath), recursive = True)
_libs = {}
for libpath in libpaths:
name = libpath.split("/")[-3]
_libs[name] = libpath
return _libs
def __repr__(self):
return "name = {0}\nnode_path={1}\nexe_path={2}\nexe_name={3}\n\n".format(self.name, self._node_path, self.exe_path, self.exe_name)
def get_benchmarks_from_results_dir(results_dir):
if results_dir.endswith("/"):
results_dir = results_dir[:-1]
benchmarks = []
benchmark_files = glob.glob("{0}/**/perf.*.data/*.data".format(results_dir), recursive=True)
for bmk_path in benchmark_files:
components = bmk_path.split('/')
name = components[-1][0:-len(".data")] # Strip ".data" from bmk name
node_path = results_dir + "/" + components[-3]
benchmark = Benchmark(name, node_path)
benchmarks.append(benchmark)
return benchmarks
|