Utils: a new script named publish_time_dl_speed_for_more_campaings was added which...
[p2p-testing-infrastructure.git] / Utils / publish_time_dl_speed_for_more_campaigns
1 #!/bin/bash
2 #
3 # Copyright 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com
4 #
5 # 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.
6 #
7
8 if [ $# -lt 2 ]; then
9         echo "usage: $0 dest_path campaign01_path [campaign02_path] ..."
10         exit 1
11 fi
12
13 if [ ! -e $1 ]; then
14         mkdir $1
15 fi
16
17 first=1
18 # for each campaign listed in the args
19 for i in $@; do
20         if [ $first -eq 1 ]; then
21                 first=0
22                 continue
23         fi
24         
25         # for each scenario of the campaign
26         for j in $(find $i -mindepth 1 -maxdepth 1 -type d); do 
27                 dest=$1/${j##*/}
28                 if [ ! -e $dest ]; then
29                         mkdir $dest
30                 fi
31                 ./get_time_dl_speed_avg_for_swarm $j >> $dest/time_dl_speed_avg_for_each.data
32         done
33 done
34
35 # for each destination directory
36 for j in $(find $1 -mindepth 1 -maxdepth 1 -type d); do 
37         (./avg2 < $j/time_dl_speed_avg_for_each.data) > $j/time_dl_speed_avg_for_all.data
38 done