Added support to plot accurate time-based graphs for clients that are stopped/started...
authorGeorge Milescu <george.milescu@gmail.com>
Mon, 9 Aug 2010 14:55:42 +0000 (16:55 +0200)
committerGeorge Milescu <george.milescu@gmail.com>
Mon, 9 Aug 2010 14:55:42 +0000 (16:55 +0200)
Signed-off-by: George Milescu <george.milescu@gmail.com>
ControlScripts/clients/hrk/parse_hrk.sh
ControlScripts/clients/tribler/parse_tribler.sh
ControlScripts/run_scenario.sh
ControlScripts/schedule_client.sh
TestSpecs/scenario01.cfg
TestSpecs/test-campaign.html
TestSpecs/test-scenario-pre-post.r

index 9b57ce6..fe54e71 100755 (executable)
@@ -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
index 2f76542..2adfe09 100755 (executable)
@@ -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
index 3787103..7e1a8c1 100755 (executable)
@@ -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}\"
index 931d8a8..9f07a31 100755 (executable)
@@ -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}))
index c08823f..428eff4 100644 (file)
@@ -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
index 30b8394..1303f75 100644 (file)
               <td>1</td>
               <td>1</td>
               <td>8 Mbit/s up/down</td>
-              <td><a href="scenario-pre-post/scenario-pre-post-dlspeed-percent.png">dlspeed vs percent</a>; <a href="scenario-pre-post/scenario-pre-post-dlspeed-time.png">dlspeed vs time</a></td>
+              <td><a href="test-scenario-pre-post/test-scenario-pre-post-dlspeed-percent.png">dlspeed vs percent</a>; <a href="test-scenario-pre-post/test-scenario-pre-post-dlspeed-time.png">dlspeed vs time</a></td>
             </tr>
             <tr>
               <td>scenario-pre-post-nop</td>
               <td>1</td>
               <td>1</td>
               <td>8 Mbit/s up/down</td>
-              <td><a href="scenario-pre-post-nop/scenario-pre-post-nop-dlspeed-percent.png">dlspeed vs percent</a>; <a href="scenario-pre-post-nop/scenario-pre-post-nop-dlspeed-time.png">dlspeed vs time</a></td>
+              <td><a href="test-scenario-pre-post-nop/test-scenario-pre-post-nop-dlspeed-percent.png">dlspeed vs percent</a>; <a href="test-scenario-pre-post-nop/test-scenario-pre-post-nop-dlspeed-time.png">dlspeed vs time</a></td>
             </tr>
           </tbody>
         </table>
index 9cb164e..93a570f 100644 (file)
@@ -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()