graphperfmetrics.py 文件源码

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

项目:PyU4V 作者: ciarams87 项目源码 文件源码
def main():
    array_metrics=get_array_kpi()
    perfdatalist=array_metrics.get('perf_data')
    hostiolist = []
    dtstimelist = []
    readresponselist =[]
    print (perfdatalist)
    for perf_host in perfdatalist:
        hostiolist.append(perf_host.get('HostIOs'))
        readresponselist.append(perf_host.get('ReadResponseTime'))
        epochtime=(perf_host.get ('timestamp'))
        dtstime = round(epochtime/1000)
        dtstimelist.append(dtstime)

    dateconv=np.vectorize(dt.datetime.fromtimestamp)
    convtimelist =(dateconv(dtstimelist))
    # print(convtimelist)
    fig, ax = plt.subplots(1)
    fig.autofmt_xdate()
    xfmt = md.DateFormatter('%Y-%m-%d %H:%M:%S')
    ax.xaxis.set_major_formatter(xfmt)
    plt.plot_date(convtimelist,hostiolist,'-')
    plt.plot_date(convtimelist, readresponselist, '-')
    plt.legend(['HostIOs', 'ReadResponseTime'], loc='upper left')
    plt.subplots_adjust(bottom=0.1)
    plt.xticks(rotation=25)
    plt.ylabel('Host IOs')
    plt.xlabel('Time')
    plt.title('Host IOs and Read Response times over the last Hour')
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号