generatePlots.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:XtremPerfProbe 作者: nachiketkarmarkar 项目源码 文件源码
def drawEsxCharts(hostname,storageHba):
    pdfDoc = PdfPages('host_%s.pdf'%(hostname))
    data = np.genfromtxt('%s.csv' %(hostname), dtype=float, delimiter=',', names=True)
    # print data.dtype.names
    cpu = plot.figure(figsize=(20,15))
    cpu.suptitle("% CPU-Utilization", fontsize=20)
    cpuInit = len(cpu.axes)
    memory = plot.figure(figsize=(20,15))
    memory.suptitle("% Memory Usage", fontsize=20)
    memoryInit = len(memory.axes)
    for name in data.dtype.names:
        if re.match('CPU_Utilization', name):
            plotName = '% CPU Util'
            drawPlots(data,cpu,name,"% CPU Util",cpuInit+1)
        if re.match('Memory_Usage', name):
            plotName = '% Usage'
            drawPlots(data,memory,name,"% Memory Usage", memoryInit+1)
    for hba in storageHba:
        hba_iops = plot.figure(figsize=(20,15))
        hba_iops.suptitle("%s IOPs"%(hba), fontsize=20)
        hbaIopsInit = len(hba_iops.axes)
        hba_bw = plot.figure(figsize=(20,15))
        hba_bw.suptitle("%s Bandwidth"%(hba), fontsize=20)
        hbaBwInit = len(hba_bw.axes)
        hba_latency = plot.figure(figsize=(20,15))
        hba_latency.suptitle("%s Latency"%(hba), fontsize=20)
        hbaLatencyInit = len(hba_latency.axes)
        for name in data.dtype.names:
            if re.search('Storage_adapter%s'%(hba), name) and re.search('requests_per_second', name):
                plotName = '%s IOPs' %(hba)
                drawPlots(data,hba_iops,name,"IOPs",hbaIopsInit+1)
            if re.search('Storage_adapter%s'%(hba), name) and re.search(r'_rate_average', name):
                plotName = 'Bandwidth Utilization'
                drawPlots(data,hba_bw,name,"Bandwidth Utilization", hbaBwInit+1)
            if re.search('Storage_adapter%s'%(hba), name) and re.search(r'_latency_average', name):
                plotName = 'Latency'
                drawPlots(data,hba_latency,name,"Latency (msec)", hbaLatencyInit+1)
        pdfDoc.savefig(hba_latency)
        pdfDoc.savefig(hba_iops)
        pdfDoc.savefig(hba_bw)
    pdfDoc.savefig(cpu)
    pdfDoc.savefig(memory)
    pdfDoc.close()
    plot.close(hba_iops)
    plot.close(hba_bw)
    plot.close(hba_latency)
    plot.close(cpu)
    plot.close(memory)
    # plot.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号