ControlScripts/clients/hrk: parse_hrk.sh outputs a single peer-connection log file...
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 14 Aug 2010 07:53:46 +0000 (10:53 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 14 Aug 2010 07:53:46 +0000 (10:53 +0300)
ControlScripts/clients/hrk/parse_hrk.sh

index e8a27e8..3ea99e8 100755 (executable)
@@ -16,8 +16,7 @@ fi
 LOG_FOLDER=$1
 LOG_FILE=$2
 DATA_FILE=$LOG_FOLDER/${LOG_FILE}.data
-PEER_DOWNLOAD_FILE=$LOG_FOLDER/${LOG_FILE}.down
-PEER_UPLOAD_FILE=$LOG_FOLDER/${LOG_FILE}.up
+PEER_UPLOAD_DOWNLOAD_FILE=$LOG_FOLDER/${LOG_FILE}.updown
 
 # Check if the log folder exists
 if [ ! -d $LOG_FOLDER ]; then
@@ -78,7 +77,7 @@ hostname_to_ip()
        hostname=$1
 
        veid=${hostname##*-}
-       tmp=${hostname%-*}
+tmp=${hostname%-*}
        host_id=${tmp##*-}
 
        host_veid_to_eth_ip $host_id $veid
@@ -94,24 +93,13 @@ grep '^--Peers\|SLEEP' $LOG_FOLDER/$LOG_FILE | awk -v ip=${local_ip} -F '[],() [
        i = 6;
        for (i = 6; i < NF; i += 6) {
                j = i+2;
-               speed = $j + 0;
+               k = i+4;
+               down_speed = $j + 0;
+               up_speed = $k + 0;
                split($i, ip_port, ":");
-               printf " (%s, %s, %s)", ip, ip_port[1], speed;
+               printf " (%s, %s, %s, %s)", ip, ip_port[1], down_speed, up_speed;
        }
        printf "\n";
-}' > $PEER_DOWNLOAD_FILE
-
-grep '^--Peers\|SLEEP' $LOG_FOLDER/$LOG_FILE | awk -v ip=${local_ip} -F '[],() []+' '
-{
-       printf "[%s %s %s]", $2, $3, $4;
-       i = 6;
-       for (i = 6; i < NF; i += 6) {
-               j = i+4;
-               speed = $j + 0;
-               split($i, ip_port, ":");
-               printf " (%s, %s, %s)", ip, ip_port[1], speed;
-       }
-       printf "\n";
-}' > $PEER_UPLOAD_FILE
+}' > $PEER_UPLOAD_DOWNLOAD_FILE
 
 exit 0