summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2016-10-17 00:48:11 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-10-17 00:48:11 +0000
commit507e8c569a699ceab085e01197a32a628c3c88d9 (patch)
treed968127732826d59b2bbd21970655998449050dd /utils
parent2af11e64cc8b1eb321982be9618417724d529a29 (diff)
parenteddc35b497362c0c01e612d66ed19c4d5c9dd328 (diff)
Merge "Adjust directory structure"
Diffstat (limited to 'utils')
-rw-r--r--utils/report/Qtip_Report.py108
-rw-r--r--utils/report/__init__.py0
-rw-r--r--utils/report/get_indices.py8
-rw-r--r--utils/report/get_results.py50
-rw-r--r--utils/report/qtip_graph.py30
5 files changed, 196 insertions, 0 deletions
diff --git a/utils/report/Qtip_Report.py b/utils/report/Qtip_Report.py
new file mode 100644
index 00000000..cd20d57c
--- /dev/null
+++ b/utils/report/Qtip_Report.py
@@ -0,0 +1,108 @@
+from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
+from reportlab.lib.styles import getSampleStyleSheet
+from reportlab.lib.units import inch
+from reportlab.lib.pagesizes import letter
+import qtip_graph as graph
+import get_indices as results
+from get_results import report_concat
+from get_results import generate_result
+
+
+def dump_result(Stor, directory, testcase):
+ try:
+ lower_s = testcase.lower()
+ Stor.append(Paragraph(testcase, Style['h3']))
+ l1 = report_concat(directory, lower_s)
+ l = 1
+ for a in l1:
+ Stor.append(Paragraph(testcase + " result_" + str(l), Style['h5']))
+ raw_string = generate_result(a, 0)
+ replaced_string = raw_string.replace('\n', '<br/> ').replace(' ', '&nbsp;')
+ Stor.append(Paragraph(replaced_string, Style['BodyText']))
+ l = l + 1
+ except OSError:
+ print "Results for {0} not found".format(testcase)
+
+doc = SimpleDocTemplate("../../results/QTIP_results.pdf", pagesize=letter,
+ rightMargin=72, leftMargin=72,
+ topMargin=72, bottomMargin=18)
+Stor = []
+Style = getSampleStyleSheet()
+Title = "QTIP Benchmark Suite"
+Stor.append(Paragraph(Title, Style['Title']))
+H1 = "Results"
+Stor.append(Spacer(0, 36))
+Stor.append(Paragraph(H1, Style['h2']))
+compute = 0
+storage = 0
+network = 0
+try:
+ compute = results.get_index('compute_result')
+except IOError:
+ pass
+
+try:
+ storage = results.get_index('storage_result')
+except IOError:
+ pass
+try:
+ network = results.get_index('network_result')
+except IOError:
+ pass
+
+Stor.append(Paragraph("Compute Suite: %f" % compute, Style['h5']))
+Stor.append(Paragraph("Storage Suite: %f" % storage, Style['h5']))
+Stor.append(Paragraph("Network Suite: %f" % network, Style['h5']))
+graph.plot_indices(compute, storage, network)
+qtip_graph = ('qtip_graph.jpeg')
+im = Image(qtip_graph, 5 * inch, 4 * inch)
+Stor.append(im)
+Stor.append(Spacer(0, 12))
+Stor.append(Paragraph("Reference POD", Style['h5']))
+ptext = "The Dell OPNFV Lab POD3 has been taken as the reference POD against which the reference results have been collected. The POD consists of 6 identical servers. The details of such a server are:"
+Stor.append(Paragraph(ptext, Style['Normal']))
+ptext = "<bullet>&bull;</bullet>Server Type: Dell PowerEdge R630 Server"
+Stor.append(Paragraph(ptext, Style['Bullet']))
+ptext = "<bullet>&bull;</bullet>CPU: Intel Xeon E5-2698 @ 2300 MHz"
+Stor.append(Paragraph(ptext, Style["Bullet"]))
+ptext = "<bullet>&bull;</bullet>RAM: 128GB"
+Stor.append(Paragraph(ptext, Style["Bullet"]))
+ptext = "<bullet>&bull;</bullet>Storage SSD: 420GB"
+Stor.append(Paragraph(ptext, Style["Bullet"]))
+ptext = "<bullet>&bull;</bullet>Network Card: Intel 2P X520/2P I350 rNDC"
+Stor.append(Paragraph(ptext, Style["Bullet"]))
+ptext = "Servers interconnected through a DELL S4810 switch using a 10Gbps physical link"
+Stor.append(Paragraph(ptext, Style["Bullet"]))
+Stor.append(Spacer(0, 12))
+ptext = "For Further Details of the Reference POD hardware, please visit: https://wiki.opnfv.org/reference_pod_hardware_details"
+Stor.append(Paragraph(ptext, Style['Normal']))
+Stor.append(Spacer(0, 12))
+ptext = "For Details of the Reference POD Results, please visit: https://wiki.opnfv.org/reference_pod_qtip_results"
+Stor.append(Spacer(0, 12))
+Stor.append(Paragraph(ptext, Style['Normal']))
+Stor.append(Paragraph("RAW Results", Style['h1']))
+Stor.append(Paragraph("Compute Results", Style['h2']))
+
+dump_result(Stor, "../../results/dhrystone/", "Dhrystone_bm")
+dump_result(Stor, "../../results/dhrystone/", "Dhrystone_vm")
+
+dump_result(Stor, "../../results/whetstone/", "Whetstone_bm")
+dump_result(Stor, "../../results/whetstone/", "Whetstone_vm")
+
+dump_result(Stor, "../../results/ramspeed/", "Ramspeed_bm")
+dump_result(Stor, "../../results/ramspeed/", "Ramspeed_vm")
+
+dump_result(Stor, "../../results/ssl/", "SSL_bm")
+dump_result(Stor, "../../results/ssl/", "SSL_vm")
+
+Stor.append(Paragraph("Network Results", Style['h2']))
+dump_result(Stor, "../../results/iperf/", "IPERF_bm")
+dump_result(Stor, "../../results/iperf/", "IPERF_vm")
+dump_result(Stor, "../../results/iperf/", "IPERF_vm_2")
+
+Stor.append(Paragraph("Storage Results", Style['h2']))
+dump_result(Stor, "../../results/fio/", "fio_bm")
+dump_result(Stor, "../../results/fio/", "fio_vm")
+
+
+doc.build(Stor)
diff --git a/utils/report/__init__.py b/utils/report/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/utils/report/__init__.py
diff --git a/utils/report/get_indices.py b/utils/report/get_indices.py
new file mode 100644
index 00000000..91219c0b
--- /dev/null
+++ b/utils/report/get_indices.py
@@ -0,0 +1,8 @@
+import json
+
+
+def get_index(suite):
+ with open('../../results/' + suite + '.json') as result_file:
+ result_djson = json.load(result_file)
+ index = result_djson['index']
+ return index
diff --git a/utils/report/get_results.py b/utils/report/get_results.py
new file mode 100644
index 00000000..23fd5383
--- /dev/null
+++ b/utils/report/get_results.py
@@ -0,0 +1,50 @@
+import os
+import json
+
+
+def report_concat(targ_dir, testcase):
+ machine_temp = []
+ machines = []
+
+ for file in os.listdir(targ_dir):
+ if file.endswith(".json"):
+ machine_temp.append(file)
+
+ l = len(machine_temp)
+
+ for x in range(0, l):
+ file_t = machine_temp[x]
+ with open(targ_dir + file_t) as result_file:
+ result_djson = json.load(result_file)
+ if result_djson['1 Testcase Name'] == str(testcase):
+ machines.append(result_djson)
+ return machines
+
+
+def space_count(l):
+ spc = ''
+ for x in range(l):
+ spc = spc + ' '
+ return spc
+
+
+def custom_dict(list1, list2, k):
+ string_1 = ''
+ for num_1 in range(0, len(list1)):
+ string_1 = string_1 + space_count(k) + str(list1[num_1][0]) + "=" + str(list2[num_1]) + "\n"
+ return string_1
+
+
+def generate_result(dict_a, k):
+ list_1 = []
+ list_2 = []
+ count = 0
+ for i, j in sorted(dict_a.iteritems()):
+ list_1.append([])
+ list_1[count].append(i)
+ if (str(type(dict_a.get(i)))) == "<type 'dict'>":
+ list_2.append(str("\n" + generate_result(dict_a.get(i), int(k + 1))))
+ else:
+ list_2.append(dict_a.get(i))
+ count = count + 1
+ return custom_dict(list_1, list_2, k)
diff --git a/utils/report/qtip_graph.py b/utils/report/qtip_graph.py
new file mode 100644
index 00000000..acbda40c
--- /dev/null
+++ b/utils/report/qtip_graph.py
@@ -0,0 +1,30 @@
+import matplotlib
+import matplotlib.pyplot as plt
+import numpy as np
+
+matplotlib.use('Agg')
+
+
+def plot_indices(a, b, c):
+ N = 3
+ ind = np.arange(N)
+ y_axis = (a, b, c)
+ width = 0.35
+ f = plt.figure()
+ ax = f.gca()
+ ax.set_autoscale_on(True)
+ my_bars = ax.bar(ind, y_axis, width, color='b')
+ ax.set_ylabel('Index Score*')
+ ax.set_xlabel('Suite')
+ ax.set_title(' QTIP benchmark scores')
+ ax.axis('on')
+ my_bars = ax.bar(ind, y_axis, width)
+ ax.set_xticks(ind + width / 2)
+ ax.set_xticklabels(['Compute', 'Storage', 'Network'])
+ ax.axis([0, 3, 0, 1.25])
+ f.text(0.7, 0.01, '* With Comparison to Refernece POD', fontsize=9)
+
+ for rect in my_bars:
+ height = rect.get_height()
+ ax.text(rect.get_x() + rect.get_width() / 2., 1.05 * height, height, ha='center', va='bottom')
+ f.savefig('qtip_graph.jpeg')