diff --git a/parse_dht_log.py b/parse_dht_log.py index 02dc74ee3..cf4ec1afa 100644 --- a/parse_dht_log.py +++ b/parse_dht_log.py @@ -23,13 +23,14 @@ for k,v in histogram.items(): out.close() out = open('dht_announce_distribution.gnuplot', 'w+') -out.write('''set term png size 1200,700 +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''') +set style fill solid border -1 pattern 2 +plot "dht_announce_distribution.dat" using 1:2 title "announces" with boxes +''') out.close() os.system('gnuplot dht_announce_distribution.gnuplot'); diff --git a/parse_dht_rtt.py b/parse_dht_rtt.py new file mode 100755 index 000000000..b2fa5c2d9 --- /dev/null +++ b/parse_dht_rtt.py @@ -0,0 +1,51 @@ +#!/usr/bin/python + +import sys +import os + +quantize = 200 +max_rtt = 10000 + +f = open(sys.argv[1]) +distribution = {} +num_messages = 0 + +for i in range(0, max_rtt, quantize): + distribution[i] = 0 + +for line in f: + time = int(line.split('\t')[1]) + if (time < 0 or time > max_rtt): continue + num_messages += 1 + time /= quantize + time *= quantize + distribution[time] += 1 + +f = open('round_trip_distribution.log', 'w+') + +for k, v in distribution.items(): + print >>f, '%f %d' % ((k + (quantize / 2)) / 1000.0, v) +f.close(); + +f = open('round_trip_distribution.gnuplot', 'w+') + +f.write(''' +set term png size 1200,700 +set title "Message round trip times" +set terminal postscript +set ylabel "# of requests" +set xlabel "Round trip time (seconds)" +set grid +set style fill solid border -1 pattern 2 +set output "round_trip_distribution.ps" +set boxwidth %f +plot "round_trip_distribution.log" using 1:2 title "requests" with boxes + +set terminal png small +set output "round_trip_distribution.png" +replot +''' % (float(quantize) / 1000.0)) +f.close() + +os.system('gnuplot round_trip_distribution.gnuplot'); +