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
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
# 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}\"
# 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}\"
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=$!
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}))
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}))
# * 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
<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>
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()
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()