OSDN Git Service

merge in nyc-release history after reset to nyc-dev
[android-x86/system-extras.git] / memcpy-perf / graph_memcpy.py
1 #!/usr/bin/python
2 import subprocess
3 import matplotlib.pyplot as plt
4 import time
5 import argparse
6
7 parser = argparse.ArgumentParser(description="Graph memcpy perf")
8 parser.add_argument("--files", nargs='+', type=str, help="files to graph", default=None)
9 args = parser.parse_args()
10
11 fig, ax = plt.subplots(nrows=1)
12 ax.set_xscale('log')
13
14 plt.xlabel("size in bytes")
15 plt.ylabel("BW in GB/s")
16 plt.title("size vs. bw")
17 plt.tight_layout()
18
19 for 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
31 legend = plt.legend()
32 plt.show()
33
34
35
36
37
38
39
40
41
42
43
44
45
46