From 888b8c98c44cf158c00260185b32f8216dff1195 Mon Sep 17 00:00:00 2001 From: George Milescu Date: Mon, 9 Aug 2010 16:55:42 +0200 Subject: [PATCH] Added support to plot accurate time-based graphs for clients that are stopped/started during a scenario Signed-off-by: George Milescu --- ControlScripts/clients/hrk/parse_hrk.sh | 25 +++++++++++-------- .../clients/tribler/parse_tribler.sh | 18 +++++++++++-- ControlScripts/run_scenario.sh | 8 ++++++ ControlScripts/schedule_client.sh | 10 ++++++++ TestSpecs/scenario01.cfg | 16 ++++++------ TestSpecs/test-campaign.html | 4 +-- TestSpecs/test-scenario-pre-post.r | 8 +++--- 7 files changed, 62 insertions(+), 27 deletions(-) diff --git a/ControlScripts/clients/hrk/parse_hrk.sh b/ControlScripts/clients/hrk/parse_hrk.sh index 9b57ce6..fe54e71 100755 --- a/ControlScripts/clients/hrk/parse_hrk.sh +++ b/ControlScripts/clients/hrk/parse_hrk.sh @@ -39,21 +39,24 @@ fi echo "time percent upspeed dlspeed" > $DATA_FILE # Clean and parse the log file -grep '^ps' $LOG_FOLDER/$LOG_FILE | awk -F '[ \t<>:,]+' ' +grep '^ps\|SLEEP' $LOG_FOLDER/$LOG_FILE | awk -F '[ \t<>:,]+' ' BEGIN { - count = 1; + rel_time = 0; } { - dlspeed = $6 + 0; - upspeed = $8 + 0; - - download = $10 + 0; - size = $14 + 0; - percent = 100.0 * download / size; - - printf "%d %.2f %.2f %.2f\n", count, percent, upspeed, dlspeed; - count++; + if ($1 == "SLEEP") + rel_time = rel_time + $2; + else + { dlspeed = $6 + 0; + upspeed = $8 + 0; + download = $10 + 0; + size = $14 + 0; + percent = 100.0 * download / size; + + printf "%d %.2f %.2f %.2f\n", rel_time, percent, upspeed, dlspeed; + rel_time++; + } }' >> $DATA_FILE exit 0 diff --git a/ControlScripts/clients/tribler/parse_tribler.sh b/ControlScripts/clients/tribler/parse_tribler.sh index 2f76542..2adfe09 100755 --- a/ControlScripts/clients/tribler/parse_tribler.sh +++ b/ControlScripts/clients/tribler/parse_tribler.sh @@ -40,6 +40,20 @@ fi echo "time percent upspeed dlspeed" > $DATA_FILE # Clean and parse the log file -cat -b $LOG_FOLDER/$LOG_FILE | grep DLSTATUS | grep -v HASHCHECKING | tr '\t' ' ' | tr -s ' ' | cut -d ' ' -f 2,5,8,10 | sed -e s/'%'/''/g -e s/"KB\/s"//g >> $DATA_FILE - +cat $LOG_FOLDER/$LOG_FILE | grep "DLSTATUS\|SLEEP" | grep -v "HASHCHECKING" | tr '\t' ' ' | tr -s ' ' | sed -e s/"%"/""/g -e s/"KB\/s"/""/g >> $DATA_FILE.tmp + +# Current relative time is=0 (we are at the beginning of the test) +rel_time=0 + +# Read all log lines and process the information for the plotting component +while read FILE_NAME STATUS PERCENT UNKNOWN UP UP_SPEED DOWN DOWN_SPEED; do + if [ " $FILE_NAME" = " SLEEP" ]; then + rel_time=$(($rel_time + $STATUS)) + else + echo "$rel_time $PERCENT $UP_SPEED $DOWN_SPEED" >>$DATA_FILE + rel_time=$(($rel_time + 1)) + fi +done <$DATA_FILE.tmp + +rm -f $DATA_FILE.tmp exit 0 diff --git a/ControlScripts/run_scenario.sh b/ControlScripts/run_scenario.sh index 3787103..7e1a8c1 100755 --- a/ControlScripts/run_scenario.sh +++ b/ControlScripts/run_scenario.sh @@ -109,6 +109,10 @@ scenario_setup() { # Create node config file if ! ssh -n -p ${PORT} ${USER}@${SERVER} " cat > $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/node_config << END +SERVER=\"${SERVER}\" +PORT=\"${PORT}\" +USER=\"${USER}\" +REMOTE_PATH=\"${REMOTE_PATH}\" IFACE=\"${REMOTE_IF}\" DL_BW=\"${DL_BW}\" DL_BURST=\"${DL_BURST}\" @@ -184,6 +188,10 @@ scenario_clean() { # Create node config file if ! ssh -n -p ${PORT} ${USER}@${SERVER} " cat > $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/node_config << END +SERVER=\"${SERVER}\" +PORT=\"${PORT}\" +USER=\"${USER}\" +REMOTE_PATH=\"${REMOTE_PATH}\" IFACE=\"${REMOTE_IF}\" DL_BW=\"${DL_BW}\" DL_BURST=\"${DL_BURST}\" diff --git a/ControlScripts/schedule_client.sh b/ControlScripts/schedule_client.sh index 931d8a8..9f07a31 100755 --- a/ControlScripts/schedule_client.sh +++ b/ControlScripts/schedule_client.sh @@ -85,8 +85,13 @@ DEBUG echo "start_time is ${start_time}" DEBUG echo "suspend_resume is ${suspend_resume[@]}" DEBUG echo "stop_time is ${stop_time}" +# Initial sleep (before the client is started for the first time) to_sleep=${start_time} +# Saving sleep time to log file - this script's putput is redirected to the client log file +echo "SLEEP $to_sleep" sleep ${to_sleep} + +# Starting the client for the first time DEBUG echo "CLIENT_TYPE is ${CLIENT_TYPE}" start_client ${CLIENT_TYPE} background_pid=$! @@ -94,6 +99,7 @@ DEBUG echo "background_pid is ${background_pid}" old_time=${start_time} for ((i = 0; i < ${#suspend_resume[@]}; i += 2)); do + # Sleeping while the client runs. When i wake up i will suspend the client test_infinite ${suspend_resume[$i]} to_sleep=$((${suspend_resume[$i]} - ${old_time})) @@ -103,14 +109,18 @@ for ((i = 0; i < ${#suspend_resume[@]}; i += 2)); do suspend_client ${client_pid} old_time=${suspend_resume[$i]} + # Client is suspended. Sleeping until the client should be restarted. When i wake up i will start the client test_infinite ${suspend_resume[$(($i+1))]} to_sleep=$((${suspend_resume[$(($i+1))]} - ${old_time})) + # Saving sleep time to log file - this script's putput is redirected to the client log file + echo "SLEEP $to_sleep" sleep ${to_sleep} resume_client ${client_pid} old_time=${suspend_resume[$(($i+1))]} done +# Sleeping while the client runs. When i wake up i will suspend the client for the last time test_infinite ${stop_time} to_sleep=$((${stop_time} - ${old_time})) diff --git a/TestSpecs/scenario01.cfg b/TestSpecs/scenario01.cfg index c08823f..428eff4 100644 --- a/TestSpecs/scenario01.cfg +++ b/TestSpecs/scenario01.cfg @@ -5,11 +5,11 @@ # * 6 leechers # * all peers have the same bandwidth # -# Hostname SSHport User RemoteFolder NetInterface Download(Mbps) DownloadBurst(K) Upload(Mbps) UploadBurst(K) PreRunScript PostRunScript ClientType TorrentFile Periods -p2p-next-01.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_seeder Data.700M.swarm.torrent (0,-) -p2p-next-05.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) -p2p-next-06.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) -p2p-next-07.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) -p2p-next-08.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) -p2p-next-09.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) -p2p-next-10.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) \ No newline at end of file +# Hostname SSHport User RemoteFolder NetInterface Download(Mbps) DownloadBurst(K) Upload(Mbps) UploadBurst(K) PreRunScript PostRunScript ClientType TorrentFile Periods +p2p-next-01.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_seeder Data.700M.swarm.torrent (0,-) +p2p-next-05.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) +p2p-next-06.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) +p2p-next-07.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) +p2p-next-08.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) +p2p-next-09.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (0,-) +p2p-next-10.grid.pub.ro 22 p2p /home/p2p/george/P2P-Next eth0 8 100 8 100 pre-run.sh post-run.sh tribler_leecher Data.700M.swarm.torrent (50,200) (400,700) (800,-) \ No newline at end of file diff --git a/TestSpecs/test-campaign.html b/TestSpecs/test-campaign.html index 30b8394..1303f75 100644 --- a/TestSpecs/test-campaign.html +++ b/TestSpecs/test-campaign.html @@ -122,14 +122,14 @@ 1 1 8 Mbit/s up/down - dlspeed vs percent; dlspeed vs time + dlspeed vs percent; dlspeed vs time scenario-pre-post-nop 1 1 8 Mbit/s up/down - dlspeed vs percent; dlspeed vs time + dlspeed vs percent; dlspeed vs time diff --git a/TestSpecs/test-scenario-pre-post.r b/TestSpecs/test-scenario-pre-post.r index 9cb164e..93a570f 100644 --- a/TestSpecs/test-scenario-pre-post.r +++ b/TestSpecs/test-scenario-pre-post.r @@ -34,12 +34,12 @@ scale_colour_manual("Legend") + opts(title=paste(campaign_name, "scenario-pre-post: a test swarm (1 Seeder, 1 Leecher), all peers have an 8 Mbit/s BW", sep="\n")) # plot data as an eps file -postscript(paste(target_folder, "scenario-pre-post-dlspeed-percent.eps", sep="/")) +postscript(paste(target_folder, "test-scenario-pre-post-dlspeed-percent.eps", sep="/")) print(p) dev.off() # plot data as an png file -png(paste(target_folder, "scenario-pre-post-dlspeed-percent.png", sep="/"), width = 1280, height = 800) +png(paste(target_folder, "test-scenario-pre-post-dlspeed-percent.png", sep="/"), width = 1280, height = 800) print(p) dev.off() @@ -56,11 +56,11 @@ scale_colour_manual("Legend") + opts(title=paste(campaign_name, "scenario-pre-post: a test swarm (1 Seeder, 1 Leecher), all peers have an 8 Mbit/s BW", sep="\n")) # plot data as an eps file -postscript(paste(target_folder, "scenario-pre-post-dlspeed-time.eps", sep="/")) +postscript(paste(target_folder, "test-scenario-pre-post-dlspeed-time.eps", sep="/")) print(p) dev.off() # plot data as an png file -png(paste(target_folder, "scenario-pre-post-dlspeed-time.png", sep="/"), width = 1280, height = 800) +png(paste(target_folder, "test-scenario-pre-post-dlspeed-time.png", sep="/"), width = 1280, height = 800) print(p) dev.off() -- 2.20.1