summaryrefslogtreecommitdiffstats
path: root/legacy/scripts/ref_results
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-03-14 17:26:28 +0800
committerYujun Zhang <zhang.yujunz@zte.com.cn>2017-03-14 17:26:28 +0800
commit63c002a51ff072c911d3b89296b627b16983f5a0 (patch)
tree2ceeb00e4d566589fcd03436cea6ad1dee30798f /legacy/scripts/ref_results
parent89743ab8134e54fe606310e3bf5c65ebab93c62a (diff)
Remove legacy code from stable branch
Change-Id: I283f84dfcb3cd029739caaefb33ed5431114fae9 Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'legacy/scripts/ref_results')
-rw-r--r--legacy/scripts/ref_results/__init__.py0
-rw-r--r--legacy/scripts/ref_results/compute_benchmarks_indices.py168
-rw-r--r--legacy/scripts/ref_results/index_calculation.py49
-rw-r--r--legacy/scripts/ref_results/network_benchmarks_indices.py28
-rw-r--r--legacy/scripts/ref_results/reference.json97
-rw-r--r--legacy/scripts/ref_results/result_accum.py39
-rw-r--r--legacy/scripts/ref_results/storage_benchmarks_indices.py37
-rw-r--r--legacy/scripts/ref_results/suite_result.py58
8 files changed, 0 insertions, 476 deletions
diff --git a/legacy/scripts/ref_results/__init__.py b/legacy/scripts/ref_results/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/legacy/scripts/ref_results/__init__.py
+++ /dev/null
diff --git a/legacy/scripts/ref_results/compute_benchmarks_indices.py b/legacy/scripts/ref_results/compute_benchmarks_indices.py
deleted file mode 100644
index 936b58df..00000000
--- a/legacy/scripts/ref_results/compute_benchmarks_indices.py
+++ /dev/null
@@ -1,168 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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
-##############################################################################
-from index_calculation import generic_index as get_index
-from index_calculation import get_reference
-from result_accum import result_concat as concat
-
-
-def dpi_index():
- 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')
-
- dpi_vm_ref = get_reference('compute', 'dpi_vm')
- dpi_vm_index = get_index(dpi_dict, 'dpi_vm', dpi_vm_ref, 'details', 'bps')
- dpi_index = (dpi_bm_index + dpi_vm_index) / 2
- dpi_dict_i = {}
- dpi_dict_i['index'] = dpi_index
- dpi_dict_i['results'] = dpi_dict
- return dpi_dict_i
-
-
-def dhrystone_index():
-
- 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')
-
- dhrystone_multi_bm_ref = get_reference('compute', 'dhrystone_bm', 'multi_cpu')
- dhrystone_multi_bm_index = get_index(dhrystone_dict, 'dhrystone_bm', dhrystone_multi_bm_ref, 'details', 'multi', 'score')
-
- dhrystone_bm_index = (dhrystone_single_bm_index + dhrystone_multi_bm_index) / 2
-
- dhrystone_single_vm_ref = get_reference('compute', 'dhrystone_vm', 'single_cpu')
- dhrystone_single_vm_index = get_index(dhrystone_dict, 'dhrystone_vm', dhrystone_single_vm_ref, 'details', 'single', 'score')
-
- dhrystone_multi_vm_ref = get_reference('compute', 'dhrystone_vm', 'multi_cpu')
- dhrystone_multi_vm_index = get_index(dhrystone_dict, 'dhrystone_vm', dhrystone_multi_vm_ref, 'details', 'multi', 'score')
-
- dhrystone_vm_index = (dhrystone_single_vm_index + dhrystone_multi_vm_index) / 2
-
- dhrystone_index = (dhrystone_bm_index + dhrystone_vm_index) / 2
- dhrystone_dict_i = {}
- dhrystone_dict_i['index'] = dhrystone_index
- dhrystone_dict_i['results'] = dhrystone_dict
- return dhrystone_dict_i
-
-
-def whetstone_index():
-
- 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')
-
- whetstone_multi_bm_ref = get_reference('compute', 'whetstone_bm', 'multi_cpu')
- whetstone_multi_bm_index = get_index(whetstone_dict, 'whetstone_bm', whetstone_multi_bm_ref, 'details', 'multi', 'score')
-
- whetstone_bm_index = (whetstone_single_bm_index + whetstone_multi_bm_index) / 2
-
- whetstone_single_vm_ref = get_reference('compute', 'whetstone_vm', 'single_cpu')
- whetstone_single_vm_index = get_index(whetstone_dict, 'whetstone_vm', whetstone_single_vm_ref, 'details', 'single', 'score')
-
- whetstone_multi_vm_ref = get_reference('compute', 'whetstone_vm', 'multi_cpu')
- whetstone_multi_vm_index = get_index(whetstone_dict, 'whetstone_vm', whetstone_multi_vm_ref, 'details', 'multi', 'score')
-
- whetstone_vm_index = (whetstone_single_vm_index + whetstone_multi_vm_index) / 2
-
- whetstone_index = (whetstone_bm_index + whetstone_vm_index) / 2
- whetstone_dict_i = {}
- whetstone_dict_i['index'] = whetstone_index
- whetstone_dict_i['results'] = whetstone_dict
- return whetstone_dict_i
-
-
-def ramspeed_index():
-
- 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')
-
- ramspeed_float_bm_ref = get_reference('compute', 'ramspeed_bm', 'FLOATmem', 'Average (MB/s)')
- ramspeed_float_bm_index = get_index(ramspeed_dict, 'ramspeed_bm', ramspeed_float_bm_ref, 'details', 'float_bandwidth', 'average')
-
- ramspeed_bm_index = (ramspeed_int_bm_index + ramspeed_float_bm_index) / 2
-
- ramspeed_int_vm_ref = get_reference('compute', 'ramspeed_vm', 'INTmem', 'Average (MB/s)')
- ramspeed_int_vm_index = get_index(ramspeed_dict, 'ramspeed_vm', ramspeed_int_vm_ref, 'details', 'int_bandwidth', 'average')
-
- ramspeed_float_vm_ref = get_reference('compute', 'ramspeed_vm', 'FLOATmem', 'Average (MB/s)')
- ramspeed_float_vm_index = get_index(ramspeed_dict, 'ramspeed_vm', ramspeed_float_vm_ref, 'details', 'float_bandwidth', 'average')
-
- ramspeed_vm_index = (ramspeed_int_vm_index + ramspeed_float_vm_index) / 2
-
- ramspeed_index = (ramspeed_vm_index + ramspeed_bm_index) / 2
-
- ramspeed_dict_i = {}
- ramspeed_dict_i['index'] = ramspeed_index
- ramspeed_dict_i['results'] = ramspeed_dict
- return ramspeed_dict_i
-
-
-def ssl_index():
-
- 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')
- ssl_RSA2048b_bm_ref = get_reference('compute', 'ssl_bm', 'RSA', '2048b')
- ssl_RSA4096b_bm_ref = get_reference('compute', 'ssl_bm', 'RSA', '4096b')
-
- ssl_AES16B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '16B')
- ssl_AES64B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '64B')
- ssl_AES256B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '256B')
- ssl_AES1024B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '1024B')
- ssl_AES8192B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '8192B')
-
- ssl_RSA512b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA512b_bm_ref, 'details', 'rsa_sig', '512_bits')
- ssl_RSA1024b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA1024b_bm_ref, 'details', 'rsa_sig', '1024_bits')
- ssl_RSA2048b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA2048b_bm_ref, 'details', 'rsa_sig', '2048_bits')
- ssl_RSA4096b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA4096b_bm_ref, 'details', 'rsa_sig', '4096_bits')
- ssl_RSA_bm_index = (ssl_RSA512b_bm_index + ssl_RSA1024b_bm_index + ssl_RSA2048b_bm_index + ssl_RSA4096b_bm_index) / 4
-
- ssl_AES16B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES16B_bm_ref, 'details', 'aes_128_cbc', '16B_block')
- ssl_AES64B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES64B_bm_ref, 'details', 'aes_128_cbc', '64B_block')
- ssl_AES256B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES256B_bm_ref, 'details', 'aes_128_cbc', '256B_block')
- ssl_AES1024B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES1024B_bm_ref, 'details', 'aes_128_cbc', '1024B_block')
- ssl_AES8192B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES8192B_bm_ref, 'details', 'aes_128_cbc', '8192B_block')
- ssl_AES_bm_index = (ssl_AES16B_bm_index + ssl_AES64B_bm_index + ssl_AES256B_bm_index + ssl_AES1024B_bm_index + ssl_AES8192B_bm_index) / 5
-
- ssl_bm_index = (ssl_RSA_bm_index + ssl_AES_bm_index) / 2
-
- ssl_RSA512b_vm_ref = get_reference('compute', 'ssl_vm', 'RSA', '512b')
- ssl_RSA1024b_vm_ref = get_reference('compute', 'ssl_vm', 'RSA', '1024b')
- ssl_RSA2048b_vm_ref = get_reference('compute', 'ssl_vm', 'RSA', '2048b')
- ssl_RSA4096b_vm_ref = get_reference('compute', 'ssl_vm', 'RSA', '4096b')
-
- ssl_AES16B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '16B')
- ssl_AES64B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '64B')
- ssl_AES256B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '256B')
- ssl_AES1024B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '1024B')
- ssl_AES8192B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '8192B')
-
- ssl_RSA512b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA512b_vm_ref, 'details', 'rsa_sig', '512_bits')
- ssl_RSA1024b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA1024b_vm_ref, 'details', 'rsa_sig', '1024_bits')
- ssl_RSA2048b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA2048b_vm_ref, 'details', 'rsa_sig', '2048_bits')
- ssl_RSA4096b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA4096b_vm_ref, 'details', 'rsa_sig', '4096_bits')
- ssl_RSA_vm_index = (ssl_RSA512b_vm_index + ssl_RSA1024b_vm_index + ssl_RSA2048b_vm_index + ssl_RSA4096b_vm_index) / 4
-
- ssl_AES16B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES16B_vm_ref, 'details', 'aes_128_cbc', '16B_block')
- ssl_AES64B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES64B_vm_ref, 'details', 'aes_128_cbc', '64B_block')
- ssl_AES256B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES256B_vm_ref, 'details', 'aes_128_cbc', '256B_block')
- ssl_AES1024B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES1024B_vm_ref, 'details', 'aes_128_cbc', '1024B_block')
- ssl_AES8192B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES8192B_vm_ref, 'details', 'aes_128_cbc', '8192B_block')
- ssl_AES_vm_index = (ssl_AES16B_vm_index + ssl_AES64B_vm_index + ssl_AES256B_vm_index + ssl_AES1024B_vm_index + ssl_AES8192B_vm_index) / 5
-
- ssl_vm_index = (ssl_RSA_vm_index + ssl_AES_vm_index) / 2
-
- ssl_index = (ssl_bm_index + ssl_vm_index) / 2
-
- ssl_dict_i = {}
- ssl_dict_i['index'] = ssl_index
- ssl_dict_i['results'] = ssl_dict
- return ssl_dict_i
diff --git a/legacy/scripts/ref_results/index_calculation.py b/legacy/scripts/ref_results/index_calculation.py
deleted file mode 100644
index 14c2d4d2..00000000
--- a/legacy/scripts/ref_results/index_calculation.py
+++ /dev/null
@@ -1,49 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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
-
-
-def compute_index(total_measured, ref_result, count):
- try:
- average = float(total_measured / count)
-
- except ZeroDivisionError:
- average = 0
- index = average / ref_result
- return index
-
-
-def get_reference(*args):
-
- with open('scripts/ref_results/reference.json') as reference_file:
- reference_djson = json.load(reference_file)
- for arg in args:
- ref_n = reference_djson.get(str(arg))
- reference_djson = reference_djson.get(str(arg))
- return ref_n
-
-
-def generic_index(dict_gen, testcase, reference_num, *args):
- c = len(args)
- count = 0
- total = 0
- result = 0
- for k, v in dict_gen.iteritems():
- dict_temp = dict_gen[k]
- if dict_gen[k]['name'] == '{0}.yaml'.format(testcase):
- count = count + 1
- for arg in args:
- if arg == args[c - 1]:
- try:
- result = float(dict_temp.get(str(arg)))
- except ValueError:
- result = float(dict_temp.get(str(arg))[:-1]) * 1000
- dict_temp = dict_temp.get(str(arg))
- total = total + result
- return compute_index(total, reference_num, count)
diff --git a/legacy/scripts/ref_results/network_benchmarks_indices.py b/legacy/scripts/ref_results/network_benchmarks_indices.py
deleted file mode 100644
index 67980ee9..00000000
--- a/legacy/scripts/ref_results/network_benchmarks_indices.py
+++ /dev/null
@@ -1,28 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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
-##############################################################################
-from index_calculation import generic_index as get_index
-from index_calculation import get_reference
-from result_accum import result_concat as concat
-
-
-def iperf_index():
- 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)')
- iperf_vm_index = get_index(iperf_dict, 'iperf_vm', iperf_vm_ref, 'details', 'bandwidth', 'received_throughput')
-
- iperf_vm_2_ref = get_reference('network', 'iperf_vm_2', 'throughput received(b/s)')
- iperf_vm_2_index = get_index(iperf_dict, 'iperf_vm_2', iperf_vm_2_ref, 'details', 'bandwidth', 'received_throughput')
- iperf_index = float(iperf_bm_index + iperf_vm_index + iperf_vm_2_index) / 3
- print iperf_index
- iperf_dict_i = {}
- iperf_dict_i['index'] = iperf_index
- iperf_dict_i['results'] = iperf_dict
- return iperf_dict_i
diff --git a/legacy/scripts/ref_results/reference.json b/legacy/scripts/ref_results/reference.json
deleted file mode 100644
index cfcbfc3b..00000000
--- a/legacy/scripts/ref_results/reference.json
+++ /dev/null
@@ -1,97 +0,0 @@
-{
- "compute": {
- "dhrystone_bm": {
- "multi_cpu": 103362.1,
- "single_cpu": 3231.7
- },
- "dhrystone_vm": {
- "multi_cpu": 10585.8,
- "single_cpu": 2953.6
- },
- "dpi_bm": 8.12,
- "dpi_vm": 22.12,
- "ramspeed_bm": {
- "FLOATmem": {
- "Average (MB/s)": 9758.79
- },
- "INTmem": {
- "Average (MB/s)": 12268.38
- }
- },
- "ramspeed_vm": {
- "FLOATmem": {
- "Average (MB/s)": 9064.09
- },
- "INTmem": {
- "Average (MB/s)": 12147.59
- }
- },
- "ssl_bm": {
- "AES": {
- "1024B": 808861020,
- "16B": 735490250,
- "256B": 803323650,
- "64B": 788429210,
- "8192B": 807701160
- },
- "RSA": {
- "1024b": 7931.44,
- "2048b": 1544.3,
- "4096b": 161.92,
- "512b": 22148.9
- }
- },
- "ssl_vm": {
- "AES": {
- "1024B": 808861020,
- "16B": 735490250,
- "256B": 803323650,
- "64B": 788429210,
- "8192B": 807701160
- },
- "RSA": {
- "1024b": 7931.44,
- "2048b": 1544.3,
- "4096b": 161.92,
- "512b": 22148.9
- }
- },
- "whetstone_bm": {
- "multi_cpu": 41483.3,
- "single_cpu": 806.1
- },
- "whetstone_vm": {
- "multi_cpu": 2950.6,
- "single_cpu": 789.0
- }
- },
- "network": {
- "iperf_bm": {
- "throughput received(b/s)": 944473000.0
- },
- "iperf_vm": {
- "throughput received(b/s)": 14416700000.0
- },
- "iperf_vm_2": {
- "throughput received(b/s)": 2461530000.0
- }
- },
- "storage": {
- "fio_bm": {
- "read": {
- "IOPS": 6693
- },
- "write": {
- "IOPS": 6688
- }
- },
- "fio_vm": {
- "read": {
- "IOPS": 2239
- },
- "write": {
- "IOPS": 2237
- }
- }
- }
-} \ No newline at end of file
diff --git a/legacy/scripts/ref_results/result_accum.py b/legacy/scripts/ref_results/result_accum.py
deleted file mode 100644
index 6eb169e8..00000000
--- a/legacy/scripts/ref_results/result_accum.py
+++ /dev/null
@@ -1,39 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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 os
-import json
-
-
-def result_concat(targ_dir):
- list_vm = []
- list_bm = []
- diction = {}
-
- for file in os.listdir(targ_dir):
- if file.endswith(".json"):
- if file.startswith("instance"):
- print str(file)
- list_vm.append(file)
- else:
- list_bm.append(file)
- l = len(list_bm)
- k = len(list_vm)
-
- for x in range(0, l):
- file_t = list_bm[x]
- with open(targ_dir + file_t) as result_file:
- result_djson = json.load(result_file)
- diction['Baremetal' + str(int(x + 1))] = result_djson
-
- for x in range(0, k):
- file_t = list_vm[x]
- with open(targ_dir + file_t) as result_file:
- result_djson = json.load(result_file)
- diction['Virtual Machine ' + str(x + 1)] = result_djson
- return diction
diff --git a/legacy/scripts/ref_results/storage_benchmarks_indices.py b/legacy/scripts/ref_results/storage_benchmarks_indices.py
deleted file mode 100644
index e87fe36b..00000000
--- a/legacy/scripts/ref_results/storage_benchmarks_indices.py
+++ /dev/null
@@ -1,37 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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
-##############################################################################
-from index_calculation import generic_index as get_index
-from index_calculation import get_reference
-from result_accum import result_concat as concat
-
-
-def fio_index():
- 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')
- fio_w_bm_index = get_index(fio_dict, 'fio_bm', fio_w_bm_ref, 'details', 'job_0', 'write', 'io_ps')
-
- fio_bm_index = (fio_r_bm_index + fio_w_bm_index) / 2
-
- fio_r_vm_ref = get_reference('storage', 'fio_vm', 'read', 'IOPS')
- fio_r_vm_index = get_index(fio_dict, 'fio_vm', fio_r_vm_ref, 'details', 'job_0', 'read', 'io_ps')
-
- fio_w_vm_ref = get_reference('storage', 'fio_vm', 'write', 'IOPS')
- fio_w_vm_index = get_index(fio_dict, 'fio_vm', fio_w_vm_ref, 'details', 'job_0', 'write', 'io_ps')
-
- fio_vm_index = (fio_r_vm_index + fio_w_vm_index) / 2
-
- fio_index = (fio_bm_index + fio_vm_index) / 2
- print fio_index
-
- fio_dict_i = {}
- fio_dict_i['index'] = fio_index
- fio_dict_i['results'] = fio_dict
- return fio_dict_i
diff --git a/legacy/scripts/ref_results/suite_result.py b/legacy/scripts/ref_results/suite_result.py
deleted file mode 100644
index 66213391..00000000
--- a/legacy/scripts/ref_results/suite_result.py
+++ /dev/null
@@ -1,58 +0,0 @@
-##############################################################################
-# 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 qtip.utils import logger_utils
-from os.path import expanduser
-
-logger = logger_utils.QtipLogger('suite_result').get
-
-
-def get_benchmark_result(benchmark_name, suite_name):
- benchmark_indices = importlib.import_module('scripts.ref_results'
- '.{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}
- result_path = expanduser('~') + '/qtip/results'
- with open('{0}/{1}_result.json'.format(result_path, 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()