diff --git a/visualizer/excel_data_frame.dscp b/visualizer/excel_data_frame.dscp new file mode 100644 index 0000000..8e4b855 --- /dev/null +++ b/visualizer/excel_data_frame.dscp @@ -0,0 +1,718 @@ +import os +import json + +class ExcelDataFrame: + def __init__(self, cases, storeType): + self.cases = cases + self.storeType = storeType + self.dataObj = {} + + def GetDataObj(self, case): + dataPath = os.path.join(case,"result.json") + if os.path.exists(dataPath): + with open(dataPath) as dataFile: + return json.load(dataFile) + + def GetETables(self): + if self.storeType == "fileStore": + eTables = [[["runcase","title"]],[["","subtitle_b"]],[["Throughput","subtitle_b"]],[["FIO_IOPS","sstitle"]],[["FIO_BW","sstitle"]],[["FIO_Latency","sstitle"]],[["Throughput_avg","subtitle_b"]],[["FIO_IOPS","sstitle"]],[["FIO_BW","sstitle"]],[["FIO_Latency","sstitle"]], + [["CPU","subtitle_b"]],[["sar all user%","sstitle"]],[["sar all kernel%","sstitle"]],[["sar all iowait%","sstitle"]],[["sar all soft%","sstitle"]],[["sar all idle%","sstitle"]], + [["AVG_IOPS_Journal","subtitle_b"]],[["r/s","sstitle"]],[["w/s","sstitle"]],[["rMB/s","sstitle"]],[["wMB/s","sstitle"]],[["avgrq-sz","sstitle"]],[["avgqu-sz","sstitle"]],[["await","sstitle"]],[["svtcm","sstitle"]],[["%util","sstitle"]], + [["AVG_IOPS_OSD","subtitle_b"]],[["r/s","sstitle"]],[["w/s","sstitle"]],[["rMB/s","sstitle"]],[["wMB/s","sstitle"]],[["avgrq-sz","sstitle"]],[["avgqu-sz","sstitle"]],[["await","sstitle"]],[["svtcm","sstitle"]],[["%util","sstitle"]], + [["Memory","subtitle_b"]],[["kbmemfree","sstitle"]],[["kbmemused","sstitle"]],[["%memused","sstitle"]], + [["NIC","subtitle_b"]],[["rxpck/s","sstitle"]],[["txpck/s","sstitle"]],[["rxkB/s","sstitle"]],[["txkB/s","sstitle"]]] + for case in self.cases: + self.dataObj = self.GetDataObj(case) + eTables[0].append(case) + eTables[1].extend(["ceph", "vclient", "client"]) + eTables[2].extend([["from iostat","rtitle"], ["from FIO","rtitle"], ["from iostat","rtitle_b"]]) + eTables[3].extend([self.cal_Throughput_FIO_IOPS_ceph(case), self.cal_Throughput_FIO_IOPS_vclient(case), ""]) + eTables[4].extend([self.cal_Throughput_FIO_BW_ceph(case), self.cal_Throughput_FIO_BW_vclient(case), ""]) + eTables[5].extend([self.cal_Throughput_FIO_Latency_ceph(case), self.cal_Throughput_FIO_Latency_vclient(case), ""]) + eTables[6].extend([["","subtitle"], ["","subtitle"], ["","subtitle_b"]]) + eTables[7].extend([self.cal_ThroughputAvg_FIO_IOPS_ceph(case), self.cal_ThroughputAvg_FIO_IOPS_vclient(case), ""]) + eTables[8].extend([self.cal_ThroughputAvg_FIO_BW_ceph(case), self.cal_ThroughputAvg_FIO_BW_vclient(case), ""]) + eTables[9].extend([self.cal_ThroughputAvg_FIO_Latency_ceph(case), self.cal_ThroughputAvg_FIO_Latency_vclient(case), ""]) + eTables[10].extend([["","subtitle"], ["","subtitle"], ["","subtitle_b"]]) + eTables[11].extend([self.cal_CPU_user_ceph(case), self.cal_CPU_user_vclient(case), self.cal_CPU_user_client(case)]) + eTables[12].extend([self.cal_CPU_kernel_ceph(case), self.cal_CPU_kernel_vclient(case), self.cal_CPU_kernel_client(case)]) + eTables[13].extend([self.cal_CPU_iowait_ceph(case), self.cal_CPU_iowait_vclient(case), self.cal_CPU_iowait_client(case)]) + eTables[14].extend([self.cal_CPU_soft_ceph(case), self.cal_CPU_soft_vclient(case), self.cal_CPU_soft_client(case)]) + eTables[15].extend([self.cal_CPU_idle_ceph(case), self.cal_CPU_idle_vclient(case), self.cal_CPU_idle_client(case)]) + eTables[16].extend([["SSD","rtitle"], ["vclient_total","rtitle"], ["client_total","rtitle_b"]]) + eTables[17].extend([self.cal_AVG_IOPS_Journal_r_ceph(case), self.cal_AVG_IOPS_Journal_r_vclient(case), self.cal_AVG_IOPS_Journal_r_client(case)]) + eTables[18].extend([self.cal_AVG_IOPS_Journal_w_ceph(case), self.cal_AVG_IOPS_Journal_w_vclient(case), self.cal_AVG_IOPS_Journal_w_client(case)]) + eTables[19].extend([self.cal_AVG_IOPS_Journal_rMB_ceph(case), self.cal_AVG_IOPS_Journal_rMB_vclient(case), self.cal_AVG_IOPS_Journal_rMB_client(case)]) + eTables[20].extend([self.cal_AVG_IOPS_Journal_wMB_ceph(case), self.cal_AVG_IOPS_Journal_wMB_vclient(case), self.cal_AVG_IOPS_Journal_wMB_client(case)]) + eTables[21].extend([self.cal_AVG_IOPS_Journal_avgrqsz_ceph(case), self.cal_AVG_IOPS_Journal_avgrqsz_vclient(case), self.cal_AVG_IOPS_Journal_avgrqsz_client(case)]) + eTables[22].extend([self.cal_AVG_IOPS_Journal_avgqusz_ceph(case), self.cal_AVG_IOPS_Journal_avgqusz_vclient(case), self.cal_AVG_IOPS_Journal_avgqusz_client(case)]) + eTables[23].extend([self.cal_AVG_IOPS_Journal_await_ceph(case), self.cal_AVG_IOPS_Journal_await_vclient(case), self.cal_AVG_IOPS_Journal_await_client(case)]) + eTables[24].extend([self.cal_AVG_IOPS_Journal_svtcm_ceph(case), self.cal_AVG_IOPS_Journal_svtcm_vclient(case), self.cal_AVG_IOPS_Journal_svtcm_client(case)]) + eTables[25].extend([self.cal_AVG_IOPS_Journal_util_ceph(case), self.cal_AVG_IOPS_Journal_util_vclient(case), self.cal_AVG_IOPS_Journal_util_client(case)]) + eTables[26].extend([["Data","rtitle"], ["vclient_average","rtitle"], ["client_average","rtitle_b"]]) + eTables[27].extend([self.cal_AVG_IOPS_OSD_r_ceph(case), self.cal_AVG_IOPS_OSD_r_vclient(case), self.cal_AVG_IOPS_OSD_r_client(case)]) + eTables[28].extend([self.cal_AVG_IOPS_OSD_w_ceph(case), self.cal_AVG_IOPS_OSD_w_vclient(case), self.cal_AVG_IOPS_OSD_w_client(case)]) + eTables[29].extend([self.cal_AVG_IOPS_OSD_rMB_ceph(case), self.cal_AVG_IOPS_OSD_rMB_vclient(case), self.cal_AVG_IOPS_OSD_rMB_client(case)]) + eTables[30].extend([self.cal_AVG_IOPS_OSD_wMB_ceph(case), self.cal_AVG_IOPS_OSD_wMB_vclient(case), self.cal_AVG_IOPS_OSD_wMB_client(case)]) + eTables[31].extend([self.cal_AVG_IOPS_OSD_avgrqsz_ceph(case), self.cal_AVG_IOPS_OSD_avgrqsz_vclient(case), self.cal_AVG_IOPS_OSD_avgrqsz_client(case)]) + eTables[32].extend([self.cal_AVG_IOPS_OSD_avgqusz_ceph(case), self.cal_AVG_IOPS_OSD_avgqusz_vclient(case), self.cal_AVG_IOPS_OSD_avgqusz_client(case)]) + eTables[33].extend([self.cal_AVG_IOPS_OSD_await_ceph(case), self.cal_AVG_IOPS_OSD_await_vclient(case), self.cal_AVG_IOPS_OSD_await_client(case)]) + eTables[34].extend([self.cal_AVG_IOPS_OSD_svtcm_ceph(case), self.cal_AVG_IOPS_OSD_svtcm_vclient(case), self.cal_AVG_IOPS_OSD_svtcm_client(case)]) + eTables[35].extend([self.cal_AVG_IOPS_OSD_util_ceph(case), self.cal_AVG_IOPS_OSD_util_vclient(case), self.cal_AVG_IOPS_OSD_util_client(case)]) + eTables[36].extend([["","subtitle"], ["","subtitle"], ["","subtitle_b"]]) + eTables[37].extend([self.cal_Memory_kbmemfree_ceph(case), self.cal_Memory_kbmemfree_vclient(case), self.cal_Memory_kbmemfree_client(case)]) + eTables[38].extend([self.cal_Memory_kbmemused_ceph(case), self.cal_Memory_kbmemused_vclient(case), self.cal_Memory_kbmemused_client(case)]) + eTables[39].extend([self.cal_Memory_memused_ceph(case), self.cal_Memory_memused_vclient(case), self.cal_Memory_memused_client(case)]) + eTables[40].extend([["","subtitle"], ["","subtitle"], ["","subtitle_b"]]) + eTables[41].extend([self.cal_NIC_rxpck_ceph(case), self.cal_NIC_rxpck_vclient(case), self.cal_NIC_rxpck_client(case)]) + eTables[42].extend([self.cal_NIC_txpck_ceph(case), self.cal_NIC_txpck_vclient(case), self.cal_NIC_txpck_client(case)]) + eTables[43].extend([self.cal_NIC_rxkB_ceph(case), self.cal_NIC_rxkB_vclient(case), self.cal_NIC_rxkB_client(case)]) + eTables[44].extend([self.cal_NIC_txkB_ceph(case), self.cal_NIC_txkB_vclient(case), self.cal_NIC_txkB_client(case)]) + + elif self.storeType == "blueStore": + eTables = [[["runcase","title"]],[["","subtitle"]],[["Throughput","subtitle_b"]],[["FIO_IOPS","sstitle"]],[["FIO_BW","sstitle"]],[["FIO_Latency","sstitle"]],[["Throughput_avg_b","subtitle"]],[["FIO_IOPS","sstitle"]],[["FIO_BW","sstitle"]],[["FIO_Latency","sstitle"]], + [["CPU","subtitle_b"]],[["sar all user%","sstitle"]],[["sar all kernel%","sstitle"]],[["sar all iowait%","sstitle"]],[["sar all soft%","sstitle"]],[["sar all idle%","sstitle"]], + [["AVG_IOPS_Journal","subtitle_b"]],[["r/s","sstitle"]],[["w/s","sstitle"]],[["rMB/s","sstitle"]],[["wMB/s","sstitle"]],[["avgrq-sz","sstitle"]],[["avgqu-sz","sstitle"]],[["await","sstitle"]],[["svtcm","sstitle"]],[["%util","sstitle"]], + [["AVG_IOPS_OSD","subtitle_b"]],[["r/s","sstitle"]],[["w/s","sstitle"]],[["rMB/s","sstitle"]],[["wMB/s","sstitle"]],[["avgrq-sz","sstitle"]],[["avgqu-sz","sstitle"]],[["await","sstitle"]],[["svtcm","sstitle"]],[["%util","sstitle"]], + [["Memory","subtitle_b"]],[["kbmemfree","sstitle"]],[["kbmemused","sstitle"]],[["%memused","sstitle"]], + [["NIC","subtitle_b"]],[["rxpck/s","sstitle"]],[["txpck/s","sstitle"]],[["rxkB/s","sstitle"]],[["txkB/s","sstitle"]]] + for case in self.cases: + self.dataObj = self.GetDataObj(case) + eTables[0].append(case) + eTables[1].extend(["ceph", "vclient", "client"]) + eTables[2].extend([["from iostat","rtitle"], ["from FIO","rtitle"], ["from iostat","rtitle_b"]]) + eTables[3].extend([self.cal_Throughput_FIO_IOPS_ceph(case), self.cal_Throughput_FIO_IOPS_vclient(case), ""]) + eTables[4].extend([self.cal_Throughput_FIO_BW_ceph(case), self.cal_Throughput_FIO_BW_vclient(case), ""]) + eTables[5].extend([self.cal_Throughput_FIO_Latency_ceph(case), self.cal_Throughput_FIO_Latency_vclient(case), ""]) + eTables[6].extend([["","subtitle"], ["","subtitle"], ["","subtitle_b"]]) + eTables[7].extend([self.cal_ThroughputAvg_FIO_IOPS_ceph(case), self.cal_Throughput_FIO_IOPS_vclient(case), ""]) + eTables[8].extend([self.cal_ThroughputAvg_FIO_BW_ceph(case), self.cal_Throughput_FIO_BW_vclient(case), ""]) + eTables[9].extend([self.cal_ThroughputAvg_FIO_Latency_ceph(case), self.cal_Throughput_FIO_Latency_vclient(case), ""]) + eTables[10].extend([["","subtitle"], ["","subtitle"], ["","subtitle_b"]]) + eTables[11].extend([self.cal_CPU_user_ceph(case), self.cal_CPU_user_vclient(case), self.cal_CPU_user_client(case)]) + eTables[12].extend([self.cal_CPU_kernel_ceph(case), self.cal_CPU_kernel_vclient(case), self.cal_CPU_kernel_client(case)]) + eTables[13].extend([self.cal_CPU_iowait_ceph(case), self.cal_CPU_iowait_vclient(case), self.cal_CPU_iowait_client(case)]) + eTables[14].extend([self.cal_CPU_soft_ceph(case), self.cal_CPU_soft_vclient(case), self.cal_CPU_soft_client(case)]) + eTables[15].extend([self.cal_CPU_idle_ceph(case), self.cal_CPU_idle_vclient(case), self.cal_CPU_idle_client(case)]) + eTables[16].extend([["SSD","rtitle"], ["vclient_total","rtitle"], ["client_total","rtitle_b"]]) + eTables[17].extend([self.cal_AVG_IOPS_Journal_r_ceph(case), self.cal_AVG_IOPS_Journal_r_vclient(case), self.cal_AVG_IOPS_Journal_r_client(case)]) + eTables[18].extend([self.cal_AVG_IOPS_Journal_w_ceph(case), self.cal_AVG_IOPS_Journal_w_vclient(case), self.cal_AVG_IOPS_Journal_w_client(case)]) + eTables[19].extend([self.cal_AVG_IOPS_Journal_rMB_ceph(case), self.cal_AVG_IOPS_Journal_rMB_vclient(case), self.cal_AVG_IOPS_Journal_rMB_client(case)]) + eTables[20].extend([self.cal_AVG_IOPS_Journal_wMB_ceph(case), self.cal_AVG_IOPS_Journal_wMB_vclient(case), self.cal_AVG_IOPS_Journal_wMB_client(case)]) + eTables[21].extend([self.cal_AVG_IOPS_Journal_avgrqsz_ceph(case), self.cal_AVG_IOPS_Journal_avgrqsz_vclient(case), self.cal_AVG_IOPS_Journal_avgrqsz_client(case)]) + eTables[22].extend([self.cal_AVG_IOPS_Journal_avgqusz_ceph(case), self.cal_AVG_IOPS_Journal_avgqusz_vclient(case), self.cal_AVG_IOPS_Journal_avgqusz_client(case)]) + eTables[23].extend([self.cal_AVG_IOPS_Journal_await_ceph(case), self.cal_AVG_IOPS_Journal_await_vclient(case), self.cal_AVG_IOPS_Journal_await_client(case)]) + eTables[24].extend([self.cal_AVG_IOPS_Journal_svtcm_ceph(case), self.cal_AVG_IOPS_Journal_svtcm_vclient(case), self.cal_AVG_IOPS_Journal_svtcm_client(case)]) + eTables[25].extend([self.cal_AVG_IOPS_Journal_util_ceph(case), self.cal_AVG_IOPS_Journal_util_vclient(case), self.cal_AVG_IOPS_Journal_util_client(case)]) + eTables[26].extend([["Data","rtitle"], ["vclient_average","rtitle"], ["client_average","rtitle_b"]]) + eTables[27].extend([self.cal_AVG_IOPS_OSD_r_ceph(case), self.cal_AVG_IOPS_OSD_r_vclient(case), self.cal_AVG_IOPS_OSD_r_client(case)]) + eTables[28].extend([self.cal_AVG_IOPS_OSD_w_ceph(case), self.cal_AVG_IOPS_OSD_w_vclient(case), self.cal_AVG_IOPS_OSD_w_client(case)]) + eTables[29].extend([self.cal_AVG_IOPS_OSD_rMB_ceph(case), self.cal_AVG_IOPS_OSD_rMB_vclient(case), self.cal_AVG_IOPS_OSD_rMB_client(case)]) + eTables[30].extend([self.cal_AVG_IOPS_OSD_wMB_ceph(case), self.cal_AVG_IOPS_OSD_wMB_vclient(case), self.cal_AVG_IOPS_OSD_wMB_client(case)]) + eTables[31].extend([self.cal_AVG_IOPS_OSD_avgrqsz_ceph(case), self.cal_AVG_IOPS_OSD_avgrqsz_vclient(case), self.cal_AVG_IOPS_OSD_avgrqsz_client(case)]) + eTables[32].extend([self.cal_AVG_IOPS_OSD_avgqusz_ceph(case), self.cal_AVG_IOPS_OSD_avgqusz_vclient(case), self.cal_AVG_IOPS_OSD_avgqusz_client(case)]) + eTables[33].extend([self.cal_AVG_IOPS_OSD_await_ceph(case), self.cal_AVG_IOPS_OSD_await_vclient(case), self.cal_AVG_IOPS_OSD_await_client(case)]) + eTables[34].extend([self.cal_AVG_IOPS_OSD_svtcm_ceph(case), self.cal_AVG_IOPS_OSD_svtcm_vclient(case), self.cal_AVG_IOPS_OSD_svtcm_client(case)]) + eTables[35].extend([self.cal_AVG_IOPS_OSD_util_ceph(case), self.cal_AVG_IOPS_OSD_util_vclient(case), self.cal_AVG_IOPS_OSD_util_client(case)]) + eTables[36].extend([["","subtitle"], ["","subtitle"], ["","subtitle_b"]]) + eTables[37].extend([self.cal_Memory_kbmemfree_ceph(case), self.cal_Memory_kbmemfree_vclient(case), self.cal_Memory_kbmemfree_client(case)]) + eTables[38].extend([self.cal_Memory_kbmemused_ceph(case), self.cal_Memory_kbmemused_vclient(case), self.cal_Memory_kbmemused_client(case)]) + eTables[39].extend([self.cal_Memory_memused_ceph(case), self.cal_Memory_memused_vclient(case), self.cal_Memory_memused_client(case)]) + eTables[40].extend([["","subtitle"], ["","subtitle"], ["","subtitle_b"]]) + eTables[41].extend([self.cal_NIC_rxpck_ceph(case), self.cal_NIC_rxpck_vclient(case), self.cal_NIC_rxpck_client(case)]) + eTables[42].extend([self.cal_NIC_txpck_ceph(case), self.cal_NIC_txpck_vclient(case), self.cal_NIC_txpck_client(case)]) + eTables[43].extend([self.cal_NIC_rxkB_ceph(case), self.cal_NIC_rxkB_vclient(case), self.cal_NIC_rxkB_client(case)]) + eTables[44].extend([self.cal_NIC_txkB_ceph(case), self.cal_NIC_txkB_vclient(case), self.cal_NIC_txkB_client(case)]) + return eTables + + def GetExtTables(self): + result = [] + for case in self.cases: + if self.storeType == "fileStore": + extTable = [[[case.split("-")[3], 16, 'title']], [["", 1, 'title'], ["CPU", 3, 'title'], ["Disk", 9, 'title'], ["Memory", 1, 'title'], ["NIC", 2, 'title']]] + extTable.append(["", "user%", "kernel%+soft%", "iowait%", "r/s", "w/s", "rMB/s", "wMB/s", "requsz", "queue-sz", "await", "svctm", "%util", "used%", "rxkB/s", "txkB/s"]) + extTable.append(["Ceph", self.cal_CPU_user_ceph(case), self.cal_CPU_kenelsoft_ceph(case), self.cal_CPU_iowait_ceph(case), self.cal_AVG_IOPS_OSD_r_ceph(case), self.cal_AVG_IOPS_OSD_w_ceph(case), self.cal_AVG_IOPS_OSD_rMB_ceph(case), self.cal_AVG_IOPS_OSD_wMB_ceph(case), self.cal_AVG_IOPS_OSD_avgrqsz_ceph(case), self.cal_AVG_IOPS_OSD_avgqusz_ceph(case), self.cal_AVG_IOPS_OSD_await_ceph(case), self.cal_AVG_IOPS_OSD_svtcm_ceph(case), self.cal_AVG_IOPS_OSD_util_ceph(case), self.cal_Memory_memused_ceph(case), self.cal_NIC_rxkB_ceph(case), self.cal_NIC_txkB_ceph(case)]) + extTable.append(["VM", self.cal_CPU_user_vclient(case), self.cal_CPU_kenelsoft_vclient(case), self.cal_CPU_iowait_vclient(case), self.cal_AVG_IOPS_OSD_r_vclient(case), self.cal_AVG_IOPS_OSD_w_vclient(case), self.cal_AVG_IOPS_OSD_rMB_vclient(case), self.cal_AVG_IOPS_OSD_wMB_vclient(case), self.cal_AVG_IOPS_OSD_avgrqsz_vclient(case), self.cal_AVG_IOPS_OSD_avgqusz_vclient(case), self.cal_AVG_IOPS_OSD_await_vclient(case), self.cal_AVG_IOPS_OSD_svtcm_vclient(case), self.cal_AVG_IOPS_OSD_util_vclient(case), self.cal_Memory_memused_vclient(case), self.cal_NIC_rxkB_vclient(case), self.cal_NIC_txkB_vclient(case)]) + extTable.append(["Client", self.cal_CPU_user_client(case), self.cal_CPU_kenelsoft_client(case), self.cal_CPU_iowait_client(case), self.cal_AVG_IOPS_OSD_r_client(case), self.cal_AVG_IOPS_OSD_w_client(case), self.cal_AVG_IOPS_OSD_rMB_client(case), self.cal_AVG_IOPS_OSD_wMB_client(case), self.cal_AVG_IOPS_OSD_avgrqsz_client(case), self.cal_AVG_IOPS_OSD_avgqusz_client(case), self.cal_AVG_IOPS_OSD_await_client(case), self.cal_AVG_IOPS_OSD_svtcm_client(case), self.cal_AVG_IOPS_OSD_util_client(case), self.cal_Memory_memused_client(case), self.cal_NIC_rxkB_client(case), self.cal_NIC_txkB_client(case)]) + result.append(extTable) + return result + + def cal_Throughput_FIO_IOPS_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["workload"]["fio"]["summary"]: + tmpList.extend([self.dataObj["workload"]["fio"]["summary"][key]["read_iops"] + self.dataObj["workload"]["fio"]["summary"][key]["write_iops"]]) + return sum(tmpList) + def cal_Throughput_FIO_IOPS_client(self, case): + pass + def cal_Throughput_FIO_IOPS_vclient(self, case): + pass + + def cal_Throughput_FIO_BW_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["workload"]["fio"]["summary"]: + tmpList.extend([self.dataObj["workload"]["fio"]["summary"][key]["read_bw"] + self.dataObj["workload"]["fio"]["summary"][key]["write_bw"]]) + return sum(tmpList) + def cal_Throughput_FIO_BW_client(self, case): + pass + def cal_Throughput_FIO_BW_vclient(self, case): + pass + + def cal_Throughput_FIO_Latency_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["workload"]["fio"]["summary"]: + tmpList.extend([self.dataObj["workload"]["fio"]["summary"][key]["read_lat"] + self.dataObj["workload"]["fio"]["summary"][key]["write_lat"]]) + return sum(tmpList)/len(tmpList) + def cal_Throughput_FIO_Latency_client(self, case): + pass + def cal_Throughput_FIO_Latency_vclient(self, case): + pass + + def cal_ThroughputAvg_FIO_IOPS_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["workload"]["fio"]["summary"]: + tmpList.extend([self.dataObj["workload"]["fio"]["summary"][key]["read_iops"] + self.dataObj["workload"]["fio"]["summary"][key]["write_iops"]]) + return sum(tmpList)/len(tmpList) + def cal_ThroughputAvg_FIO_IOPS_client(self, case): + pass + def cal_ThroughputAvg_FIO_IOPS_vclient(self, case): + pass + + def cal_ThroughputAvg_FIO_BW_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["workload"]["fio"]["summary"]: + tmpList.extend([self.dataObj["workload"]["fio"]["summary"][key]["read_bw"] + self.dataObj["workload"]["fio"]["summary"][key]["write_bw"]]) + return sum(tmpList)/len(tmpList) + def cal_ThroughputAvg_FIO_BW_client(self, case): + pass + def cal_ThroughputAvg_FIO_BW_vclient(self, case): + pass + + def cal_ThroughputAvg_FIO_Latency_ceph(self, case): + pass + def cal_ThroughputAvg_FIO_Latency_client(self, case): + pass + def cal_ThroughputAvg_FIO_Latency_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["workload"]["fio"]["summary"]: + tmpList.extend([self.dataObj["workload"]["fio"]["summary"][key]["read_lat"] + self.dataObj["workload"]["fio"]["summary"][key]["write_lat"]]) + return sum(tmpList)/len(tmpList) + + def cal_CPU_user_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["cpu"]["summary"][key]["%usr"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_user_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%usr"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_user_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%usr"]) + return sum(tmpList)/len(tmpList) + + def cal_CPU_kernel_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["cpu"]["summary"][key]["%sys"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_kernel_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%sys"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_kernel_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%sys"]) + return sum(tmpList)/len(tmpList) + + def cal_CPU_iowait_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["cpu"]["summary"][key]["%iowait"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_iowait_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%iowait"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_iowait_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%iowait"]) + return sum(tmpList)/len(tmpList) + + def cal_CPU_soft_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["cpu"]["summary"][key]["%soft"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_soft_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%soft"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_soft_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%soft"]) + return sum(tmpList)/len(tmpList) + + def cal_CPU_idle_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["cpu"]["summary"][key]["%idle"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_idle_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%idle"]) + return sum(tmpList)/len(tmpList) + def cal_CPU_idle_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["cpu"]["summary"]: + tmpList.extend(self.dataObj["client"]["cpu"]["summary"][key]["%idle"]) + return sum(tmpList)/len(tmpList) + + def cal_CPU_kenelsoft_ceph(self, case): + return self.cal_CPU_kernel_ceph(case) + self.cal_CPU_soft_ceph(case) + def cal_CPU_kenelsoft_vclient(self, case): + return self.cal_CPU_kernel_vclient(case) + self.cal_CPU_soft_vclient(case) + def cal_CPU_kenelsoft_client(self, case): + return self.cal_CPU_kernel_client(case) + self.cal_CPU_soft_client(case) + + def cal_AVG_IOPS_Journal_r_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_r_client(self, case): + pass + def cal_AVG_IOPS_Journal_r_vclient(self, case): + pass + + def cal_AVG_IOPS_Journal_w_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_w_client(self, case): + pass + def cal_AVG_IOPS_Journal_w_vclient(self, case): + pass + + def cal_AVG_IOPS_Journal_rMB_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_rMB_client(self, case): + pass + def cal_AVG_IOPS_Journal_rMB_vclient(self, case): + pass + + def cal_AVG_IOPS_Journal_wMB_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_wMB_client(self, case): + pass + def cal_AVG_IOPS_Journal_wMB_vclient(self, case): + pass + + def cal_AVG_IOPS_Journal_avgrqsz_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_avgrqsz_client(self, case): + pass + def cal_AVG_IOPS_Journal_avgrqsz_vclient(self, case): + pass + + def cal_AVG_IOPS_Journal_avgqusz_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_avgqusz_client(self, case): + pass + def cal_AVG_IOPS_Journal_avgqusz_vclient(self, case): + pass + + def cal_AVG_IOPS_Journal_await_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_await_client(self, case): + pass + def cal_AVG_IOPS_Journal_await_vclient(self, case): + pass + + def cal_AVG_IOPS_Journal_svtcm_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_svtcm_client(self, case): + pass + def cal_AVG_IOPS_Journal_svtcm_vclient(self, case): + pass + + def cal_AVG_IOPS_Journal_util_ceph(self, case): + pass + def cal_AVG_IOPS_Journal_util_client(self, case): + pass + def cal_AVG_IOPS_Journal_util_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_r_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["r/s"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_r_client(self, case): + pass + def cal_AVG_IOPS_OSD_r_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_w_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["w/s"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_w_client(self, case): + pass + def cal_AVG_IOPS_OSD_w_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_rMB_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["rMB/s"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_rMB_client(self, case): + pass + def cal_AVG_IOPS_OSD_rMB_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_wMB_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["wMB/s"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_wMB_client(self, case): + pass + def cal_AVG_IOPS_OSD_wMB_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_avgrqsz_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["avgrq-sz"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_avgrqsz_client(self, case): + pass + def cal_AVG_IOPS_OSD_avgrqsz_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_avgqusz_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["avgqu-sz"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_avgqusz_client(self, case): + pass + def cal_AVG_IOPS_OSD_avgqusz_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_await_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["await"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_await_client(self, case): + pass + def cal_AVG_IOPS_OSD_await_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_svtcm_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["svctm"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_svtcm_client(self, case): + pass + def cal_AVG_IOPS_OSD_svtcm_vclient(self, case): + pass + + def cal_AVG_IOPS_OSD_util_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["osd"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["osd"]["summary"][key]["%util"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_OSD_util_client(self, case): + pass + def cal_AVG_IOPS_OSD_util_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_r_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["r/s"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["r/s"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_r_client(self, case): + pass + def cal_AVG_IOPS_WAL_r_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_w_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["w/s"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["w/s"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_w_client(self, case): + pass + def cal_AVG_IOPS_WAL_w_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_rMB_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["rMB/s"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["rMB/s"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_rMB_client(self, case): + pass + def cal_AVG_IOPS_WAL_rMB_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_wMB_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["wMB/s"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["wMB/s"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_wMB_client(self, case): + pass + def cal_AVG_IOPS_WAL_wMB_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_avgrqsz_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["avgrq-sz"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["avgrq-sz"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_avgrqsz_client(self, case): + pass + def cal_AVG_IOPS_WAL_avgrqsz_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_avgqusz_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["avgqu-sz"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["avgqu-sz"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_avgqusz_client(self, case): + pass + def cal_AVG_IOPS_WAL_avgqusz_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_await_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["await"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["await"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_await_client(self, case): + pass + def cal_AVG_IOPS_WAL_await_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_svtcm_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["svctm"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["svctm"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_svtcm_client(self, case): + pass + def cal_AVG_IOPS_WAL_svtcm_vclient(self, case): + pass + + def cal_AVG_IOPS_WAL_util_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["wal"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["wal"]["summary"][key]["%util"]) + for key in self.dataObj["ceph"]["db"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["db"]["summary"][key]["%util"]) + return sum(tmpList)/len(tmpList) + def cal_AVG_IOPS_WAL_util_client(self, case): + pass + def cal_AVG_IOPS_WAL_util_vclient(self, case): + pass + + def cal_Memory_kbmemfree_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["memory"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["memory"]["summary"][key]["kbmenfree"]) + return sum(tmpList)/len(tmpList) + def cal_Memory_kbmemfree_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["memory"]["summary"]: + tmpList.extend(self.dataObj["client"]["memory"]["summary"][key]["kbmenfree"]) + return sum(tmpList)/len(tmpList) + def cal_Memory_kbmemfree_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["memory"]["summary"]: + tmpList.extend(self.dataObj["client"]["memory"]["summary"][key]["kbmenfree"]) + return sum(tmpList)/len(tmpList) + + def cal_Memory_kbmemused_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["memory"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["memory"]["summary"][key]["kbmemused"]) + return sum(tmpList)/len(tmpList) + def cal_Memory_kbmemused_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["memory"]["summary"]: + tmpList.extend(self.dataObj["client"]["memory"]["summary"][key]["kbmemused"]) + return sum(tmpList)/len(tmpList) + def cal_Memory_kbmemused_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["memory"]["summary"]: + tmpList.extend(self.dataObj["client"]["memory"]["summary"][key]["kbmemused"]) + return sum(tmpList)/len(tmpList) + + def cal_Memory_memused_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["memory"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["memory"]["summary"][key]["%memused"]) + return sum(tmpList)/len(tmpList) + def cal_Memory_memused_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["memory"]["summary"]: + tmpList.extend(self.dataObj["client"]["memory"]["summary"][key]["%memused"]) + return sum(tmpList)/len(tmpList) + def cal_Memory_memused_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["memory"]["summary"]: + tmpList.extend(self.dataObj["client"]["memory"]["summary"][key]["%memused"]) + return sum(tmpList)/len(tmpList) + + def cal_NIC_rxpck_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["nic"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["nic"]["summary"][key]["rxpck/s"]) + return sum(tmpList)/len(tmpList) + def cal_NIC_rxpck_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["nic"]["summary"]: + tmpList.extend(self.dataObj["client"]["nic"]["summary"][key]["rxpck/s"]) + return sum(tmpList)/len(tmpList) + def cal_NIC_rxpck_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["nic"]["summary"]: + tmpList.extend(self.dataObj["client"]["nic"]["summary"][key]["rxpck/s"]) + return sum(tmpList)/len(tmpList) + + def cal_NIC_txpck_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["nic"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["nic"]["summary"][key]["txpck/s"]) + return sum(tmpList)/len(tmpList) + def cal_NIC_txpck_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["nic"]["summary"]: + tmpList.extend(self.dataObj["client"]["nic"]["summary"][key]["txpck/s"]) + return sum(tmpList)/len(tmpList) + def cal_NIC_txpck_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["nic"]["summary"]: + tmpList.extend(self.dataObj["client"]["nic"]["summary"][key]["txpck/s"]) + return sum(tmpList)/len(tmpList) + + def cal_NIC_rxkB_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["nic"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["nic"]["summary"][key]["rxkB/s"]) + return sum(tmpList)/len(tmpList) + def cal_NIC_rxkB_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["nic"]["summary"]: + tmpList.extend(self.dataObj["client"]["nic"]["summary"][key]["rxkB/s"]) + return sum(tmpList)/len(tmpList) + def cal_NIC_rxkB_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["nic"]["summary"]: + tmpList.extend(self.dataObj["client"]["nic"]["summary"][key]["rxkB/s"]) + return sum(tmpList)/len(tmpList) + + def cal_NIC_txkB_ceph(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["ceph"]["nic"]["summary"]: + tmpList.extend(self.dataObj["ceph"]["nic"]["summary"][key]["txkB/s"]) + return sum(tmpList)/len(tmpList) + def cal_NIC_txkB_client(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["nic"]["summary"]: + tmpList.extend(self.dataObj["client"]["nic"]["summary"][key]["txkB/s"]) + return sum(tmpList)/len(tmpList) + def cal_NIC_txkB_vclient(self, case): + tmpList = [] + if self.dataObj: + for key in self.dataObj["client"]["nic"]["summary"]: + tmpList.extend(self.dataObj["client"]["nic"]["summary"][key]["txkB/s"]) + return sum(tmpList)/len(tmpList) diff --git a/visualizer/excel_summary_generator.py b/visualizer/excel_summary_generator.py new file mode 100644 index 0000000..71deedf --- /dev/null +++ b/visualizer/excel_summary_generator.py @@ -0,0 +1,145 @@ +import xlsxwriter + +def GenExcelFile(eTables, extTables, caseNum): + dataFile = xlsxwriter.Workbook('summray.xls') + dataSheet = dataFile.add_worksheet(u'summary') + for i,eRow in enumerate(eTables): + for j,eCol in enumerate(eRow): + if i == 0 and j > 0: + dataSheet.merge_range(i, 3*j-2, i, 3*j, eCol.split("/")[-1], set_style(dataFile, 'title')) + else: + if type(eCol) == list: + dataSheet.write(i, j, eCol[0], set_style(dataFile,eCol[1])) + else: + fmtStr = "content_b" if j % 3 == 0 else "content" + dataSheet.write(i, j, eCol, set_style(dataFile,fmtStr)) + + i += 2 + dataSheet.merge_range(i, 0, i, 5, "general info", set_style(dataFile, "title")) + i += 1 + dataSheet.merge_range(i, 0, i, 5, "runcase", set_style(dataFile, "title")) + i += 1 + ei = i + chartList = [] + for extTable in extTables: + chartList.append(i) + ej = 0 + for extRow in extTable: + ei = i + for extCol in extRow: + if type(extCol) == list: + if ej > 0 and extCol[0] != "" and type(extTable[0][0]) == list: #for chart's title + dataSheet.write(ei, 7, extTable[0][0][0] + " - " + extCol[0]) + if extCol[1] > 1: + dataSheet.merge_range(ei, ej, ei+extCol[1]-1, ej, extCol[0], set_style(dataFile, extCol[2])) + else: + dataSheet.write(ei, ej, extCol[0], set_style(dataFile, extCol[2])) + ei = ei+extCol[1] + else: + dataSheet.write(ei, ej, extCol, set_style(dataFile, 'content')) + ei += 1 + ej += 1 + i = ei + 1 + dataSheet.merge_range(ei, 0, ei, 5, "", set_style(dataFile, 'content')) + + + for ci in chartList: + charts = getChart(dataFile, ci) + for i,chart in enumerate(charts): + x_offset = i * 380 + 10 + dataSheet.insert_chart(ci + 1, 6, chart, {'x_offset': x_offset, 'y_offset': 0}) + + for k in range(3*caseNum + 1): + dataSheet.set_column(k, k, 18) + dataSheet.set_row(0, 25) + dataFile.close() + +def getChart(fileObj, ci): + chars = [] + tmpChart1 = fileObj.add_chart({'type': 'column', 'subtype': 'stacked'}) + tmpChart1.add_series({ + 'name': ['summary', ci+1, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 1, 3, ci + 1, 5], + }) + tmpChart1.add_series({ + 'name': ['summary', ci+2, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 2, 3, ci + 2, 5], + }) + tmpChart1.add_series({ + 'name': ['summary', ci+3, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 3, 3, ci + 3, 5], + }) + tmpChart1.set_title ({'name': ['summary', ci + 1, 7]}) + tmpChart1.set_style(12) + tmpChart1.set_size({'width': 380, 'height': 300}) + chars.append(tmpChart1) + + tmpChart2 = fileObj.add_chart({'type': 'column', 'subtype': 'stacked'}) + tmpChart2.add_series({ + 'name': ['summary', ci + 13, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 13, 3, ci + 13, 5], + }) + tmpChart2.set_title ({'name': ['summary', ci + 13, 7]}) + tmpChart2.set_style(12) + tmpChart2.set_size({'width': 380, 'height': 300}) + chars.append(tmpChart2) + + tmpChart3 = fileObj.add_chart({'type': 'column', 'subtype': 'stacked'}) + tmpChart3.add_series({ + 'name': ['summary', ci + 14, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 14, 3, ci + 14, 5], + }) + tmpChart3.add_series({ + 'name': ['summary', ci + 15, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 15, 3, ci + 15, 5], + }) + tmpChart3.set_title ({'name': ['summary', ci + 14, 7]}) + tmpChart3.set_style(12) + tmpChart3.set_size({'width': 380, 'height': 300}) + chars.append(tmpChart3) + + tmpChart4 = fileObj.add_chart({'type': 'column', 'subtype': 'stacked'}) + tmpChart4.add_series({ + 'name': ['summary', ci + 6, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 6, 3, ci + 6, 5], + }) + tmpChart4.add_series({ + 'name': ['summary', ci + 7, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 7, 3, ci + 7, 5], + }) + tmpChart5 = fileObj.add_chart({'type': 'line'}) + tmpChart5.add_series({ + 'name': ['summary', ci + 10, 2], + 'categories': ['summary', ci, 3, ci, 5], + 'values': ['summary', ci + 10, 3, ci + 10, 5], + 'marker': {'type': 'diamond'}, + 'line': {'width': 1.5}, + }) + tmpChart4.combine(tmpChart5) + tmpChart4.set_title ({'name': ['summary', ci + 4, 7]}) + tmpChart4.set_style(12) + tmpChart4.set_size({'width': 380, 'height': 300}) + chars.append(tmpChart4) + + return chars + +def set_style(fileObj, name): + styleObj = { + 'title': {'bold': True, 'bg_color': '#BFEFFF', 'bottom': 1, 'top': 1, 'left': 2, 'right': 2, 'valign': 'vcenter'}, + 'subtitle': {'bold': True, 'font_color': 'red', 'bg_color': '#BFEFFF', 'bottom': 1, 'top': 1, 'left': 1, 'right': 1}, + 'subtitle_b': {'bold': True, 'font_color': 'red', 'bg_color': '#BFEFFF', 'bottom': 1, 'top': 1, 'left': 1, 'right': 2}, + 'sstitle': {'bg_color': '#BFEFFF', 'bottom': 1, 'top': 1, 'left': 1, 'right': 2}, + 'rtitle': {'bold': True, 'font_color': 'red', 'bg_color': '#BFEFFF', 'bottom': 1, 'top': 1, 'left': 1, 'right': 1}, + 'rtitle_b': {'bold': True, 'font_color': 'red', 'bg_color': '#BFEFFF', 'bottom': 1, 'top': 1, 'left': 1, 'right': 2}, + 'content': {'bottom': 1, 'top': 1, 'left': 1, 'right': 1}, + 'content_b': {'bottom': 1, 'top': 1, 'left': 1, 'right': 2}, + } + return fileObj.add_format(styleObj[name]) if name in styleObj else fileObj.add_format({}) diff --git a/visualizer/visualizer.py b/visualizer/visualizer.py index ea1ffaa..30c2b11 100644 --- a/visualizer/visualizer.py +++ b/visualizer/visualizer.py @@ -485,6 +485,13 @@ def generate_csv_from_json(self, data, classname, node_type): output.append( ",".join(tmp) ) return "\n".join( output ) + def generate_summary_excel(self, cases, storeType): + import excel_data_frame + import excel_summary_generator as esg + + edf = excel_data_frame.ExcelDataFrame(cases, storeType) + esg.GenExcelFile(edf.GetETables(), edf.GetExtTables(), len(cases)) + def main(args): parser = argparse.ArgumentParser(description='Analyzer tool') parser.add_argument(