From 481f78bf7a08e31ee53270028fa70b9eb60ff0a3 Mon Sep 17 00:00:00 2001 From: "zhifeng.jiang" Date: Sat, 16 Jul 2016 21:15:11 +0800 Subject: Fix pep8 errors for all the others python files. JIRA:QTIP-89 Change-Id: Ida1936dea3bcab6137d039fc2d21dc4df60d9f77 Signed-off-by: zhifeng.jiang --- benchmarks/playbooks/info_script/info_collect.py | 127 +++++----- data/ref_results/compute_benchmarks_indices.py | 290 +++++++++++------------ data/ref_results/compute_suite.py | 39 ++- data/ref_results/generator_ref_json.py | 140 ++++++----- data/ref_results/index_calculation.py | 59 +++-- data/ref_results/network_benchmarks_indices.py | 33 +-- data/ref_results/network_suite.py | 28 +-- data/ref_results/result_accum.py | 38 ++- data/ref_results/storage_benchmarks_indices.py | 52 ++-- data/ref_results/storage_suite.py | 26 +- func/fetchimg.py | 8 +- setup.py | 5 +- 12 files changed, 400 insertions(+), 445 deletions(-) diff --git a/benchmarks/playbooks/info_script/info_collect.py b/benchmarks/playbooks/info_script/info_collect.py index 7e5544c0..4daed318 100644 --- a/benchmarks/playbooks/info_script/info_collect.py +++ b/benchmarks/playbooks/info_script/info_collect.py @@ -1,94 +1,87 @@ import os import pickle -import time -import datetime import json import sys os.system('inxi -b -c0 -n > $PWD/est_2') -est_ob=open("est_2","r+") -est_ob2=open("est_1","w+") -in_string= est_ob.read().replace('\n',' ') -cpu_idle=float(os.popen("""top -bn1 | grep "Cpu(s)" | awk '{print $8}'""").read().rstrip()) -cpu_usage= 100-cpu_idle -est_ob2.write(in_string); +est_ob = open("est_2", "r+") +est_ob2 = open("est_1", "w+") +in_string = est_ob.read().replace('\n', ' ') +cpu_idle = float(os.popen("""top -bn1 | grep "Cpu(s)" | awk '{print $8}'""").read().rstrip()) +cpu_usage = 100 - cpu_idle +est_ob2.write(in_string) est_ob.close() est_ob2.close() -Info_dict={}; -inxi_host=os.popen("""cat $PWD/est_1 | grep -o -P '(?<=Host:).*(?=Kernel)' """).read().lstrip().rstrip() -inxi_mem=os.popen("""cat $PWD/est_1 | grep -o -P '(?<=Memory:).*(?=MB)' """).read().lstrip().rstrip()+"MB" -inxi_cpu=os.popen("""cat $PWD/est_1 | grep -o -P '(?<=CPU).*(?=speed)' | cut -f2 -d':'""").read().lstrip().rstrip() -inxi_distro=os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Distro:).*(?=Machine:)' """).read().rstrip().lstrip() -inxi_kernel=os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Kernel:).*(?=Console:)' """).read().rstrip().lstrip() -inxi_HD=os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=HDD Total Size:).*(?=Info:)' """).read().rstrip().lstrip() -inxi_product=os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=product:).*(?=Mobo:)' """).read().rstrip().lstrip() +Info_dict = {} +inxi_host = os.popen("""cat $PWD/est_1 | grep -o -P '(?<=Host:).*(?=Kernel)' """).read().lstrip().rstrip() +inxi_mem = os.popen("""cat $PWD/est_1 | grep -o -P '(?<=Memory:).*(?=MB)' """).read().lstrip().rstrip() + "MB" +inxi_cpu = os.popen("""cat $PWD/est_1 | grep -o -P '(?<=CPU).*(?=speed)' | cut -f2 -d':'""").read().lstrip().rstrip() +inxi_distro = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Distro:).*(?=Machine:)' """).read().rstrip().lstrip() +inxi_kernel = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Kernel:).*(?=Console:)' """).read().rstrip().lstrip() +inxi_HD = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=HDD Total Size:).*(?=Info:)' """).read().rstrip().lstrip() +inxi_product = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=product:).*(?=Mobo:)' """).read().rstrip().lstrip() - - -Info_dict['1_Hostname']=inxi_host -Info_dict['2_Product']=inxi_product -Info_dict['3_OS Distribution']=inxi_distro -Info_dict['4_Kernel']=inxi_kernel -Info_dict['5_CPU']=inxi_cpu -Info_dict['6_CPU_Usage']=str(round(cpu_usage,3))+'%' -Info_dict['7_Memory Usage']=inxi_mem -Info_dict['8_Disk usage']=inxi_HD -network_flag=str(sys.argv[1]).rstrip() +Info_dict['1_Hostname'] = inxi_host +Info_dict['2_Product'] = inxi_product +Info_dict['3_OS Distribution'] = inxi_distro +Info_dict['4_Kernel'] = inxi_kernel +Info_dict['5_CPU'] = inxi_cpu +Info_dict['6_CPU_Usage'] = str(round(cpu_usage, 3)) + '%' +Info_dict['7_Memory Usage'] = inxi_mem +Info_dict['8_Disk usage'] = inxi_HD +network_flag = str(sys.argv[1]).rstrip() if (network_flag == 'n'): - - Info_dict['9_Network_Interfaces']={}; - tem_2=""" cat $PWD/est_1 | grep -o -P '(?<=Network:).*(?=Info:)'""" - print os.system(tem_2+' > Hello') - i=int(os.popen(tem_2+" | grep -o 'Card' | wc -l ").read()) - print i + Info_dict['9_Network_Interfaces'] = {} + tem_2 = """ cat $PWD/est_1 | grep -o -P '(?<=Network:).*(?=Info:)'""" + print os.system(tem_2 + ' > Hello') + i = int(os.popen(tem_2 + " | grep -o 'Card' | wc -l ").read()) + print i - for x in range (1,i+1): - tem=""" cat $PWD/est_1 | grep -o -P '(?<=Card-"""+str(x)+""":).*(?=Card-"""+str(x+1)+""")'""" + for x in range(1, i + 1): + tem = """ cat $PWD/est_1 | grep -o -P '(?<=Card-""" + str(x) + """:).*(?=Card-""" + str(x + 1) + """)'""" if i == 1: - tem=""" cat $PWD/est_1 | grep -o -P '(?<=Network:).*(?=Info:)'""" - inxi_card_1=((os.popen(tem+" | grep -o -P '(?<=Card:).*(?=Drives:)'|sed 's/ *driver:.*//'").read().rstrip().lstrip())) + tem = """ cat $PWD/est_1 | grep -o -P '(?<=Network:).*(?=Info:)'""" + inxi_card_1 = ((os.popen(tem + " | grep -o -P '(?<=Card:).*(?=Drives:)'|sed 's/ *driver:.*//'").read().rstrip().lstrip())) print inxi_card_1 - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]={}; - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]['1_Network_Card']=inxi_card_1 - inxi_card_2=((os.popen(tem+"| grep -o -P '(?<=Card:).*(?=Drives:)'|sed -e 's/^.*IF: //'").read())).rstrip().lstrip() - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]['2_Interface_info']=inxi_card_2 + Info_dict['9_Network_Interfaces']['Interface_' + str(x)] = {} + Info_dict['9_Network_Interfaces']['Interface_' + str(x)]['1_Network_Card'] = inxi_card_1 + inxi_card_2 = ((os.popen(tem + "| grep -o -P '(?<=Card:).*(?=Drives:)'|sed -e 's/^.*IF: //'").read())).rstrip().lstrip() + Info_dict['9_Network_Interfaces']['Interface_' + str(x)]['2_Interface_info'] = inxi_card_2 elif x < (i): print "two" - #inxi_Card_temp=((os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Card-"""+str(x)+""":).*(?=Card-"""+str(x+1)+""")' """).read().rstrip().lstrip())) - inxi_card_1=((os.popen(tem+"| sed 's/ *driver:.*//'").read().rstrip().lstrip())) - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]={}; - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]['1_Network_Card']=inxi_card_1 - inxi_card_2=((os.popen(tem+"|sed -e 's/^.*IF: //'").read())).rstrip().lstrip() - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]['2_Interface_info']=inxi_card_2 + inxi_card_1 = ((os.popen(tem + "| sed 's/ *driver:.*//'").read().rstrip().lstrip())) + Info_dict['9_Network_Interfaces']['Interface_' + str(x)] = {} + Info_dict['9_Network_Interfaces']['Interface_' + str(x)]['1_Network_Card'] = inxi_card_1 + inxi_card_2 = ((os.popen(tem + "|sed -e 's/^.*IF: //'").read())).rstrip().lstrip() + Info_dict['9_Network_Interfaces']['Interface_' + str(x)]['2_Interface_info'] = inxi_card_2 elif x == i: print "Three" - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]={}; - inxi_card_1=((os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Card-"""+str(x)+""":).*(?=Drives:)'| sed 's/ *driver:.*//' """).read().rstrip().lstrip())) - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]['1_Network_Card']=inxi_card_1 - inxi_card_2=((os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Card-"""+str(x)+""":).*(?=Drives:)'| sed -e 's/^.*IF: //' """).read().rstrip().lstrip())) - Info_dict['9_Network_Interfaces']['Interface_'+str(x)]['2_Interface_info']=inxi_card_2 + Info_dict['9_Network_Interfaces']['Interface_' + str(x)] = {} + inxi_card_1 = ((os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Card-""" + str(x) + """:).*(?=Drives:)'| sed 's/ *driver:.*//' """).read().rstrip().lstrip())) + Info_dict['9_Network_Interfaces']['Interface_' + str(x)]['1_Network_Card'] = inxi_card_1 + inxi_card_2 = ((os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Card-""" + str(x) + """:).*(?=Drives:)'| sed -e 's/^.*IF: //' """).read().rstrip().lstrip())) + Info_dict['9_Network_Interfaces']['Interface_' + str(x)]['2_Interface_info'] = inxi_card_2 else: print "No network cards" os.system("bwm-ng -o plain -c 1 | grep -v '=' | grep -v 'iface' | grep -v '-' > bwm_dump") - n_interface=int(os.popen(" cat bwm_dump | grep -v 'total' | wc -l ").read().rstrip()) - interface={}; - for x in range (1,n_interface): - interface_name=os.popen(" cat bwm_dump | awk 'NR=="+str(x)+"' | awk '{print $1}' ").read().rstrip().replace(':','') - interface[str(interface_name)]={}; - interface[str(interface_name)]['Rx (KB/s)']=os.popen(" cat bwm_dump | awk 'NR=="+str(x)+"' | awk '{print $2}' ").read().rstrip() - interface[str(interface_name)]['Tx (KB/s)']=os.popen(" cat bwm_dump | awk 'NR=="+str(x)+"' | awk '{print $4}' ").read().rstrip() - interface[str(interface_name)]['Total (KB/s)']=os.popen(" cat bwm_dump | awk 'NR== "+str(x)+"' | awk '{print $6}' ").read().rstrip() - - Info_dict['10.Interface I/O']=interface + n_interface = int(os.popen(" cat bwm_dump | grep -v 'total' | wc -l ").read().rstrip()) + interface = {} + for x in range(1, n_interface): + interface_name = os.popen(" cat bwm_dump | awk 'NR==" + str(x) + "' | awk '{print $1}' ").read().rstrip().replace(':', '') + interface[str(interface_name)] = {} + interface[str(interface_name)]['Rx (KB/s)'] = os.popen(" cat bwm_dump | awk 'NR==" + str(x) + "' | awk '{print $2}' ").read().rstrip() + interface[str(interface_name)]['Tx (KB/s)'] = os.popen(" cat bwm_dump | awk 'NR==" + str(x) + "' | awk '{print $4}' ").read().rstrip() + interface[str(interface_name)]['Total (KB/s)'] = os.popen(" cat bwm_dump | awk 'NR== " + str(x) + "' | awk '{print $6}' ").read().rstrip() + + Info_dict['10.Interface I/O'] = interface print Info_dict - -with open('./sys_info_temp','w+')as out_info: - pickle.dump(Info_dict,out_info) -with open('temp','w+') as result_json: - json.dump(Info_dict,result_json,indent=4,sort_keys=True) +with open('./sys_info_temp', 'w+')as out_info: + pickle.dump(Info_dict, out_info) +with open('temp', 'w+') as result_json: + json.dump(Info_dict, result_json, indent=4, sort_keys=True) diff --git a/data/ref_results/compute_benchmarks_indices.py b/data/ref_results/compute_benchmarks_indices.py index 9aaff888..e46b8771 100644 --- a/data/ref_results/compute_benchmarks_indices.py +++ b/data/ref_results/compute_benchmarks_indices.py @@ -1,163 +1,161 @@ from index_calculation import generic_index as get_index -from index_calculation import get_reference +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,'4 DPI result', 'DPI_benchmark(Gb/s)') - - dpi_vm_ref = get_reference('compute','dpi_vm') - dpi_vm_index= get_index(dpi_dict,'dpi_vm',dpi_vm_ref,'4 DPI result', 'DPI_benchmark(Gb/s)') - dpi_index=(dpi_bm_index+dpi_vm_index)/2 - dpi_dict_i={}; - dpi_dict_i['1. Index']=dpi_index - dpi_dict_i['2. Results']=dpi_dict - return dpi_dict_i +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, '4 DPI result', 'DPI_benchmark(Gb/s)') + + dpi_vm_ref = get_reference('compute', 'dpi_vm') + dpi_vm_index = get_index(dpi_dict, 'dpi_vm', dpi_vm_ref, '4 DPI result', 'DPI_benchmark(Gb/s)') + + dpi_index = (dpi_bm_index + dpi_vm_index) / 2 + dpi_dict_i = {} + dpi_dict_i['1. Index'] = dpi_index + dpi_dict_i['2. 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,'4 Dhrystone result','2.Single CPU test','2.Index 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,'4 Dhrystone result','3.Multi CPU test','2.Index 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,'4 Dhrystone result','2.Single CPU test','2.Index 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,'4 Dhrystone result','3.Multi CPU test','2.Index 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['1. Index']=dhrystone_index - dhrystone_dict_i['2. Results']=dhrystone_dict + 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, '4 Dhrystone result', '2.Single CPU test', '2.Index 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, '4 Dhrystone result', '3.Multi CPU test', '2.Index 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, '4 Dhrystone result', '2.Single CPU test', '2.Index 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, '4 Dhrystone result', '3.Multi CPU test', '2.Index 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['1. Index'] = dhrystone_index + dhrystone_dict_i['2. 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,'4 Whetstone result','2.Single CPU test','2.Index 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,'4 Whetstone result','3.Multi CPU test','2.Index 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,'4 Whetstone result','2.Single CPU test','2.Index 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,'4 Whetstone result','3.Multi CPU test','2.Index 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['1. Index']=whetstone_index - whetstone_dict_i['2. Results']=whetstone_dict + 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, '4 Whetstone result', '2.Single CPU test', '2.Index 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, '4 Whetstone result', '3.Multi CPU test', '2.Index 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, '4 Whetstone result', '2.Single CPU test', '2.Index 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, '4 Whetstone result', '3.Multi CPU test', '2.Index 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['1. Index'] = whetstone_index + whetstone_dict_i['2. 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,'4 RamSpeed result','1. INTmem bandwidth','5. Average (MB/s)') - - 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,'4 RamSpeed result','2. FLOATmem bandwidth','5. Average (MB/s)') - - 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,'4 RamSpeed result','1. INTmem bandwidth','5. Average (MB/s)') - - 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,'4 RamSpeed result','2. FLOATmem bandwidth','5. Average (MB/s)') - - 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['1. Index']=ramspeed_index - ramspeed_dict_i['2. Results']=ramspeed_dict + +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, '4 RamSpeed result', '1. INTmem bandwidth', '5. Average (MB/s)') + + 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, '4 RamSpeed result', '2. FLOATmem bandwidth', '5. Average (MB/s)') + + 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, '4 RamSpeed result', '1. INTmem bandwidth', '5. Average (MB/s)') + + 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, '4 RamSpeed result', '2. FLOATmem bandwidth', '5. Average (MB/s)') + + 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['1. Index'] = ramspeed_index + ramspeed_dict_i['2. 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,'4 SSL result','2. RSA signatures','1. 512 bits (sign/s)') - ssl_RSA1024b_bm_index=get_index(ssl_dict, "ssl_bm", ssl_RSA1024b_bm_ref,'4 SSL result','2. RSA signatures','2. 1024 bits (sign/s)') - ssl_RSA2048b_bm_index=get_index(ssl_dict, "ssl_bm", ssl_RSA2048b_bm_ref,'4 SSL result','2. RSA signatures','3. 2048 bits (sign/s)') - ssl_RSA4096b_bm_index=get_index(ssl_dict, "ssl_bm", ssl_RSA4096b_bm_ref,'4 SSL result','2. RSA signatures','4. 4096 bits (sign/s)') - 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,'4 SSL result','3. AES-128-cbc throughput','1. 16 Bytes block (B/sec)') - ssl_AES64B_bm_index=get_index(ssl_dict, "ssl_bm", ssl_AES64B_bm_ref,'4 SSL result','3. AES-128-cbc throughput','2. 64 Bytes block (B/sec)') - ssl_AES256B_bm_index=get_index(ssl_dict, "ssl_bm", ssl_AES256B_bm_ref,'4 SSL result','3. AES-128-cbc throughput','3. 256 Bytes block (B/sec)') - ssl_AES1024B_bm_index=get_index(ssl_dict, "ssl_bm", ssl_AES1024B_bm_ref,'4 SSL result','3. AES-128-cbc throughput','4. 1024 Bytes block (B/sec)') - ssl_AES8192B_bm_index=get_index(ssl_dict, "ssl_bm", ssl_AES8192B_bm_ref,'4 SSL result','3. AES-128-cbc throughput','5. 8192 Bytes block (B/sec)') - 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,'4 SSL result','2. RSA signatures','1. 512 bits (sign/s)') - ssl_RSA1024b_vm_index=get_index(ssl_dict, "ssl_vm", ssl_RSA1024b_vm_ref,'4 SSL result','2. RSA signatures','2. 1024 bits (sign/s)') - ssl_RSA2048b_vm_index=get_index(ssl_dict, "ssl_vm", ssl_RSA2048b_vm_ref,'4 SSL result','2. RSA signatures','3. 2048 bits (sign/s)') - ssl_RSA4096b_vm_index=get_index(ssl_dict, "ssl_vm", ssl_RSA4096b_vm_ref,'4 SSL result','2. RSA signatures','4. 4096 bits (sign/s)') - 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,'4 SSL result','3. AES-128-cbc throughput','1. 16 Bytes block (B/sec)') - ssl_AES64B_vm_index=get_index(ssl_dict, "ssl_vm", ssl_AES64B_vm_ref,'4 SSL result','3. AES-128-cbc throughput','2. 64 Bytes block (B/sec)') - ssl_AES256B_vm_index=get_index(ssl_dict, "ssl_vm", ssl_AES256B_vm_ref,'4 SSL result','3. AES-128-cbc throughput','3. 256 Bytes block (B/sec)') - ssl_AES1024B_vm_index=get_index(ssl_dict, "ssl_vm", ssl_AES1024B_vm_ref,'4 SSL result','3. AES-128-cbc throughput','4. 1024 Bytes block (B/sec)') - ssl_AES8192B_vm_index=get_index(ssl_dict, "ssl_vm", ssl_AES8192B_vm_ref,'4 SSL result','3. AES-128-cbc throughput','5. 8192 Bytes block (B/sec)') - 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['1. Index']=ssl_index - ssl_dict_i['2. Results']=ssl_dict +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, '4 SSL result', '2. RSA signatures', '1. 512 bits (sign/s)') + ssl_RSA1024b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA1024b_bm_ref, '4 SSL result', '2. RSA signatures', '2. 1024 bits (sign/s)') + ssl_RSA2048b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA2048b_bm_ref, '4 SSL result', '2. RSA signatures', '3. 2048 bits (sign/s)') + ssl_RSA4096b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA4096b_bm_ref, '4 SSL result', '2. RSA signatures', '4. 4096 bits (sign/s)') + 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, '4 SSL result', '3. AES-128-cbc throughput', '1. 16 Bytes block (B/sec)') + ssl_AES64B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES64B_bm_ref, '4 SSL result', '3. AES-128-cbc throughput', '2. 64 Bytes block (B/sec)') + ssl_AES256B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES256B_bm_ref, '4 SSL result', '3. AES-128-cbc throughput', '3. 256 Bytes block (B/sec)') + ssl_AES1024B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES1024B_bm_ref, '4 SSL result', '3. AES-128-cbc throughput', '4. 1024 Bytes block (B/sec)') + ssl_AES8192B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES8192B_bm_ref, '4 SSL result', '3. AES-128-cbc throughput', '5. 8192 Bytes block (B/sec)') + 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, '4 SSL result', '2. RSA signatures', '1. 512 bits (sign/s)') + ssl_RSA1024b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA1024b_vm_ref, '4 SSL result', '2. RSA signatures', '2. 1024 bits (sign/s)') + ssl_RSA2048b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA2048b_vm_ref, '4 SSL result', '2. RSA signatures', '3. 2048 bits (sign/s)') + ssl_RSA4096b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA4096b_vm_ref, '4 SSL result', '2. RSA signatures', '4. 4096 bits (sign/s)') + 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, '4 SSL result', '3. AES-128-cbc throughput', '1. 16 Bytes block (B/sec)') + ssl_AES64B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES64B_vm_ref, '4 SSL result', '3. AES-128-cbc throughput', '2. 64 Bytes block (B/sec)') + ssl_AES256B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES256B_vm_ref, '4 SSL result', '3. AES-128-cbc throughput', '3. 256 Bytes block (B/sec)') + ssl_AES1024B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES1024B_vm_ref, '4 SSL result', '3. AES-128-cbc throughput', '4. 1024 Bytes block (B/sec)') + ssl_AES8192B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES8192B_vm_ref, '4 SSL result', '3. AES-128-cbc throughput', '5. 8192 Bytes block (B/sec)') + 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['1. Index'] = ssl_index + ssl_dict_i['2. Results'] = ssl_dict return ssl_dict_i diff --git a/data/ref_results/compute_suite.py b/data/ref_results/compute_suite.py index 86e8a877..bcaf83c8 100644 --- a/data/ref_results/compute_suite.py +++ b/data/ref_results/compute_suite.py @@ -2,56 +2,49 @@ import json import compute_benchmarks_indices as benchmark_indices -compute_dict={}; - +compute_dict = {} try: - compute_dict['DPI']=benchmark_indices.dpi_index() -except OSError: + compute_dict['DPI'] = benchmark_indices.dpi_index() +except OSError: pass - - try: - compute_dict['Dhrystone']=benchmark_indices.dhrystone_index() + compute_dict['Dhrystone'] = benchmark_indices.dhrystone_index() except OSError: pass - - try: - compute_dict['Whetstone']=benchmark_indices.whetstone_index() + compute_dict['Whetstone'] = benchmark_indices.whetstone_index() except OSError: pass try: - compute_dict['SSL']=benchmark_indices.ssl_index() + compute_dict['SSL'] = benchmark_indices.ssl_index() except OSError: pass try: - compute_dict['RamSpeed']=benchmark_indices.ramspeed_index() + compute_dict['RamSpeed'] = benchmark_indices.ramspeed_index() except OSError: pass +compute_bench_list = ['DPI', 'Dhrystone', 'Whetstone', 'SSL', 'RamSpeed'] +l = len(compute_bench_list) -compute_bench_list=['DPI','Dhrystone','Whetstone','SSL','RamSpeed'] -l=len(compute_bench_list) - -temp=0 +temp = 0 for benchmark in compute_bench_list: try: - temp=temp+float(compute_dict[benchmark]['1. Index']) + temp = temp + float(compute_dict[benchmark]['1. Index']) except KeyError: - l=l-1 + 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 + 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/generator_ref_json.py b/data/ref_results/generator_ref_json.py index f5b8e12a..6b2d813c 100644 --- a/data/ref_results/generator_ref_json.py +++ b/data/ref_results/generator_ref_json.py @@ -1,85 +1,81 @@ -import os import json -dict_ref={}; -dict_ref['compute']={}; -dict_ref['compute']['dpi_bm']=8.12 -dict_ref['compute']['dpi_vm']=22.12 +dict_ref = {} +dict_ref['compute'] = {} +dict_ref['compute']['dpi_bm'] = 8.12 +dict_ref['compute']['dpi_vm'] = 22.12 -dict_ref['compute']['whetstone_bm']={}; -dict_ref['compute']['whetstone_vm']={}; -dict_ref['compute']['whetstone_bm']['single_cpu']=806.1 -dict_ref['compute']['whetstone_bm']['multi_cpu']=41483.3 -dict_ref['compute']['whetstone_vm']['single_cpu']=789.0 -dict_ref['compute']['whetstone_vm']['multi_cpu']=2950.6 +dict_ref['compute']['whetstone_bm'] = {} +dict_ref['compute']['whetstone_vm'] = {} +dict_ref['compute']['whetstone_bm']['single_cpu'] = 806.1 +dict_ref['compute']['whetstone_bm']['multi_cpu'] = 41483.3 +dict_ref['compute']['whetstone_vm']['single_cpu'] = 789.0 +dict_ref['compute']['whetstone_vm']['multi_cpu'] = 2950.6 -dict_ref['compute']['dhrystone_bm']={}; -dict_ref['compute']['dhrystone_vm']={}; -dict_ref['compute']['dhrystone_bm']['single_cpu']=3231.7 -dict_ref['compute']['dhrystone_bm']['multi_cpu']=103362.1 -dict_ref['compute']['dhrystone_vm']['single_cpu']=2953.6 -dict_ref['compute']['dhrystone_vm']['multi_cpu']=10585.8 +dict_ref['compute']['dhrystone_bm'] = {} +dict_ref['compute']['dhrystone_vm'] = {} +dict_ref['compute']['dhrystone_bm']['single_cpu'] = 3231.7 +dict_ref['compute']['dhrystone_bm']['multi_cpu'] = 103362.1 +dict_ref['compute']['dhrystone_vm']['single_cpu'] = 2953.6 +dict_ref['compute']['dhrystone_vm']['multi_cpu'] = 10585.8 -dict_ref['compute']['ssl_bm']={}; -dict_ref['compute']['ssl_bm']['RSA']={}; -dict_ref['compute']['ssl_bm']['AES']={}; -dict_ref['compute']['ssl_bm']['RSA']['512b']=22148.9 -dict_ref['compute']['ssl_bm']['RSA']['1024b']=7931.44 -dict_ref['compute']['ssl_bm']['RSA']['2048b']=1544.3 -dict_ref['compute']['ssl_bm']['RSA']['4096b']=161.92 -dict_ref['compute']['ssl_bm']['AES']['16B']=735490250 -dict_ref['compute']['ssl_bm']['AES']['64B']=788429210 -dict_ref['compute']['ssl_bm']['AES']['256B']=803323650 -dict_ref['compute']['ssl_bm']['AES']['1024B']=808861020 -dict_ref['compute']['ssl_bm']['AES']['8192B']=807701160 +dict_ref['compute']['ssl_bm'] = {} +dict_ref['compute']['ssl_bm']['RSA'] = {} +dict_ref['compute']['ssl_bm']['AES'] = {} +dict_ref['compute']['ssl_bm']['RSA']['512b'] = 22148.9 +dict_ref['compute']['ssl_bm']['RSA']['1024b'] = 7931.44 +dict_ref['compute']['ssl_bm']['RSA']['2048b'] = 1544.3 +dict_ref['compute']['ssl_bm']['RSA']['4096b'] = 161.92 +dict_ref['compute']['ssl_bm']['AES']['16B'] = 735490250 +dict_ref['compute']['ssl_bm']['AES']['64B'] = 788429210 +dict_ref['compute']['ssl_bm']['AES']['256B'] = 803323650 +dict_ref['compute']['ssl_bm']['AES']['1024B'] = 808861020 +dict_ref['compute']['ssl_bm']['AES']['8192B'] = 807701160 -dict_ref['compute']['ssl_vm']={}; -dict_ref['compute']['ssl_vm']['RSA']={}; -dict_ref['compute']['ssl_vm']['AES']={}; -dict_ref['compute']['ssl_vm']['RSA']['512b']=22148.9 -dict_ref['compute']['ssl_vm']['RSA']['1024b']=7931.44 -dict_ref['compute']['ssl_vm']['RSA']['2048b']=1544.3 -dict_ref['compute']['ssl_vm']['RSA']['4096b']=161.92 -dict_ref['compute']['ssl_vm']['AES']['16B']=735490250 -dict_ref['compute']['ssl_vm']['AES']['64B']=788429210 -dict_ref['compute']['ssl_vm']['AES']['256B']=803323650 -dict_ref['compute']['ssl_vm']['AES']['1024B']=808861020 -dict_ref['compute']['ssl_vm']['AES']['8192B']=807701160 +dict_ref['compute']['ssl_vm'] = {} +dict_ref['compute']['ssl_vm']['RSA'] = {} +dict_ref['compute']['ssl_vm']['AES'] = {} +dict_ref['compute']['ssl_vm']['RSA']['512b'] = 22148.9 +dict_ref['compute']['ssl_vm']['RSA']['1024b'] = 7931.44 +dict_ref['compute']['ssl_vm']['RSA']['2048b'] = 1544.3 +dict_ref['compute']['ssl_vm']['RSA']['4096b'] = 161.92 +dict_ref['compute']['ssl_vm']['AES']['16B'] = 735490250 +dict_ref['compute']['ssl_vm']['AES']['64B'] = 788429210 +dict_ref['compute']['ssl_vm']['AES']['256B'] = 803323650 +dict_ref['compute']['ssl_vm']['AES']['1024B'] = 808861020 +dict_ref['compute']['ssl_vm']['AES']['8192B'] = 807701160 +dict_ref['compute']['ramspeed_bm'] = {} +dict_ref['compute']['ramspeed_bm']['INTmem'] = {} +dict_ref['compute']['ramspeed_bm']['FLOATmem'] = {} +dict_ref['compute']['ramspeed_bm']['INTmem']['Average (MB/s)'] = 12268.38 +dict_ref['compute']['ramspeed_bm']['FLOATmem']['Average (MB/s)'] = 9758.79 -dict_ref['compute']['ramspeed_bm']={}; -dict_ref['compute']['ramspeed_bm']['INTmem']={}; -dict_ref['compute']['ramspeed_bm']['FLOATmem']={}; -dict_ref['compute']['ramspeed_bm']['INTmem']['Average (MB/s)']=12268.38 -dict_ref['compute']['ramspeed_bm']['FLOATmem']['Average (MB/s)']=9758.79 +dict_ref['compute']['ramspeed_vm'] = {} +dict_ref['compute']['ramspeed_vm']['INTmem'] = {} +dict_ref['compute']['ramspeed_vm']['FLOATmem'] = {} +dict_ref['compute']['ramspeed_vm']['INTmem']['Average (MB/s)'] = 12147.59 +dict_ref['compute']['ramspeed_vm']['FLOATmem']['Average (MB/s)'] = 9064.09 -dict_ref['compute']['ramspeed_vm']={}; -dict_ref['compute']['ramspeed_vm']['INTmem']={}; -dict_ref['compute']['ramspeed_vm']['FLOATmem']={}; -dict_ref['compute']['ramspeed_vm']['INTmem']['Average (MB/s)']=12147.59 -dict_ref['compute']['ramspeed_vm']['FLOATmem']['Average (MB/s)']=9064.09 +dict_ref['storage'] = {} +dict_ref['storage']['fio_bm'] = {} +dict_ref['storage']['fio_bm']['read'] = {} +dict_ref['storage']['fio_bm']['write'] = {} +dict_ref['storage']['fio_bm']['read']['IOPS'] = 6693 +dict_ref['storage']['fio_bm']['write']['IOPS'] = 6688 +dict_ref['storage']['fio_vm'] = {} +dict_ref['storage']['fio_vm']['read'] = {} +dict_ref['storage']['fio_vm']['write'] = {} +dict_ref['storage']['fio_vm']['read']['IOPS'] = 2239 +dict_ref['storage']['fio_vm']['write']['IOPS'] = 2237 -dict_ref['storage']={}; -dict_ref['storage']['fio_bm']={}; -dict_ref['storage']['fio_bm']['read']={}; -dict_ref['storage']['fio_bm']['write']={}; -dict_ref['storage']['fio_bm']['read']['IOPS']=6693 -dict_ref['storage']['fio_bm']['write']['IOPS']=6688 - -dict_ref['storage']['fio_vm']={}; -dict_ref['storage']['fio_vm']['read']={}; -dict_ref['storage']['fio_vm']['write']={}; -dict_ref['storage']['fio_vm']['read']['IOPS']=2239 -dict_ref['storage']['fio_vm']['write']['IOPS']=2237 - -dict_ref['network']={}; -dict_ref['network']['iperf_bm']={}; -dict_ref['network']['iperf_vm']={}; -dict_ref['network']['iperf_vm_2']={}; -dict_ref['network']['iperf_bm']['throughput received(b/s)']=944473000.0 -dict_ref['network']['iperf_vm']['throughput received(b/s)']=14416700000.0 -dict_ref['network']['iperf_vm_2']['throughput received(b/s)']=2461530000.0 +dict_ref['network'] = {} +dict_ref['network']['iperf_bm'] = {} +dict_ref['network']['iperf_vm'] = {} +dict_ref['network']['iperf_vm_2'] = {} +dict_ref['network']['iperf_bm']['throughput received(b/s)'] = 944473000.0 +dict_ref['network']['iperf_vm']['throughput received(b/s)'] = 14416700000.0 +dict_ref['network']['iperf_vm_2']['throughput received(b/s)'] = 2461530000.0 with open('reference.json', 'w+') as result_json: json.dump(dict_ref, result_json, indent=4, sort_keys=True) - diff --git a/data/ref_results/index_calculation.py b/data/ref_results/index_calculation.py index ed597fb8..e3c75350 100644 --- a/data/ref_results/index_calculation.py +++ b/data/ref_results/index_calculation.py @@ -1,44 +1,41 @@ import json -from cinderclient.utils import arg -from result_accum import result_concat as concat -def compute_index(total_measured,ref_result,count): + +def compute_index(total_measured, ref_result, count): try: - average=float(total_measured/count) - + average = float(total_measured / count) + except ZeroDivisionError: - average=0 - - index=average/ref_result + average = 0 + index = average / ref_result return index -def get_reference (*args): - - with open ('./reference.json') as reference_file: - reference_djson=json.load(reference_file) - temp=list(args) - for arg in args: - ref_n=reference_djson.get(str(arg)) - reference_djson=reference_djson.get(str(arg)) - +def get_reference(*args): + + with open('./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] + +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]['1 Testcase Name'] == str(testcase): - count=count+1 + count = count + 1 for arg in args: - if arg == args[c-1]: + if arg == args[c - 1]: try: - result=float(dict_temp.get(str(arg))) + 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) + 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/data/ref_results/network_benchmarks_indices.py b/data/ref_results/network_benchmarks_indices.py index b98269b6..96ccd4fc 100644 --- a/data/ref_results/network_benchmarks_indices.py +++ b/data/ref_results/network_benchmarks_indices.py @@ -1,27 +1,20 @@ from index_calculation import generic_index as get_index -from index_calculation import get_reference +from index_calculation import get_reference from result_accum import result_concat as concat -def iperf_index (): - iperf_dict=concat('../../results/iperf/') - #print iperf_dict - iperf_bm_ref = get_reference('network','iperf_bm','throughput received(b/s)') - - iperf_bm_index= get_index(iperf_dict,'iperf_bm',iperf_bm_ref,'4 IPERF result', '2. Bandwidth','2. throughput Received (b/s)') - - iperf_vm_ref = get_reference('network','iperf_vm','throughput received(b/s)') - iperf_vm_index= get_index(iperf_dict,'iperf_vm',iperf_vm_ref,'4 IPERF result', '2. Bandwidth','2. throughput Received (b/s)') - - 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,'4 IPERF result', '2. Bandwidth','2. throughput Received (b/s)') - +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, '4 IPERF result', '2. Bandwidth', '2. throughput Received (b/s)') + iperf_vm_ref = get_reference('network', 'iperf_vm', 'throughput received(b/s)') + iperf_vm_index = get_index(iperf_dict, 'iperf_vm', iperf_vm_ref, '4 IPERF result', '2. Bandwidth', '2. throughput Received (b/s)') - - iperf_index= float(iperf_bm_index+iperf_vm_index+iperf_vm_2_index)/3 + 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, '4 IPERF result', '2. Bandwidth', '2. throughput Received (b/s)') + iperf_index = float(iperf_bm_index + iperf_vm_index + iperf_vm_2_index) / 3 print iperf_index - iperf_dict_i={}; - iperf_dict_i['1. Index']=iperf_index - iperf_dict_i['2. Results']=iperf_dict + iperf_dict_i = {} + iperf_dict_i['1. Index'] = iperf_index + iperf_dict_i['2. Results'] = iperf_dict return iperf_dict_i - diff --git a/data/ref_results/network_suite.py b/data/ref_results/network_suite.py index fd756aa0..37dcb093 100644 --- a/data/ref_results/network_suite.py +++ b/data/ref_results/network_suite.py @@ -2,33 +2,29 @@ import json import network_benchmarks_indices as benchmark_indices -network_dict={}; +network_dict = {} try: - network_dict['IPERF']=benchmark_indices.iperf_index() + network_dict['IPERF'] = benchmark_indices.iperf_index() except: pass - - - -network_bench_list=['IPERF'] -temp=0 -l=len(network_bench_list) +network_bench_list = ['IPERF'] +temp = 0 +l = len(network_bench_list) for benchmark in network_bench_list: try: - temp=temp+float(network_dict[benchmark]['1. Index']) + temp = temp + float(network_dict[benchmark]['1. Index']) except: - l=l-1 + l = l - 1 pass if l == 0: - print "No network results found" + 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 + 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/result_accum.py b/data/ref_results/result_accum.py index 4fffb6b1..6cd55886 100644 --- a/data/ref_results/result_accum.py +++ b/data/ref_results/result_accum.py @@ -1,11 +1,12 @@ import os import json + def result_concat(targ_dir): - list_vm=[]; - list_bm=[]; - diction={}; - + list_vm = [] + list_bm = [] + diction = {} + for file in os.listdir(targ_dir): if file.endswith(".json"): if file.startswith("instance"): @@ -13,21 +14,18 @@ def result_concat(targ_dir): list_vm.append(file) else: list_bm.append(file) - l=len(list_bm) - k=len(list_vm) + 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,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 + 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/data/ref_results/storage_benchmarks_indices.py b/data/ref_results/storage_benchmarks_indices.py index db3890a0..f51b3d6e 100644 --- a/data/ref_results/storage_benchmarks_indices.py +++ b/data/ref_results/storage_benchmarks_indices.py @@ -1,34 +1,30 @@ from index_calculation import generic_index as get_index -from index_calculation import get_reference +from index_calculation import get_reference from result_accum import result_concat as concat -def fio_index (): - fio_dict=concat('../../results/fio/') - #print _perf_dict - 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,'4 FIO result', 'Job_0','read','IO/sec') - - 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,'4 FIO result', 'Job_0','write','IO/sec') - - 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,'4 FIO result', 'Job_0','read','IO/sec') - - 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,'4 FIO result', 'Job_0','write','IO/sec') - - fio_vm_index= (fio_r_vm_index+fio_w_vm_index)/2 - - fio_index=(fio_bm_index+fio_vm_index)/2 +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, '4 FIO result', 'Job_0', 'read', 'IO/sec') + + 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, '4 FIO result', 'Job_0', 'write', 'IO/sec') + + 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, '4 FIO result', 'Job_0', 'read', 'IO/sec') + + 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, '4 FIO result', 'Job_0', 'write', 'IO/sec') + + 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['1. Index']=fio_index - fio_dict_i['2. Results']=fio_dict + + fio_dict_i = {} + fio_dict_i['1. Index'] = fio_index + fio_dict_i['2. Results'] = fio_dict return fio_dict_i - diff --git a/data/ref_results/storage_suite.py b/data/ref_results/storage_suite.py index 5c1a89a2..52d6c8c6 100644 --- a/data/ref_results/storage_suite.py +++ b/data/ref_results/storage_suite.py @@ -2,30 +2,26 @@ import json import storage_benchmarks_indices as benchmark_indices -storage_dict={}; +storage_dict = {} try: - storage_dict['FIO']=benchmark_indices.fio_index() + storage_dict['FIO'] = benchmark_indices.fio_index() except OSError: pass - -storage_bench_list=['FIO'] -l=len(storage_bench_list) -temp=0 +storage_bench_list = ['FIO'] +l = len(storage_bench_list) +temp = 0 for benchmark in storage_bench_list: try: - temp=temp+float(storage_dict[benchmark]['1. Index']) + temp = temp + float(storage_dict[benchmark]['1. Index']) except KeyError: - l-=1 - - + 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 + 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/func/fetchimg.py b/func/fetchimg.py index 88178bed..1ed3def6 100644 --- a/func/fetchimg.py +++ b/func/fetchimg.py @@ -9,7 +9,8 @@ import os import time -IMGSTORE="/home/opnfv/imgstore" +IMGSTORE = "/home/opnfv/imgstore" + class FetchImg: @@ -21,14 +22,13 @@ class FetchImg: time.sleep(2) os.system('mkdir -p Temp_Img') filepath = './Temp_Img/QTIP_CentOS.qcow2' - imgstorepath = IMGSTORE+"/QTIP_CentOS.qcow2" + imgstorepath = IMGSTORE + "/QTIP_CentOS.qcow2" if os.path.isfile(imgstorepath): os.system("ln -s %s %s" % (imgstorepath, filepath)) print "QTIP_CentOS.qcow2 exists locally. Skipping the download and using the file from IMG store" else: print 'Fetching QTIP_CentOS.qcow2' - os.system( - 'wget http://artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2 -P Temp_Img') + os.system('wget http://artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2 -P Temp_Img') while not os.path.isfile(filepath): time.sleep(10) diff --git a/setup.py b/setup.py index cb19e879..52874dd3 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,9 @@ from distutils.core import setup + setup(name='qtip', py_modules=['qtip'], version='1.0', author='opnfv', - packages=['func','data.ref_results','data.report'], - ) - + packages=['func', 'data.ref_results', 'data.report']) -- cgit 1.2.3-korg