MCPcopy Create free account
hub / github.com/arvidn/libtorrent / gen_stats_gnuplot

Function gen_stats_gnuplot

tools/parse_dht_stats.py:10–46  ·  view source on GitHub ↗
(name, y, lines)

Source from the content-addressed store, hash-verified

8
9
10def 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('''
27set term png size 1200,700 small
28set output "%s.png"
29set title "%s"
30set ylabel "%s"
31set xlabel "time (minutes)"
32plot ''' % (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
42set output "%s.ps"
43replot
44''' % (name))
45 out.close()
46 gnuplot_scripts += [name]
47
48
49gen_stats_gnuplot('dht_routing_table_size', 'nodes', ['active nodes', 'passive nodes', 'confirmed nodes'])

Callers 1

parse_dht_stats.pyFile · 0.85

Calls 4

openFunction · 0.85
printFunction · 0.85
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected