added parser and plotter for the dht.log

This commit is contained in:
Arvid Norberg 2008-05-08 17:40:32 +00:00
parent 5202056682
commit b4c68f3fe9
1 changed files with 36 additions and 0 deletions

36
parse_dht_log.py Normal file
View File

@ -0,0 +1,36 @@
import sys
import os
f = open(sys.argv[1])
histogram = {}
for i in xrange(0, 50): histogram[i] = 0
for line in f.readlines():
try:
if not 'distance:' in line: continue;
l = line.split(' ')
d = int(l[4])
histogram[d] += 1
except:
print line.split(' ')
out = open('dht_announce_distribution.dat', 'w+')
for k,v in histogram.items():
print >>out, '%d %d' % (k, v)
out.close()
out = open('dht_announce_distribution.gnuplot', 'w+')
out.write('''set term png size 1200,700
set output "dht_announce_distribution.png"
set title "bucket # announces are made against relative to target node-id"
set ylabel "# of announces"
set style fill solid
set boxwidth 0.8
plot "dht_announce_distribution.dat" using 1:2 title "announces" with boxes''')
out.close()
os.system('gnuplot dht_announce_distribution.gnuplot');