From: P2P-Next Date: Fri, 13 May 2011 09:01:24 +0000 (+0300) Subject: transmission integration finished X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=f99ddcd92d4b4fe18f55df8124ccf1f8e797b8bb;p=p2p-testing-infrastructure.git transmission integration finished --- diff --git a/ControlScripts/clients/transmission/parse_transmission.sh b/ControlScripts/clients/transmission/parse_transmission.sh index 39d25ed..793918d 100755 --- a/ControlScripts/clients/transmission/parse_transmission.sh +++ b/ControlScripts/clients/transmission/parse_transmission.sh @@ -19,7 +19,6 @@ fi LOG_FOLDER=$1 LOG_FILE=$2 DATA_FILE=$LOG_FOLDER/${LOG_FILE}.data -PEER_UPLOAD_DOWNLOAD_FILE=$LOG_FOLDER/${LOG_FILE}.updown # Check if the log folder exists if [ ! -d $LOG_FOLDER ]; then @@ -43,66 +42,50 @@ fi echo "time percent upspeed dlspeed" > $DATA_FILE # Clean and parse the log file -grep '^ps\|SLEEP' $LOG_FOLDER/$LOG_FILE | awk -F '[ \t<>:,]+' ' +cat $LOG_FOLDER/$LOG_FILE | tr '\r' '\n' | grep 'Seeding\|Progress' | awk -F '[ \t(),;%]+' ' BEGIN { rel_time = 0; + percent = 0.0; + ulspeed = 0.0; + dlspeed = 0.0; } { - if ($1 == "SLEEP") - rel_time = rel_time + $2; - else { - dlspeed = $4 + 0; - upspeed = $6 + 0; - download = $8 + 0; - size = $12 + 0; - percent = 100.0 * download / size; - - printf "%d %.2f %.2f %.2f\n", rel_time, percent, upspeed, dlspeed; - rel_time++; + rel_time = $1; + if($2 == "Seeding") + { + percent = 100; + if($9 == "KiB/s") + ulspeed = $8; + else if($9 == "MiB/s") + ulspeed = $8 * 1024.0; + else if($9 == "GiB/s") + ulspeed = $8 * 1024.0 * 1024.0; + else + ulspeed = "?"; } + if($2 == "Progress:") + { + percent = $3; + + if($10 = "KiB/s") + dlspeed = $9; + else if($10 == "MiB/s") + dlspeed = $9 * 1024.0; + else if($10 == "GiB/s") + dlspeed = $9 * 1024.0 * 1024.0; + else + dlspeed = "?"; + + if($15 = "KiB/s") + ulspeed = $14; + else if($15 == "MiB/s") + ulspeed = $14 * 1024.0; + else if($15 == "GiB/s") + ulspeed = $14 * 1024.0 * 1024.0; + else + ulspeed = "?"; + } + + printf "%d %.2f %.2f %.2f\n", rel_time, percent, ulspeed, dlspeed; }' >> $DATA_FILE - -# convert host_id and veid to veth IP address in 10.0.0.0/8 network -host_veid_to_eth_ip() -{ - host_id=$1 - veid=$2 - ip_part1=$(($veid / 100)) - ip_part2=$(($veid % 100)) - id=$(echo "$host_id" | awk '{printf "%d", $1;}') - echo "10.$ip_part1.$id.$ip_part2" -} - -# convert p2p-next-${host_id}-${veid} hostname to veth IP address -hostname_to_ip() -{ - hostname=$1 - - veid=${hostname##*-} -tmp=${hostname%-*} - host_id=${tmp##*-} - - host_veid_to_eth_ip $host_id $veid -} - -local_ip=$(hostname_to_ip ${LOG_FILE/%.log/}) - -# Parse the peer log file; output peer download and upload files - -grep '^--Peers' $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+2; - k = i+4; - down_speed = $j + 0; - up_speed = $k + 0; - split($i, ip_port, ":"); - printf " (%s, %s, %s, %s)", ip, ip_port[1], down_speed, up_speed; - } - printf "\n"; -}' > $PEER_UPLOAD_DOWNLOAD_FILE - -exit 0