From a2452c14b15afd33cc7c3d6dc65226a453acf9e4 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Sat, 14 Aug 2010 10:53:46 +0300 Subject: [PATCH] ControlScripts/clients/hrk: parse_hrk.sh outputs a single peer-connection log file containing both upload and download information --- ControlScripts/clients/hrk/parse_hrk.sh | 26 +++++++------------------ 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/ControlScripts/clients/hrk/parse_hrk.sh b/ControlScripts/clients/hrk/parse_hrk.sh index e8a27e8..3ea99e8 100755 --- a/ControlScripts/clients/hrk/parse_hrk.sh +++ b/ControlScripts/clients/hrk/parse_hrk.sh @@ -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 -- 2.20.1