5 def listtofile(listing, file):
11 def makeGraphs(graphs, graphtitle = "Title", xlabel = "Number of Parts", ylabel = "Time needed for calculation"):
12 gendir = "stats/generated/"
13 subprocess.call(["mkdir", "-p", gendir])
14 p = subprocess.Popen(['gnuplot'],stdout=subprocess.PIPE,stdin=subprocess.PIPE)
16 for graphfile in graphs:
17 # set output 'filename'
18 p.stdin.write("set terminal png font arial 8 #size 600,300\n")
19 p.stdin.write("set grid\n")
20 p.stdin.write("set datafile separator ';'\n")
21 p.stdin.write("set title 'Timing of each "+graphtitle+"'\n")
22 p.stdin.write("set xlabel '"+xlabel+"'\n")
23 p.stdin.write("set ylabel '"+ylabel+"'\n")
24 p.stdin.write("set output '"+gendir+graphfile+"'\n")
25 # plot 'filename' using 1:2 title 'algorithm' with lines, 'filename2' using 1:2 title 'algo2' with lines
27 for title, file, cols in graphs[graphfile]:
28 plots.append("'"+file+"' using "+cols+" title '"+title+"' with lines")
29 plotcommand = ", ".join(plots)
30 #print gendir+graphfile
31 p.stdin.write("plot "+plotcommand+"\n")
35 statsdir = 'stats/raw/'
36 runs = os.listdir(statsdir)
39 gendir = "stats/generated/"
42 subprocess.call(["mkdir", "-p", gendir])
44 runfiles = os.listdir(statsdir+i)
47 # print "File: %s%s/%s" % (statsdir, i, file)
48 splitfilename = file.split('.')
50 dict['arrsize'] = splitfilename[1]
51 graphs.append((splitfilename[1], statsdir+i+'/'+file, '1:2'))
53 makeGraphs({outpng: graphs}, "merge")