(name, y, lines)
| 8 | |
| 9 | |
| 10 | def gen_stats_gnuplot(name, y, lines): |
| 11 | |
| 12 | global gnuplot_scripts |
| 13 | |
| 14 | stat = open(sys.argv[1]) |
| 15 | line = stat.readline() |
| 16 | while 'minute:' not in line: |
| 17 | line = stat.readline() |
| 18 | |
| 19 | names = line.strip().split(':') |
| 20 | counter = 1 |
| 21 | for i in names: |
| 22 | print('%d: %s' % (counter, i)) |
| 23 | counter += 1 |
| 24 | |
| 25 | out = open('%s.gnuplot' % name, 'w+') |
| 26 | out.write(''' |
| 27 | set term png size 1200,700 small |
| 28 | set output "%s.png" |
| 29 | set title "%s" |
| 30 | set ylabel "%s" |
| 31 | set xlabel "time (minutes)" |
| 32 | plot ''' % (name, name.strip('_'), y)) |
| 33 | first = True |
| 34 | for i in lines: |
| 35 | if not first: |
| 36 | out.write(', \\\n') |
| 37 | first = False |
| 38 | out.write('"%s" using 1:%d title "%s" with lines' % (sys.argv[1], names.index(i) + 1, i)) |
| 39 | out.write('\n') |
| 40 | |
| 41 | out.write('''set terminal postscript |
| 42 | set output "%s.ps" |
| 43 | replot |
| 44 | ''' % (name)) |
| 45 | out.close() |
| 46 | gnuplot_scripts += [name] |
| 47 | |
| 48 | |
| 49 | gen_stats_gnuplot('dht_routing_table_size', 'nodes', ['active nodes', 'passive nodes', 'confirmed nodes']) |
no test coverage detected