From: P2P-Next User Date: Fri, 12 Nov 2010 15:05:32 +0000 (+0200) Subject: Utils: tsup statistical scrips added X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=c1a1d0022d98bc1d3b274fa3598814686fda566a;p=p2p-testing-infrastructure.git Utils: tsup statistical scrips added --- diff --git a/Utils/avg2 b/Utils/avg2 new file mode 100755 index 0000000..d9c0346 --- /dev/null +++ b/Utils/avg2 @@ -0,0 +1,22 @@ +#!/usr/bin/awk -f +# Calculates the average value of 2 columns. Lines with the first column 0 are not taken into account. + +BEGIN { + n_items = 0 + sum1 = 0.0 + sum2 = 0.0 + FS = "[ \t]+" +} + +/^[0-9]+/ { + if($1 != 0) + { + n_items++ + sum1 += $1 + sum2 += $2 + } +} + +END { + printf "%f %f\n", sum1 / n_items, sum2 / n_items +} diff --git a/Utils/get_time_dl_speed_avg b/Utils/get_time_dl_speed_avg new file mode 100755 index 0000000..ee0c4f2 --- /dev/null +++ b/Utils/get_time_dl_speed_avg @@ -0,0 +1,23 @@ +#!/usr/bin/awk -f +# Calculates the download time and the average download speed in this time for a peer, printed in this order. The input is the *.log.data file content of the peer. + +BEGIN { + n_items = 0 + dl_speed_sum = 0.0 + done = 0 + FS = "[ \t]+" +} + +/^[0-9]+/ { + if($2 != 100 || $2 == 100 && done == 0) + { + n_items++ + dl_speed_sum += $4 + } + if($2 == 100) + done = 1 +} + +END { + printf "%d %f\n", n_items-1, dl_speed_sum / n_items +} diff --git a/Utils/get_time_dl_speed_avg_for_swarm b/Utils/get_time_dl_speed_avg_for_swarm new file mode 100755 index 0000000..20f6beb --- /dev/null +++ b/Utils/get_time_dl_speed_avg_for_swarm @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright: Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com +# +# This script calculates the download time and the average download speed for an entire swarm, printed in this order and taking as input the directory where the peers' *.log.data file are located. Requires script avg2 and get_time_dl_speed_avg. + +path=. + +if [ $# -gt 0 ]; then + path=$1 +fi + +rm -f temp1987 +touch temp1987 + +for i in $(find $path -mindepth 1 -mindepth 1 -name '*.log.data'); do + (./get_time_dl_speed_avg < "$i") >> temp1987 +done + +./avg2 < temp1987 + +rm -f temp1987 diff --git a/Utils/publish_time_dl_speed b/Utils/publish_time_dl_speed new file mode 100755 index 0000000..f802305 --- /dev/null +++ b/Utils/publish_time_dl_speed @@ -0,0 +1 @@ +for i in $(find ../Results/tsup-1t-2-2010.11.11-08.20.53/ -mindepth 1 -mindepth 1 -type d); do ./get_time_dl_speed_avg_for_swarm $i > $i/time_dl_speed_avg.data; done