8 announce_histogram
= {}
9 node_uptime_histogram
= {}
11 for i
in xrange(0, 50): announce_histogram
[i
] = 0
12 for i
in xrange(0, 5000, up_time_quanta
): node_uptime_histogram
[i
] = 0
18 if counter
% 1000 == 0:
19 print '\r%d' % counter
,
21 if 'distance:' in line
:
25 announce_histogram
[d
] += 1
26 if 'NODE FAILED' in line
:
28 if int(l
[9]) != 1: continue;
30 node_uptime_histogram
[d
- (d
% up_time_quanta
)] += 1
34 out
= open('dht_announce_distribution.dat', 'w+')
35 for k
,v
in announce_histogram
.items():
36 print >>out
, '%d %d' % (k
, v
)
39 out
= open('dht_node_uptime_distribution.dat', 'w+')
40 for k
,v
in node_uptime_histogram
.items():
41 print >>out
, '%d %d' % (k
+ up_time_quanta
/2, v
)
44 out
= open('dht.gnuplot', 'w+')
46 set term png size 1200,700 small
47 set output "dht_announce_distribution.png"
48 set title "bucket # announces are made against relative to target node-id"
49 set ylabel "# of announces"
50 set style fill solid border -1 pattern 2
51 plot "dht_announce_distribution.dat" using 1:2 title "announces" with boxes
53 set terminal postscript
54 set output "dht_announce_distribution.ps"
57 set term png size 1200,700 small
58 set output "dht_node_uptime_distribution.png"
59 set title "node up time"
60 set ylabel "# of nodes"
61 set xlabel "uptime (seconds)"
63 set style fill solid border -1 pattern 2
64 plot "dht_node_uptime_distribution.dat" using 1:2 title "nodes" with boxes
68 os
.system('gnuplot dht.gnuplot');