summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/__init__.py0
-rw-r--r--data/ref_results/__init__.py0
-rw-r--r--data/ref_results/compute_benchmarks_indices.py10
-rw-r--r--data/ref_results/compute_suite.py50
-rw-r--r--data/ref_results/index_calculation.py2
-rw-r--r--data/ref_results/network_benchmarks_indices.py2
-rw-r--r--data/ref_results/network_suite.py30
-rw-r--r--data/ref_results/storage_benchmarks_indices.py2
-rw-r--r--data/ref_results/storage_suite.py27
-rw-r--r--data/ref_results/suite_result.py55
10 files changed, 63 insertions, 115 deletions
diff --git a/data/__init__.py b/data/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/data/__init__.py
diff --git a/data/ref_results/__init__.py b/data/ref_results/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/data/ref_results/__init__.py
diff --git a/data/ref_results/compute_benchmarks_indices.py b/data/ref_results/compute_benchmarks_indices.py
index 400d54ac..9012cefc 100644
--- a/data/ref_results/compute_benchmarks_indices.py
+++ b/data/ref_results/compute_benchmarks_indices.py
@@ -4,7 +4,7 @@ from result_accum import result_concat as concat
def dpi_index():
- dpi_dict = concat('../../results/dpi/')
+ dpi_dict = concat('results/dpi/')
dpi_bm_ref = get_reference('compute', 'dpi_bm')
dpi_bm_index = get_index(dpi_dict, 'dpi_bm', dpi_bm_ref, 'details', 'bps')
@@ -20,7 +20,7 @@ def dpi_index():
def dhrystone_index():
- dhrystone_dict = concat('../../results/dhrystone/')
+ dhrystone_dict = concat('results/dhrystone/')
dhrystone_single_bm_ref = get_reference('compute', 'dhrystone_bm', 'single_cpu')
dhrystone_single_bm_index = get_index(dhrystone_dict, 'dhrystone_bm', dhrystone_single_bm_ref, 'details', 'single', 'score')
@@ -46,7 +46,7 @@ def dhrystone_index():
def whetstone_index():
- whetstone_dict = concat('../../results/whetstone/')
+ whetstone_dict = concat('results/whetstone/')
whetstone_single_bm_ref = get_reference('compute', 'whetstone_bm', 'single_cpu')
whetstone_single_bm_index = get_index(whetstone_dict, 'whetstone_bm', whetstone_single_bm_ref, 'details', 'single', 'score')
@@ -72,7 +72,7 @@ def whetstone_index():
def ramspeed_index():
- ramspeed_dict = concat('../../results/ramspeed/')
+ ramspeed_dict = concat('results/ramspeed/')
ramspeed_int_bm_ref = get_reference('compute', 'ramspeed_bm', 'INTmem', 'Average (MB/s)')
ramspeed_int_bm_index = get_index(ramspeed_dict, 'ramspeed_bm', ramspeed_int_bm_ref, 'details', 'int_bandwidth', 'average')
@@ -99,7 +99,7 @@ def ramspeed_index():
def ssl_index():
- ssl_dict = concat('../../results/ssl/')
+ ssl_dict = concat('results/ssl/')
ssl_RSA512b_bm_ref = get_reference('compute', 'ssl_bm', 'RSA', '512b')
ssl_RSA1024b_bm_ref = get_reference('compute', 'ssl_bm', 'RSA', '1024b')
diff --git a/data/ref_results/compute_suite.py b/data/ref_results/compute_suite.py
deleted file mode 100644
index 7154183c..00000000
--- a/data/ref_results/compute_suite.py
+++ /dev/null
@@ -1,50 +0,0 @@
-import json
-import compute_benchmarks_indices as benchmark_indices
-
-
-compute_dict = {}
-try:
- compute_dict['DPI'] = benchmark_indices.dpi_index()
-except OSError:
- pass
-
-try:
- compute_dict['Dhrystone'] = benchmark_indices.dhrystone_index()
-except OSError:
- pass
-
-try:
- compute_dict['Whetstone'] = benchmark_indices.whetstone_index()
-except OSError:
- pass
-
-try:
- compute_dict['SSL'] = benchmark_indices.ssl_index()
-except OSError:
- pass
-
-try:
- compute_dict['RamSpeed'] = benchmark_indices.ramspeed_index()
-except OSError:
- pass
-
-compute_bench_list = ['DPI', 'Dhrystone', 'Whetstone', 'SSL', 'RamSpeed']
-l = len(compute_bench_list)
-
-temp = 0
-for benchmark in compute_bench_list:
- try:
- temp = temp + float(compute_dict[benchmark]['index'])
- except KeyError:
- l = l - 1
- pass
-
-if l == 0:
- print "No compute suite results found"
-else:
- compute_suite_index = temp / l
- compute_dict_f = {}
- compute_dict_f['index'] = compute_suite_index
- compute_dict_f['suite_results'] = compute_dict
- with open('../../results/compute_result.json', 'w+') as result_json:
- json.dump(compute_dict_f, result_json, indent=4, sort_keys=True)
diff --git a/data/ref_results/index_calculation.py b/data/ref_results/index_calculation.py
index 7dee7497..5ca4a46e 100644
--- a/data/ref_results/index_calculation.py
+++ b/data/ref_results/index_calculation.py
@@ -13,7 +13,7 @@ def compute_index(total_measured, ref_result, count):
def get_reference(*args):
- with open('./reference.json') as reference_file:
+ with open('data/ref_results/reference.json') as reference_file:
reference_djson = json.load(reference_file)
for arg in args:
ref_n = reference_djson.get(str(arg))
diff --git a/data/ref_results/network_benchmarks_indices.py b/data/ref_results/network_benchmarks_indices.py
index f4c581db..c19d18eb 100644
--- a/data/ref_results/network_benchmarks_indices.py
+++ b/data/ref_results/network_benchmarks_indices.py
@@ -4,7 +4,7 @@ from result_accum import result_concat as concat
def iperf_index():
- iperf_dict = concat('../../results/iperf/')
+ iperf_dict = concat('results/iperf/')
iperf_bm_ref = get_reference('network', 'iperf_bm', 'throughput received(b/s)')
iperf_bm_index = get_index(iperf_dict, 'iperf_bm', iperf_bm_ref, 'details', 'bandwidth', 'received_throughput')
iperf_vm_ref = get_reference('network', 'iperf_vm', 'throughput received(b/s)')
diff --git a/data/ref_results/network_suite.py b/data/ref_results/network_suite.py
deleted file mode 100644
index ae4ed107..00000000
--- a/data/ref_results/network_suite.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import json
-import network_benchmarks_indices as benchmark_indices
-
-
-network_dict = {}
-try:
- network_dict['IPERF'] = benchmark_indices.iperf_index()
-except:
- pass
-
-network_bench_list = ['IPERF']
-temp = 0
-l = len(network_bench_list)
-
-for benchmark in network_bench_list:
- try:
- temp = temp + float(network_dict[benchmark]['index'])
- except:
- l = l - 1
- pass
-
-if l == 0:
- print "No network results found"
-else:
- network_suite_index = temp / len(network_bench_list)
- network_dict_f = {}
- network_dict_f['index'] = network_suite_index
- network_dict_f['suite_results'] = network_dict
- with open('../../results/network_result.json', 'w+') as result_json:
- json.dump(network_dict_f, result_json, indent=4, sort_keys=True)
diff --git a/data/ref_results/storage_benchmarks_indices.py b/data/ref_results/storage_benchmarks_indices.py
index 6c5dd435..a5aef638 100644
--- a/data/ref_results/storage_benchmarks_indices.py
+++ b/data/ref_results/storage_benchmarks_indices.py
@@ -4,7 +4,7 @@ from result_accum import result_concat as concat
def fio_index():
- fio_dict = concat('../../results/fio/')
+ fio_dict = concat('results/fio/')
fio_r_bm_ref = get_reference('storage', 'fio_bm', 'read', 'IOPS')
fio_r_bm_index = get_index(fio_dict, 'fio_bm', fio_r_bm_ref, 'details', 'job_0', 'read', 'io_ps')
fio_w_bm_ref = get_reference('storage', 'fio_bm', 'write', 'IOPS')
diff --git a/data/ref_results/storage_suite.py b/data/ref_results/storage_suite.py
deleted file mode 100644
index 38d97622..00000000
--- a/data/ref_results/storage_suite.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import json
-import storage_benchmarks_indices as benchmark_indices
-
-
-storage_dict = {}
-try:
- storage_dict['FIO'] = benchmark_indices.fio_index()
-except OSError:
- pass
-
-storage_bench_list = ['FIO']
-l = len(storage_bench_list)
-temp = 0
-for benchmark in storage_bench_list:
- try:
- temp = temp + float(storage_dict[benchmark]['index'])
- except KeyError:
- l -= 1
-if l == 0:
- print "No Storage results found"
-else:
- storage_suite_index = temp / l
- storage_dict_f = {}
- storage_dict_f['index'] = storage_suite_index
- storage_dict_f['storage_suite'] = storage_dict
- with open('../../results/storage_result.json', 'w+') as result_json:
- json.dump(storage_dict_f, result_json, indent=4, sort_keys=True)
diff --git a/data/ref_results/suite_result.py b/data/ref_results/suite_result.py
new file mode 100644
index 00000000..d0b4647f
--- /dev/null
+++ b/data/ref_results/suite_result.py
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2016 ZTE Corp and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import json
+import importlib
+import sys
+from utils import logger_utils
+
+logger = logger_utils.QtipLogger('suite_result').get
+
+
+def get_benchmark_result(benchmark_name, suite_name):
+ benchmark_indices = importlib.import_module('{0}_benchmarks_indices'.format(suite_name))
+ methodToCall = getattr(benchmark_indices, '{0}_index'.format(benchmark_name))
+ return methodToCall()
+
+
+def get_suite_result(suite_name):
+ suite_dict = {}
+ suite_bench_list = {'compute': ['DPI', 'Dhrystone', 'Whetstone', 'SSL', 'RamSpeed'],
+ 'storage': ['FIO'],
+ 'network': ['IPERF']}
+ temp = 0
+ l = len(suite_bench_list[suite_name])
+ for benchmark in suite_bench_list[suite_name]:
+ try:
+ suite_dict[benchmark] = get_benchmark_result(benchmark.lower(), suite_name)
+ temp = temp + float(suite_dict[benchmark]['index'])
+ except OSError:
+ l = l - 1
+ pass
+
+ if l == 0:
+ logger.info("No {0} suite results found".format(suite_name))
+ return False
+ else:
+ suite_index = temp / l
+ suite_dict_f = {'index': suite_index,
+ 'suite_results': suite_dict}
+ with open('results/{0}_result.json'.format(suite_name), 'w+') as result_json:
+ json.dump(suite_dict_f, result_json, indent=4, sort_keys=True)
+ return True
+
+
+def main():
+ get_suite_result(sys.argv[1])
+
+
+if __name__ == "__main__":
+ main()