Utils: latex table genaration script for bt-unified-tracker papar
authorP2P-Next User <p2p@p2p-next-04-201.grid.pub.ro>
Mon, 15 Nov 2010 10:09:28 +0000 (12:09 +0200)
committerP2P-Next User <p2p@p2p-next-04-201.grid.pub.ro>
Mon, 15 Nov 2010 10:09:28 +0000 (12:09 +0200)
Utils/avg2_scale2 [new file with mode: 0755]
Utils/make_latex_table_4tsup [new file with mode: 0755]
Utils/publish_time_dl_speed_for_more_campaigns

diff --git a/Utils/avg2_scale2 b/Utils/avg2_scale2
new file mode 100755 (executable)
index 0000000..15e1a4c
--- /dev/null
@@ -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 "%.2f %.2f\n", sum1 / n_items, sum2 / n_items
+}
diff --git a/Utils/make_latex_table_4tsup b/Utils/make_latex_table_4tsup
new file mode 100755 (executable)
index 0000000..8acb82c
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if [ $# -lt 5 ]; then
+       echo "usage: $0 path_prefix_non-unif path_prefix_unif no_first no_inc no_last"
+       exit 1
+fi
+
+for i in $(seq -f "%02g" $3 $4 $5); do
+       ds_nu=$(cat "$1$i/time_dl_speed_avg_for_all.data" | cut -d" " -f2)
+       dt_nu=$(cat "$1$i/time_dl_speed_avg_for_all.data" | cut -d" " -f1)
+       ds_u=$(cat "$2$i/time_dl_speed_avg_for_all.data" | cut -d" " -f2)
+       dt_u=$(cat "$2$i/time_dl_speed_avg_for_all.data" | cut -d" " -f1)
+       ds_p=$(echo -e "scale=2\n100*($ds_nu - $ds_u) / $ds_nu" | bc)
+       dt_p=$(echo -e "scale=2\n100*($dt_u - $dt_nu) / $dt_u" | bc)
+       #echo $ds_p
+       #echo "ds_nu=$ds_nu, dt_nu=$dt_nu, ds_u=$ds_u, dt_u=$dt_u"
+       echo "    \textbf{s, l} & $ds_nu & $dt_nu & \textbf{t, s, l} & $ds_u & $dt_u & $ds_p\% & $dt_p\% \\"
+       echo "    \hline"
+done
index 8083f95..4369b5b 100755 (executable)
@@ -34,5 +34,5 @@ done
 
 # for each destination directory
 for j in $(find $1 -mindepth 1 -maxdepth 1 -type d); do 
-       (./avg2 < $j/time_dl_speed_avg_for_each.data) > $j/time_dl_speed_avg_for_all.data
+       (./avg2_scale2 < $j/time_dl_speed_avg_for_each.data) > $j/time_dl_speed_avg_for_all.data
 done