1#!/usr/bin/python 2import subprocess 3import matplotlib.pyplot as plt 4import time 5import argparse 6 7parser = argparse.ArgumentParser(description="Graph memcpy perf") 8parser.add_argument("--files", nargs='+', type=str, help="files to graph", default=None) 9args = parser.parse_args() 10 11fig, ax = plt.subplots(nrows=1) 12ax.set_xscale('log') 13 14plt.xlabel("size in bytes") 15plt.ylabel("BW in GB/s") 16plt.title("size vs. bw") 17plt.tight_layout() 18 19for arg in args.files: 20 f = open(arg) 21 size = [] 22 perf = [] 23 for line in f: 24 # size: 11430912, perf: 6.76051GB/s, iter: 5 25 line_split = line.split(",") 26 size.append(float(line_split[0].split(":")[1])) 27 perf.append(float(line_split[1].split(":")[1].split("G")[0])) 28 29 line, = ax.plot(size, perf, '-', linewidth=0.2, label=arg) 30 31legend = plt.legend() 32plt.show() 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47