smem_memory_monitor.py 文件源码

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

项目:cfme-performance 作者: redhat-performance 项目源码 文件源码
def graph_all_miq_workers(graph_file_path, process_results, provider_names):
    starttime = time.time()
    file_name = graph_file_path.join('all-processes.png')

    fig, ax = plt.subplots()
    plt.title('Provider(s): {}\nAll Workers/Monitored Processes'.format(provider_names))
    plt.xlabel('Date / Time')
    plt.ylabel('Memory (MiB)')
    for process_name in process_results:
        if 'Worker' in process_name or 'Handler' in process_name or 'Catcher' in process_name:
            for process_pid in process_results[process_name]:
                dates = process_results[process_name][process_pid].keys()

                rss_samples = list(process_results[process_name][process_pid][ts]['rss']
                        for ts in process_results[process_name][process_pid].keys())
                vss_samples = list(process_results[process_name][process_pid][ts]['vss']
                        for ts in process_results[process_name][process_pid].keys())
                plt.plot(dates, rss_samples, linewidth=1, label='{} {} RSS'.format(process_pid,
                    process_name))
                plt.plot(dates, vss_samples, linewidth=1, label='{} {} VSS'.format(
                    process_pid, process_name))

    dateFmt = mdates.DateFormatter('%m-%d %H-%M')
    ax.xaxis.set_major_formatter(dateFmt)
    ax.grid(True)
    plt.legend(loc='upper center', bbox_to_anchor=(1.2, 0.1), fancybox=True)
    fig.autofmt_xdate()
    plt.savefig(str(file_name), bbox_inches='tight')
    plt.close()

    timediff = time.time() - starttime
    logger.info('Plotted All Type/Process Memory in: {}'.format(timediff))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号