file_progress fix
[libtorrent.git] / parse_session_stats.py
blob4fe3533c2045f7aca6d09753d710cf8fc5b18437
1 #!/bin/python
2 # Copyright Arvid Norberg 2008. Use, modification and distribution is
3 # subject to the Boost Software License, Version 1.0. (See accompanying
4 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 import os, sys, time
8 ignore = ['download rate', 'disk block buffers']
10 keys = ['upload rate', 'download rate', 'downloading torrents', \
11 'seeding torrents', 'peers', 'connecting peers', 'disk block buffers']
13 axes = ['x1y2', 'x1y2', 'x1y1', 'x1y1', 'x1y1', 'x1y1', 'x1y1']
15 out = open('session_stats.gnuplot', 'wb')
16 print >>out, "set term png size 1200,700"
17 print >>out, 'set output "session_stats.png"'
18 print >>out, 'set xrange [0:*]'
19 print >>out, 'set xlabel "time (s)"'
20 print >>out, 'set ylabel "number"'
21 print >>out, 'set y2label "Rate (B/s)"'
22 print >>out, 'set y2range [0:*]'
23 print >>out, 'set y2tics 20000'
24 print >>out, "set style data lines"
25 print >>out, "set key box"
26 print >>out, 'plot',
27 column = 2
28 for k in keys:
29 if k in ignore:
30 column = column + 1
31 continue
32 print >>out, ' "%s" using 1:%d title "%s" axes %s with steps,' % (sys.argv[1], column, k, axes[column-2]),
33 column = column + 1
34 print >>out, 'x=0'
35 out.close()
37 os.system('gnuplot session_stats.gnuplot');