-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
+#!/bin/bash
+
+if [ $# -lt 1 ]; then
+ echo "usage: $0 campaign_path"
+ exit 1
+fi
+
+for i in $(find $1 -mindepth 1 -maxdepth 1 -type d); do
+ ./get_time_dl_speed_avg_for_swarm $i > $i/time_dl_speed_avg.data
+done
--- /dev/null
+#!/bin/bash
+#
+# Copyright 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com
+#
+# This script calculates the average download time and average download speed for each common scenario from more campaigns, merging the results from more campaign experiments. The first argument is the destination folder for the results and the rest of them are the folders where the input campaigns are located. In order to merge the results, the coresponding scenarios from each campaign must have the same names.
+#
+
+if [ $# -lt 2 ]; then
+ echo "usage: $0 dest_path campaign01_path [campaign02_path] ..."
+ exit 1
+fi
+
+if [ ! -e $1 ]; then
+ mkdir $1
+fi
+
+first=1
+# for each campaign listed in the args
+for i in $@; do
+ if [ $first -eq 1 ]; then
+ first=0
+ continue
+ fi
+
+ # for each scenario of the campaign
+ for j in $(find $i -mindepth 1 -maxdepth 1 -type d); do
+ dest=$1/${j##*/}
+ if [ ! -e $dest ]; then
+ mkdir $dest
+ fi
+ ./get_time_dl_speed_avg_for_swarm $j >> $dest/time_dl_speed_avg_for_each.data
+ done
+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
+done