-
Notifications
You must be signed in to change notification settings - Fork 3
/
exabench
executable file
·42 lines (33 loc) · 1.88 KB
/
exabench
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
#!/usr/bin/env python
import os
import argparse
from cases import CASES
from results.handler import ResultsHandler
from benchmarks.utils import get_class_by_reference
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('--prepare', action="store_true", help='prepare benchmarks')
parser.add_argument('--execute', action="store_true", help='execute benchmarks')
parser.add_argument('--results', action="store_true", help='extract and store benchmarks results')
parser.add_argument('--name', dest="names", action="append", help='benchmark name')
parser.add_argument('--type', dest="types", action="append", help='benchmark type')
parser.add_argument('--plot', action="store_true", help='plot benchmarks results')
parser.add_argument('--site-name', dest="site_names", action="append", help='site name')
parser.add_argument('--metric', help='metric type')
return parser.parse_args()
if __name__ == '__main__':
args = parse_arguments()
if args.plot: ResultsHandler().plot(args.site_names, args.metric)
if args.prepare or args.execute or args.results:
cases = []
cwd = os.path.dirname(__file__)
for case in CASES:
if args.types and case["type"] not in args.types: continue
if args.names and case["name"] not in args.names: continue
for input_ in case["config"].get("inputs", []):
if input_["template"]: input_["template"] = os.path.join(cwd, input_["template"])
dir_ = os.path.join(cwd, "benchmarks", case["type"], "cases", case["name"])
cases.append(get_class_by_reference(case["reference"])(case["name"], case["type"], case["config"], dir_))
if args.prepare: [case.prepare() for case in cases]
if args.execute: [case.execute() for case in cases]
if args.results: ResultsHandler().store([case.results() for case in cases])