]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/ublas/benchmarks/plot.py
3 # Copyright (c) 2018 Stefan Seefeld
6 # This file is part of Boost.uBLAS. It is made available under the
7 # Boost Software License, Version 1.0.
8 # (Consult LICENSE or http://www.boost.org/LICENSE_1_0.txt)
11 import matplotlib
.pyplot
as plt
17 def __init__(self
, label
, data
):
22 def load_file(filename
):
24 lines
= open(filename
, 'r').readlines()
25 label
= lines
[0][1:-1].strip()
26 lines
= [l
.strip() for l
in lines
]
27 lines
= [l
.split('#', 1)[0] for l
in lines
]
28 lines
= [l
for l
in lines
if l
]
29 data
= [l
.split() for l
in lines
]
30 return plot(label
, list(zip(*data
)))
35 parser
= argparse
.ArgumentParser(prog
=argv
[0], description
='benchmark plotter')
36 parser
.add_argument('data', nargs
='+', help='benchmark data to plot')
37 parser
.add_argument('--log', choices
=['no', 'all', 'x', 'y'], help='use a logarithmic scale')
38 args
= parser
.parse_args(argv
[1:])
39 runs
= [load_file(d
) for d
in args
.data
]
40 plt
.title('Benchmark plot')
42 plt
.ylabel('time (s)')
51 plots
= [plot(r
.data
[0], r
.data
[1], label
=r
.label
) for r
in runs
]
57 if __name__
== '__main__':
60 sys
.exit(0 if main(sys
.argv
) else 1)