3 # Copyright 2008 Free Software Foundation, Inc.
5 # This file is part of GNU Radio
7 # GNU Radio is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
12 # GNU Radio is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 Reads output from run_synthetic.py and runs gnuplot showing
24 GFLOPS as f(npipes, nstages)
31 from optparse import OptionParser
34 def parse_file(input_filename, output):
37 for line in open(input_filename, 'r'):
39 if s.startswith('>>>'): # ignore ">>> using SSE cruft"
42 if s.startswith('#D'): # machine description
47 npipes, nstages, flops = fields[0], fields[1], fields[8]
49 if last is not None and npipes != last:
53 output.write(' '.join((npipes, nstages, flops)))
60 def handle_file(input_filename):
61 cmd_file = tempfile.NamedTemporaryFile(mode='w+', prefix='pf', suffix='.cmd')
62 cmd_file_name = cmd_file.name
63 data_file = tempfile.NamedTemporaryFile(mode='w+', prefix='pf', suffix='.dat')
64 data_file_name = data_file.name
65 desc = parse_file(input_filename, data_file)
67 cmd_file.write("set title '%s'\n" % (desc,))
68 cmd_file.write("set xlabel 'N pipes'\n")
69 cmd_file.write("set ylabel 'N stages'\n")
70 cmd_file.write("set zlabel 'GFLOPS'\n")
71 cmd_file.write("set key off\n")
72 cmd_file.write("set view 60, 312\n")
73 cmd_file.write("set pm3d\n")
74 cmd_file.write("splot '%s' using 1:2:($3*1e-9) with pm3d at b, '%s' using 1:2:($3*1e-9) with pm3d\n" % (
75 data_file_name, data_file_name))
80 os.system("gnuplot " + cmd_file_name + " -")
82 #sys.stdout.write(open(cmd_file_name,'r').read())
83 #sys.stdout.write(open(data_file_name,'r').read())
87 usage = "usage: %prog [options] file.dat"
88 parser = OptionParser(usage=usage)
89 (options, args) = parser.parse_args()
97 if __name__ == '__main__':