1234567891011121314151617181920212223242526272829303132333435 |
- import sys
- operations = {}
- with open("calibration/result", 'r') as f:
- for l in f:
- op, t = l.split(": ")
- t = float(t)
- operations.setdefault(op, []).append(t)
- with open("calibration/averages", 'w') as averages:
- with open("calibration/plot", 'w') as plot:
- for op in operations:
- avg = sum(operations[op]) / len(operations[op])
- op_min = 0.0
- op_max = avg * 3
- averages.write("%20s: %f\n" % (op, avg))
- with open("calibration/distribution_%s" % op, 'w') as f:
- for t in sorted(operations[op]):
- if t < op_max:
- f.write("%f\n" % t)
- plot.write("set terminal postscript enhanced colour portrait size 6,6\n")
- plot.write("n = 20\n")
- plot.write("min=%s\n" % op_min)
- plot.write("max=%s\n" % op_max)
- plot.write("width=(max-min)/n\n")
- plot.write("hist(x, width)=width*floor(x/width)+width/2.0\n")
- plot.write("set out 'calibration/plot_%s.eps'\n" % op)
- plot.write("set ylabel 'Frequency (time)'\n")
- plot.write("set xlabel 'Duration (s)'\n")
- plot.write("set title 'Operation %s'\n" % op.replace("_", "\\_"))
- plot.write("plot 'calibration/distribution_%s' u (hist($1,width)):(1.0) smooth freq w boxes\n" % op)
|