From 2b172eef7185382ed4283d1868896626ae3ef5f1 Mon Sep 17 00:00:00 2001 From: "zhifeng.jiang" Date: Fri, 23 Sep 2016 11:38:35 +0800 Subject: Change result keys to lower-case and remove ' .' QTIP-93 Change-Id: I125163e05b49d9631838e89571d59a967252292e Signed-off-by: zhifeng.jiang --- benchmarks/playbooks/info_script/info_collect.py | 45 ++++++++++--------- .../result_transform/dpi/dpi_transform.py | 5 +-- .../playbooks/result_transform/dpi/final_report.py | 20 --------- .../playbooks/result_transform/final_report.py | 9 ++-- .../result_transform/fio/fio_result_transform.py | 51 +++++++--------------- .../result_transform/iperf/iperf_transform.py | 14 +++--- .../result_transform/ramspd/ramspd_transform.py | 25 +++++------ .../result_transform/ssl/ssl_transform.py | 28 +++++------- .../playbooks/result_transform/ubench_transform.py | 18 ++++---- 9 files changed, 79 insertions(+), 136 deletions(-) delete mode 100644 benchmarks/playbooks/result_transform/dpi/final_report.py (limited to 'benchmarks') diff --git a/benchmarks/playbooks/info_script/info_collect.py b/benchmarks/playbooks/info_script/info_collect.py index 4daed318..3fc35d5a 100644 --- a/benchmarks/playbooks/info_script/info_collect.py +++ b/benchmarks/playbooks/info_script/info_collect.py @@ -13,7 +13,6 @@ 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() @@ -22,19 +21,19 @@ inxi_kernel = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Kernel:).*(?=Console 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 +info_dict = {'hostname': inxi_host, + 'product': inxi_product, + 'os': inxi_distro, + 'kernel': inxi_kernel, + 'cpu': inxi_cpu, + 'cpu_usage': '{0}%'.format(str(round(cpu_usage, 3))), + 'memory_usage': inxi_mem, + 'disk_usage': inxi_HD} network_flag = str(sys.argv[1]).rstrip() if (network_flag == 'n'): - Info_dict['9_Network_Interfaces'] = {} + info_dict['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()) @@ -46,24 +45,24 @@ if (network_flag == 'n'): 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 + info_dict['network_interfaces']['interface_' + str(x)] = {} + info_dict['network_interfaces']['interface_' + str(x)]['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['network_interfaces']['interface_' + str(x)]['interface_info'] = inxi_card_2 elif x < (i): print "two" 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 + info_dict['network_interfaces']['interface_' + str(x)] = {} + info_dict['network_interfaces']['interface_' + str(x)]['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 + info_dict['network_interfaces']['interface_' + str(x)]['interface_info'] = inxi_card_2 elif x == i: print "Three" - Info_dict['9_Network_Interfaces']['Interface_' + str(x)] = {} + info_dict['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 + info_dict['network_interfaces']['interface_' + str(x)]['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['network_interfaces']['interface_' + str(x)]['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") @@ -76,12 +75,12 @@ if (network_flag == 'n'): 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 + info_dict['interface_io'] = interface -print Info_dict +print info_dict with open('./sys_info_temp', 'w+')as out_info: - pickle.dump(Info_dict, 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) + json.dump(info_dict, result_json, indent=4, sort_keys=True) diff --git a/benchmarks/playbooks/result_transform/dpi/dpi_transform.py b/benchmarks/playbooks/result_transform/dpi/dpi_transform.py index 622030cd..ee29d8e2 100644 --- a/benchmarks/playbooks/result_transform/dpi/dpi_transform.py +++ b/benchmarks/playbooks/result_transform/dpi/dpi_transform.py @@ -41,8 +41,7 @@ os.popen( home_dir = str(os.popen("echo $HOME").read().rstrip()) host = os.popen("echo $HOSTNAME") -result = {} -result['DPI_benchmark(M pps)'] = round(dpi_result_pps, 3) -result['DPI_benchmark(Gb/s)'] = round(dpi_result_bps, 3) +result = {'pps': round(dpi_result_pps, 3), + 'bps': round(dpi_result_bps, 3)} with open('./result_temp', 'w+') as result_file: pickle.dump(result, result_file) diff --git a/benchmarks/playbooks/result_transform/dpi/final_report.py b/benchmarks/playbooks/result_transform/dpi/final_report.py deleted file mode 100644 index be25daa8..00000000 --- a/benchmarks/playbooks/result_transform/dpi/final_report.py +++ /dev/null @@ -1,20 +0,0 @@ -import pickle -import json -import datetime -import sys - -with open('/root/qtip_result/sys_info_temp', 'r') as sys_info_f: - sys_info_dict = pickle.load(sys_info_f) -with open('/root/qtip_result/result_temp', 'r') as result_f: - result_dict = pickle.load(result_f) - -host_name = sys_info_dict['1_Hostname'] -benchmark_name = str(sys.argv[1]) -report_time_stamp = str(datetime.datetime.utcnow().isoformat()) -final_dict = {} -final_dict['1 Time of Report'] = report_time_stamp -final_dict['2 System Information'] = sys_info_dict -final_dict['3 ' + benchmark_name + ' result'] = result_dict - -with open('/root/qtip_result/' + host_name + '-' + report_time_stamp + '.json', 'w+') as result_json: - json.dump(final_dict, result_json, indent=4, sort_keys=True) diff --git a/benchmarks/playbooks/result_transform/final_report.py b/benchmarks/playbooks/result_transform/final_report.py index 6a10c026..274742d4 100644 --- a/benchmarks/playbooks/result_transform/final_report.py +++ b/benchmarks/playbooks/result_transform/final_report.py @@ -15,11 +15,10 @@ host_name = (os.popen("hostname").read().rstrip()) benchmark_name = str(sys.argv[1]) testcase_name = str(sys.argv[2]) report_time_stamp = str(datetime.datetime.utcnow().isoformat()) -final_dict = {} -final_dict['1 Testcase Name'] = testcase_name -final_dict['2 Time of Report'] = report_time_stamp -final_dict['3 System Information'] = sys_info_dict -final_dict['4 ' + benchmark_name + ' result'] = result_dict +final_dict = {"name": testcase_name, + "time": report_time_stamp, + "system_information": sys_info_dict, + "details": result_dict} with open('./' + host_name + '-' + report_time_stamp + '.json', 'w+') as result_json: json.dump(final_dict, result_json, indent=4, sort_keys=True) diff --git a/benchmarks/playbooks/result_transform/fio/fio_result_transform.py b/benchmarks/playbooks/result_transform/fio/fio_result_transform.py index 9929aa18..5ecac823 100755 --- a/benchmarks/playbooks/result_transform/fio/fio_result_transform.py +++ b/benchmarks/playbooks/result_transform/fio/fio_result_transform.py @@ -3,48 +3,27 @@ import pickle import os import datetime -with open("fio_result.json") as fio_raw: - fio_data = json.load(fio_raw) - -r_iops = [] -r_io_bytes = [] -r_io_runtime = [] -r_lat = [] -w_iops = [] -w_io_bytes = [] -w_io_runtime = [] -w_lat = [] -total_jobs = len(fio_data["jobs"]) +def get_fio_job_result(fio_job_data): + return {'read': {'io_bytes': fio_job_data["read"]["io_bytes"], + 'io_ps': fio_job_data["read"]["iops"], + 'io_runtime_millisec': fio_job_data["read"]["runtime"], + 'mean_io_latenchy_microsec': fio_job_data["read"]["lat"]["mean"]}, + 'write': {'io_bytes': fio_job_data["write"]["io_bytes"], + 'io_ps': fio_job_data["write"]["iops"], + 'io_runtime_millisec': fio_job_data["write"]["runtime"], + 'mean_io_latenchy_microsec': fio_job_data["write"]["lat"]["mean"]}} -for x in range(0, int(total_jobs)): - r_iops.append(fio_data["jobs"][x]["read"]["iops"]) - r_io_bytes.append(fio_data["jobs"][x]["read"]["io_bytes"]) - r_io_runtime.append(fio_data["jobs"][x]["read"]["runtime"]) - r_lat.append(fio_data["jobs"][x]["read"]["lat"]["mean"]) - w_iops.append(fio_data["jobs"][x]["write"]["iops"]) - w_io_bytes.append(fio_data["jobs"][x]["write"]["io_bytes"]) - w_io_runtime.append(fio_data["jobs"][x]["write"]["runtime"]) - w_lat.append(fio_data["jobs"][x]["write"]["lat"]["mean"]) -FIO_result_dict = {} - -for x in range(0, total_jobs): - FIO_result_dict['Job_' + str(x)] = {} - FIO_result_dict['Job_' + str(x)]['read'] = {} - FIO_result_dict['Job_' + str(x)]['read']['Total_IO_Bytes'] = r_io_bytes[x] - FIO_result_dict['Job_' + str(x)]['read']['IO/sec'] = r_iops[x] - FIO_result_dict['Job_' + str(x)]['read']['IO_runtime (millisec)'] = r_io_runtime[x] - FIO_result_dict['Job_' + str(x)]['read']['mean_IO_latenchy (microsec)'] = r_lat[x] +with open("fio_result.json") as fio_raw: + fio_data = json.load(fio_raw) - FIO_result_dict['Job_' + str(x)]['write'] = {} - FIO_result_dict['Job_' + str(x)]['write']['Total_IO_Bytes'] = w_io_bytes[x] - FIO_result_dict['Job_' + str(x)]['write']['IO/sec'] = w_iops[x] - FIO_result_dict['Job_' + str(x)]['write']['IO_runtime (millisec)'] = w_io_runtime[x] - FIO_result_dict['Job_' + str(x)]['write']['mean_IO_latenchy (microsec)'] = w_lat[x] +fio_result_dict = {} +for x, result in enumerate(map(get_fio_job_result, fio_data["jobs"])): + fio_result_dict['job_{0}'.format(x)] = result host_name = (os.popen("hostname").read().rstrip()) report_time = str(datetime.datetime.utcnow().isoformat()) os.system("mv fio_result.json " + str(host_name) + "-" + report_time + ".log") with open('./result_temp', 'w + ')as out_fio_result: - pickle.dump(FIO_result_dict, out_fio_result) + pickle.dump(fio_result_dict, out_fio_result) diff --git a/benchmarks/playbooks/result_transform/iperf/iperf_transform.py b/benchmarks/playbooks/result_transform/iperf/iperf_transform.py index 8df5a79a..b52e4634 100644 --- a/benchmarks/playbooks/result_transform/iperf/iperf_transform.py +++ b/benchmarks/playbooks/result_transform/iperf/iperf_transform.py @@ -11,16 +11,14 @@ total_byte_received = raw_iperf_data['end']['sum_received']['bytes'] cpu_host_total_percent = raw_iperf_data['end']['cpu_utilization_percent']['host_total'] cpu_remote_total_percent = raw_iperf_data['end']['cpu_utilization_percent']['remote_total'] -result = {} time_stamp = str(datetime.datetime.utcnow().isoformat()) -result['1. Version'] = raw_iperf_data['start']['version'] -result['2. Bandwidth'] = {} -result['2. Bandwidth']['1. throughput Sender (b/s)'] = bits_sent -result['2. Bandwidth']['2. throughput Received (b/s)'] = bits_received -result['3. CPU'] = {} -result['3. CPU']['1. CPU host total (%)'] = cpu_host_total_percent -result['3. CPU']['2. CPU remote total (%)'] = cpu_remote_total_percent +result = {'version': raw_iperf_data['start']['version'], + 'bandwidth': {'sender_throughput': bits_sent, + 'received_throughput': bits_received}, + 'cpu': {'cpu_host': cpu_host_total_percent, + 'cpu_remote': cpu_remote_total_percent} + } with open('iperf_raw-' + time_stamp + '.log', 'w+') as ofile: ofile.write(json.dumps(raw_iperf_data)) diff --git a/benchmarks/playbooks/result_transform/ramspd/ramspd_transform.py b/benchmarks/playbooks/result_transform/ramspd/ramspd_transform.py index c3f03dd0..960f84fc 100644 --- a/benchmarks/playbooks/result_transform/ramspd/ramspd_transform.py +++ b/benchmarks/playbooks/result_transform/ramspd/ramspd_transform.py @@ -26,21 +26,16 @@ time_stamp = str(datetime.datetime.utcnow().isoformat()) os.system("mv Intmem " + hostname + "-" + time_stamp + ".log") os.system("cp Floatmem >> " + hostname + "-" + time_stamp + ".log") -result = {} - -result['1. INTmem bandwidth'] = {} -result['1. INTmem bandwidth']['1. Copy (MB/s)'] = intmem_copy -result['1. INTmem bandwidth']['2. Add (MB/s)'] = intmem_add -result['1. INTmem bandwidth']['3. Scale (MB/s)'] = intmem_scale -result['1. INTmem bandwidth']['4. Triad (MB/s)'] = intmem_triad -result['1. INTmem bandwidth']['5. Average (MB/s)'] = intmem_average - -result['2. FLOATmem bandwidth'] = {} -result['2. FLOATmem bandwidth']['1. Copy (MB/s)'] = floatmem_copy -result['2. FLOATmem bandwidth']['2. Add (MB/s)'] = floatmem_add -result['2. FLOATmem bandwidth']['3. Scale (MB/s)'] = floatmem_scale -result['2. FLOATmem bandwidth']['4. Triad (MB/s)'] = floatmem_triad -result['2. FLOATmem bandwidth']['5. Average (MB/s)'] = floatmem_average +result = {"int_bandwidth": {"copy": intmem_copy, + "add": intmem_add, + "scale": intmem_scale, + "triad": intmem_triad, + "average": intmem_average}, + "float_bandwidth": {"copy": floatmem_copy, + "add": floatmem_add, + "scale": floatmem_scale, + "triad": floatmem_triad, + "average": floatmem_average}} with open('./result_temp', 'w+') as result_file: pickle.dump(result, result_file) diff --git a/benchmarks/playbooks/result_transform/ssl/ssl_transform.py b/benchmarks/playbooks/result_transform/ssl/ssl_transform.py index 029135ac..de84d24b 100644 --- a/benchmarks/playbooks/result_transform/ssl/ssl_transform.py +++ b/benchmarks/playbooks/result_transform/ssl/ssl_transform.py @@ -37,22 +37,18 @@ time_stamp = str(datetime.datetime.utcnow().isoformat()) os.system("mv RSA_dump " + hostname + "-" + time_stamp + ".log") os.system("cat AES-128-CBC_dump >> " + hostname + "-" + time_stamp + ".log") -result = {} - -result['1. Version'] = [openssl_version] -result['2. RSA signatures'] = {} -result['2. RSA signatures']['1. 512 bits (sign/s)'] = rsa_512_sps -result['2. RSA signatures']['2. 1024 bits (sign/s)'] = rsa_1024_sps -result['2. RSA signatures']['3. 2048 bits (sign/s)'] = rsa_2048_sps -result['2. RSA signatures']['4. 4096 bits (sign/s)'] = rsa_4096_sps - -result['3. AES-128-cbc throughput'] = {} -result['3. AES-128-cbc throughput']['1. 16 Bytes block (B/sec)'] = aes_16B -result['3. AES-128-cbc throughput']['2. 64 Bytes block (B/sec)'] = aes_64B -result['3. AES-128-cbc throughput']['3. 256 Bytes block (B/sec)'] = aes_256B -result['3. AES-128-cbc throughput']['4. 1024 Bytes block (B/sec)'] = aes_1024B -result['3. AES-128-cbc throughput']['5. 8192 Bytes block (B/sec)'] = aes_8192B - +result = {"version": [openssl_version], + "rsa_sig": {"512_bits": rsa_512_sps, + "1024_bits": rsa_1024_sps, + "2048_bits": rsa_2048_sps, + "4096_bits": rsa_4096_sps, + "unit": "sig/sec"}, + "aes_128_cbc": {"16B_block": aes_16B, + "64B_block": aes_64B, + "256B_block": aes_256B, + "1024B_block": aes_1024B, + "8192B_block": aes_8192B, + "unit": "B/sec"}} with open('./result_temp', 'w+') as result_file: pickle.dump(result, result_file) diff --git a/benchmarks/playbooks/result_transform/ubench_transform.py b/benchmarks/playbooks/result_transform/ubench_transform.py index 3c8ba1d8..ab5fe171 100644 --- a/benchmarks/playbooks/result_transform/ubench_transform.py +++ b/benchmarks/playbooks/result_transform/ubench_transform.py @@ -13,20 +13,18 @@ cpu_2 = os.popen( "cat $HOME/tempT/UnixBench/results/* | grep 'of tests' | awk '{print $6;}' | awk 'NR==2'").read().rstrip() -Index_1 = os.popen( +index_1 = os.popen( "cat $HOME/tempT/UnixBench/results/* | grep 'Index Score (Partial Only) ' | awk '{print $7;}' | awk 'NR==1'").read().rstrip() -Index_2 = os.popen( +index_2 = os.popen( "cat $HOME/tempT/UnixBench/results/* | grep 'Index Score (Partial Only) ' | awk '{print $7;}' | awk 'NR==2'").read().rstrip() -result = {} -result['1.Number of CPU(s) in system'] = total_cpu -result['2.Single CPU test'] = {} -result['2.Single CPU test']['1.Number of parallell test(s)'] = cpu_1 -result['2.Single CPU test']['2.Index score'] = Index_1 -result['3.Multi CPU test'] = {} -result['3.Multi CPU test']['1.Number of parallell test(s)'] = cpu_2 -result['3.Multi CPU test']['2.Index score'] = Index_2 +result = {"n_cpu": total_cpu, + "single": {"n_para_test": cpu_1, + "score": index_1}, + "multi": {"n_para_test": cpu_2, + "score": index_2} + } with open('result_temp', 'w+') as result_file: pickle.dump(result, result_file) -- cgit 1.2.3-korg