From: Razvan Deaconescu Date: Fri, 13 Aug 2010 18:33:48 +0000 (+0300) Subject: ControlScripts: complete script for parsing peer-connection upload/download speed... X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=29233045e03f95187e0f9973bc3216e329e68f64;p=p2p-testing-infrastructure.git ControlScripts: complete script for parsing peer-connection upload/download speed files --- diff --git a/ControlScripts/parse_up_down_log.sh b/ControlScripts/parse_up_down_log.sh index b10bdf0..e2617df 100755 --- a/ControlScripts/parse_up_down_log.sh +++ b/ControlScripts/parse_up_down_log.sh @@ -38,7 +38,7 @@ cat ${log_folder}/*.down > ${all_down} index=0 while read line; do - date_array[$index]=$line + date_array[$index]="$line" index=$(($index+1)) done < <(cat ${all_down} | awk -F '[][]+' '{print $2;}' | sort -u) @@ -60,8 +60,11 @@ for index in $(seq 1 ${#peer_array[@]}); do echo -e "$index\t${peer_array[$(($index-1))]}" done > peer_index.cfg -for date in ${date_array[@]}; do - grep "${date}" ${all_down} | awk -F '[],()\t []+' ' +for index in $(seq 1 ${#date_array[@]}); do + date=${date_array[$(($index-1))]} + out_file=$log_folder/$(echo "${date}.mat" | sed 's/ /-/g') + DEBUG echo "out_file: $out_file" + grep "${date}" ${all_down} | awk -F '[],()\t []+' ' BEGIN { num_peers = 0; while (1) { @@ -73,8 +76,8 @@ BEGIN { } close("peer_index.cfg"); - for (i = 0; i < num_peers; num_peers++) - for (j = 0; i < num_peers; num_peers++) + for (i = 0; i < num_peers; i++) + for (j = 0; j < num_peers; j++) matrix[i,j] = 0; } @@ -92,11 +95,15 @@ BEGIN { } END { - for (i = 0; i < num_peers; num_peers++) { - for (j = 0; i < num_peers; num_peers++) - printf "%.2f ", matrix[i,j]; + for (i = 0; i < num_peers; i++) { + for (j = 0; j < num_peers; j++) { + if (matrix[i,j] == 0) + printf "0 "; + else + printf "%.2f ", matrix[i,j]; + } printf "\n"; } -}' +}' > $out_file done