/Data.4M
/Data.256M
/Data.64M
+/Data.1024M
+++ /dev/null
-Data.700M.bin
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+#
+# 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com
+#
+# Bash script used to parse the log file generated by a swift client
+#
+# Script arguments:
+# * a folder where the log and data files are stored
+# * the name of a log file in that folder
+#
+# Sample run:
+# ./parse_swift.sh ../../../Results/samples/ p2p-next-01-101.log
+
+if [ ! $# -eq 2 ]; then
+ echo "usage: $0 log-folder log-file"
+ exit 1
+fi
+
+LOG_FOLDER=$1
+LOG_FILE=$2
+DATA_FILE=$LOG_FOLDER/${LOG_FILE}.data
+
+# Check if the log folder exists
+if [ ! -d $LOG_FOLDER ]; then
+ echo "Error: The folder $LOG_FOLDER does not exist."
+ exit 1
+fi
+
+# Check if the log file exists
+if [ ! -e $LOG_FOLDER/$LOG_FILE ]; then
+ echo "Error: The log file $LOG_FOLDER/$LOG_FILE does not exist."
+ exit 1
+fi
+
+# Check if the log file is a regular file
+if [ ! -f $LOG_FOLDER/$LOG_FILE ]; then
+ echo "Error: The log file $LOG_FOLDER/$LOG_FILE is not a regular file."
+ exit 1
+fi
+
+# Write the header to the data file
+echo "time percent upspeed dlspeed" > $DATA_FILE
+
+# Clean and parse the log file
+grep '^done\|DONE\|SLEEP' $LOG_FOLDER/$LOG_FILE | awk -F '[ \t(),]+' '
+BEGIN {
+ rel_time = 0;
+ up_bytes = 0;
+ down_bytes = 0;
+}
+
+{
+ if ($1 == "SLEEP")
+ rel_time = rel_time + $2;
+ else {
+ dlspeed = ($14 - down_bytes) / 1024.0;
+ down_bytes = $14;
+
+ upspeed = ($9 - up_bytes) / 1024.0;
+ up_bytes = $9;
+
+ download = $2 + 0;
+ size = $4 + 0;
+ if(size != 0)
+ percent = 100.0 * download / size;
+ else
+ percent = "-";
+
+ printf "%d %.2f %.2f %.2f\n", rel_time, percent, upspeed, dlspeed;
+ rel_time++;
+ }
+}' >> $DATA_FILE
+
+exit 0
cd $SWIFT_ABS_PATH
#sleep 5
-echo ./swift -h "$HASH" -t "${TRACKER_IP}:6881" -p > ~/deb
-./swift -h "$HASH" -t "${TRACKER_IP}:6881" -p
+#./swift -h "$HASH" -t "${TRACKER_IP}:6881" -p
-#
-#./swift -h "$HASH" -t "${TRACKER_IP}:6881" -p &
-# ps -ef | grep shedule bla bla # proper way of determining PID of schedule (master) process
-# kill -USR1 $SCHEDULE_PID # SCHEDULE_PID is pid for master process
-#
-# wait # wait for client process to complete
-#
+echo "" > ~/deb
+echo $SCHEDULE_CLIENT_PID >> ~/deb
+ps -ef | grep schedule_client >> ~/deb
+
+./swift -h "$HASH" -t "${TRACKER_IP}:6881" -p
rm -f ${HASH}*
cd $SWIFT_ABS_PATH
-
-echo ./swift -f "${DATA_PATH}"/"${TORRENT_FILE}" -l ${OWN_IP}:6881 -p > ~/deb
+#echo ./swift -f "${DATA_PATH}"/"${TORRENT_FILE}" -l ${OWN_IP}:6881 -p > ~/deb
./swift -f "${DATA_PATH}"/"${TORRENT_FILE}" -l ${OWN_IP}:6881 -p
# check if pid exists
kill -0 $pid > /dev/null 2>&1
if test $? -ne 0; then
+ ps -ef
echo -e "PID $pid does not exists.\nUsage: $0 <pid>" 1>&2
exit 1
fi
--- /dev/null
+#!/bin/bash
+
+# 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com
+#
+# The script:
+# * parses multiple resource monitor files
+#
+# Command line argument specifies log folder.
+#
+
+if [ $# != 1 ]; then
+ echo "usage: $0 log-folder" 1>&2
+ exit 1
+fi
+
+log_folder=$1
+
+for i in $(find ${log_folder} -mindepth 1 -maxdepth 1 -name '*.log.mon'); do
+ parse_mon_log/parse_all $(basename $i) ${log_folder}
+ parse_mon_log/r_parse_all $(basename $i) ${log_folder}
+done
--- /dev/null
+#!/bin/bash
+
+if test $# -ne 2; then
+ echo "Usage: $0 input-log-file log-folder" 1>&2
+ exit 1
+fi
+
+input_log_file=$1
+log_folder=$2
+
+&>> ${input_log_folder}/${input_log_file}.err
+
+echo ${input_log_file}
+
+./parse_mon_log/parse_memory_process < ${log_folder}/$input_log_file > ${log_folder}/mon/mp_$input_log_file
+./parse_mon_log/parse_memory_system < ${log_folder}/$input_log_file > ${log_folder}/mon/ms_$input_log_file
+./parse_mon_log/parse_cpu_process < ${log_folder}/$input_log_file > ${log_folder}/mon/cp_$input_log_file
+./parse_mon_log/parse_cpu_system < ${log_folder}/$input_log_file > ${log_folder}/mon/cs_$input_log_file
+./parse_mon_log/parse_io_process < ${log_folder}/$input_log_file > ${log_folder}/mon/ip_$input_log_file
+./parse_mon_log/parse_io_system < ${log_folder}/$input_log_file > ${log_folder}/mon/is_$input_log_file
+./parse_mon_log/parse_udp_in < ${log_folder}/$input_log_file > ${log_folder}/mon/ui_$input_log_file
+./parse_mon_log/parse_udp_out < ${log_folder}/$input_log_file > ${log_folder}/mon/uo_$input_log_file
+./parse_mon_log/parse_packets_in < ${log_folder}/$input_log_file > ${log_folder}/mon/pi_$input_log_file
+./parse_mon_log/parse_packets_out < ${log_folder}/$input_log_file > ${log_folder}/mon/po_$input_log_file
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "user\tsystem\tCPU\n"
+}
+
+/%CPU[ \t]+CPU[ \t]+Command/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+ if (count == 2 && !init)
+ printf "%s\t%s\t%s\n", $4, $5, $6
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "user\tsystem\n"
+}
+
+/^avg-cpu/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+ if (count == 2 && !init)
+ printf "%s\t%s\n", $1, $3
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "kB_rd/s\tkB_wr/s\n"
+}
+
+/kB_rd\/s[ \t]+kB_wr\/s/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+ if (count == 2 && !init)
+ printf "%s\t%s\n", $4, $5
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "Blk_read/s\tBlk_wrtn/s\n"
+}
+
+/^Device:/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+ if (count == 2 && !init)
+ printf "%s\t%s\n", $3, $4
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "VSZ\tRSS\tPERCENT\n"
+}
+
+/VSZ[ \t]+RSS[ \t]+%MEM/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+ if (count == 2 && !init)
+ printf "%s\t%s\t%s\n", $6, $7, $8
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "memory\n"
+}
+
+/^Mem:/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+ if (count == 2 && !init)
+ printf "%s\n", $3
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "bytes_received\n"
+}
+
+/^Chain udp_out/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+ if (count == 4 && !init)
+ printf "%s\n", $1
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "bytes_sent\n"
+}
+
+/^Chain udp_out/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+ if (count == 5 && !init)
+ printf "%s\n", $1
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "pkts\tbytes\n"
+}
+
+/^Chain udp_in/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+
+ pkts = $1 + 0
+ bytes = $2 + 0
+
+ if (index($1, "K"))
+ pkts = pkts * 1024
+ else
+ if (index($1, "M"))
+ pkts = pkts * 1024 * 1024;
+ else
+ if (index($1, "G"))
+ pkts = pkts * 1024 * 1024 * 1204
+
+ if (index($2, "K"))
+ bytes = bytes * 1024
+ else
+ if (index($2, "M"))
+ bytes = bytes * 1024 * 1024;
+ else
+ if (index($2, "G"))
+ bytes = bytes * 1024 * 1024 * 1204
+
+ if (count == 3 && !init)
+ printf "%s\t%s\n", pkts, bytes
+}
+'
--- /dev/null
+#!/bin/bash
+
+awk '
+BEGIN {
+ count = 0
+ init = 1
+ printf "pkts\tbytes\n"
+}
+
+/^Chain udp_out/ {
+ count = 0
+ init = 0
+}
+
+{
+ count++
+
+ pkts = $1 + 0
+ bytes = $2 + 0
+
+ if (index($1, "K"))
+ pkts = pkts * 1024
+ else
+ if (index($1, "M"))
+ pkts = pkts * 1024 * 1024;
+ else
+ if (index($1, "G"))
+ pkts = pkts * 1024 * 1024 * 1204
+
+ if (index($2, "K"))
+ bytes = bytes * 1024
+ else
+ if (index($2, "M"))
+ bytes = bytes * 1024 * 1024;
+ else
+ if (index($2, "G"))
+ bytes = bytes * 1024 * 1024 * 1204
+
+ if (count == 3 && !init)
+ printf "%s\t%s\n", pkts, bytes
+}
+'
--- /dev/null
+#!/bin/bash
+
+if test $# -ne 2; then
+ echo "Usage: $0 base-log-file log-folder" 1>&2
+ exit 1
+fi
+
+base_log_file=$1
+log_folder=$2
+
+&>> ${log_folder}/mon/${base_log_file}.err
+
+echo ${base_log_file}
+
+Rscript parse_mon_log/r_parse_udp.R ${log_folder}/mon/ui_$base_log_file ${log_folder}/mon/ui_$(basename $base_log_file .log.mon).pdf
+Rscript parse_mon_log/r_parse_udp.R ${log_folder}/mon/uo_$base_log_file ${log_folder}/mon/uo_$(basename $base_log_file .log.mon).pdf
+Rscript parse_mon_log/r_parse_cp.R ${log_folder}/mon/cp_$base_log_file ${log_folder}/mon/cp_$(basename $base_log_file .log.mon).pdf
+Rscript parse_mon_log/r_parse_mp.R ${log_folder}/mon/mp_$base_log_file ${log_folder}/mon/mp_$(basename $base_log_file .log.mon).pdf
--- /dev/null
+args <- commandArgs(trailingOnly=TRUE)
+
+source_file <- args[1]
+output_file <- args[2]
+
+cpu_table <- read.table(source_file, header=T)
+
+cpu_perc <- cpu_table$CPU
+
+pdf(file=output_file)
+plot(cpu_perc, type="o", col="red", xlab="Time (s)", ylab="CPU Usage (%)");
+dev.off()
--- /dev/null
+args <- commandArgs(trailingOnly=TRUE)
+
+source_file <- args[1]
+output_file <- args[2]
+
+mem_table <- read.table(source_file, header=T)
+
+rss <- mem_table$RSS / 1024
+new_rss <- rss
+new_rss[length(new_rss)+1] = 0
+
+pdf(file=output_file)
+plot(new_rss, type="o", col="red", xlab="Time (s)", ylab="RSS (MB)");
+dev.off()
--- /dev/null
+args <- commandArgs(trailingOnly=TRUE)
+
+source_file <- args[1]
+output_file <- args[2]
+
+udp_table <- read.table(source_file, header=T)
+
+bytes_array <- udp_table$bytes
+offset_bytes_array <- bytes_array[2:length(bytes_array)]
+
+speed <- (offset_bytes_array - bytes_array[1:length(bytes_array)-1]) / 1024
+
+pdf(file=output_file)
+plot(speed, type="o", col="red", xlab="Time (s)", ylab="Speed (KB/s)");
+dev.off()
echo " *** Parsing peer resource monitoring files"
rm -rf ${SCENARIO_RESULTS_FOLDER}/mon
mkdir ${SCENARIO_RESULTS_FOLDER}/mon
- if ! ./parse_mon_log.sh $SCENARIO_RESULTS_FOLDER; then
+ if ! ./parse_mon_log.sh $SCENARIO_RESULTS_FOLDER &> /dev/null; then
echo "Error parsing mon files in $SCENARIO_RESULTS_FOLDER"
exit 1
fi
# * manages when client completes
# use _DEBUG="off" to turn off debug printing
-_DEBUG="off"
+_DEBUG="on"
# Read the global configuration file
# Check if the global configuration file exists
cleanup()
{
+ echo "*** cleanup"
stop_client ${CLIENT_TYPE}
kill ${mon_pid}
}
echo "SLEEP $to_sleep"
sleep ${to_sleep}
+# store own PID in environment variable
+declare SCHEDULE_CLIENT_PID
+SCHEDULE_CLIENT_PID=$$
+export SCHEDULE_CLIENT_PID
+
+#do_nothing_handler()
+#{
+# echo "*** do_nothing_handler" # do nothing, successfully
+#}
+
+#trap do_nothing_handler 10 # wait_for_usr1 is simple handler (waits for SIGUSR1 from start_client process)
+
# Starting the client for the first time
-DEBUG echo "CLIENT_TYPE is ${CLIENT_TYPE}"
+DEBUG echo "$(basename $0): CLIENT_TYPE is ${CLIENT_TYPE}"
start_client ${CLIENT_TYPE} ${DL_BW} ${UL_BW} ${NO_CONNECTIONS}
background_pid=$!
-DEBUG echo "background_pid is ${background_pid}"
+DEBUG echo "$(basename $0): background_pid is ${background_pid}"
+
+# wait for client to start
+while true; do
+ #echo "ps --ppid ${background_pid} -o pid -o cmd"
+ #ps --ppid ${background_pid} -o pid -o cmd
+ #echo "ps --ppid ${background_pid} -o 'pid=' -o 'cmd=' | grep './swift' | grep -v 'grep' | grep -v 'ps'"
+ #ps --ppid ${background_pid} -o 'pid=' -o 'cmd=' | grep './swift' | grep -v 'grep' | grep -v 'ps'
+ #client_pid=$(ps --ppid ${background_pid} -o 'pid=' -o 'cmd=' | grep './swift' | grep -v 'grep' | grep -v 'ps' | awk '{print $1;}')
+ #client_pid=$(ps --ppid ${background_pid} | grep -v '/bin/.*sh' | grep -v 'PID' | tail -1 | awk '{print $1;}')
+ #client_pid=$(pgrep -P ${background_pid})
+ #if ! test -z ${client_pid}; then # ps ended successfully
+
+ pidof swift
+ client_pid=$(pidof swift)
+
+ if [ ! -z "$client_pid" ]; then
+ break
+ fi
+done
+DEBUG echo "$(basename $0): client_pid is ${client_pid}"
-# wait_for_usr1()
-# {
-# # do nothing, successfully
-# }
-#
-# trap wait_for_usr1 10 # wait_for_usr1 is simple handler (waits for SIGUSR1 from start_client process)
-#
+if [ -z $(ps -p "$background_pid" -o pid=) ]; then
+ DEBUG echo "background pid is dead"
+fi
-sleep 5
-client_pid=$(pgrep -P ${background_pid})
-DEBUG echo "client_pid is ${client_pid}"
-old_time=${start_time}
+if [ -z $(ps -p "$client_pid" -o pid=) ]; then
+ DEBUG echo "client pid is dead"
+fi
# Monitor client's resources
-echo "$client_pid"
./hook_monitor_pid.sh "$client_pid" >> $REMOTE_PATH/P2P-Testing-Infrastructure/ClientWorkingFolders/TmpLogs/$(hostname).log.mon 2>&1 &
+ps -ef
mon_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]}
--- /dev/null
+!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
+!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
+!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
+!_TAG_PROGRAM_NAME Exuberant Ctags //
+!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
+!_TAG_PROGRAM_VERSION 5.7 //
+cleanup hook_monitor_pid.sh /^cleanup()$/;" f
+cleanup schedule_client.sh /^cleanup()$/;" f
+host_veid_to_eth_ip clients/hrk/parse_hrk.sh /^host_veid_to_eth_ip()$/;" f
+host_veid_to_eth_ip clients/next-share/parse_nextshare.sh /^host_veid_to_eth_ip()$/;" f
+host_veid_to_eth_ip clients/swift/start_swift_seeder.sh /^host_veid_to_eth_ip()$/;" f
+hostname_to_ip clients/hrk/parse_hrk.sh /^hostname_to_ip()$/;" f
+hostname_to_ip clients/next-share/parse_nextshare.sh /^hostname_to_ip()$/;" f
+hostname_to_ip clients/swift/start_swift_seeder.sh /^hostname_to_ip()$/;" f
+parse_periods schedule_client.sh /^parse_periods()$/;" f
+restart bw_limit.sh /^restart() {$/;" f
+restart bw_limit_ct.sh /^restart() {$/;" f
+resume_client schedule_client.sh /^resume_client()$/;" f
+scenario_clean run_scenario.sh /^scenario_clean() {$/;" f
+scenario_parse run_scenario.sh /^scenario_parse() {$/;" f
+scenario_schedule run_scenario.sh /^scenario_schedule()$/;" f
+scenario_setup run_scenario.sh /^scenario_setup() {$/;" f
+scenario_wait run_scenario.sh /^scenario_wait() {$/;" f
+show bw_limit.sh /^show() {$/;" f
+show bw_limit_ct.sh /^show() {$/;" f
+start bw_limit.sh /^start() {$/;" f
+start bw_limit_ct.sh /^start() {$/;" f
+stop bw_limit.sh /^stop() {$/;" f
+stop bw_limit_ct.sh /^stop() {$/;" f
+suspend_client schedule_client.sh /^suspend_client()$/;" f
+test_infinite schedule_client.sh /^test_infinite()$/;" f
+timer_callback hook_monitor_pid.sh /^timer_callback()$/;" f
+usage bw_limit.sh /^usage() {$/;" f
+usage bw_limit_ct.sh /^usage() {$/;" f
+usage run_scenario.sh /^usage() {$/;" f
--- /dev/null
+01,1,3,4,Nelimitat,24,3,64M,
+02,1,3,4,Nelimitat,24,3,256M,
+03,1,3,4,Nelimitat,24,3,1024M,
+04,2,6,8,Nelimitat,24,3,64M,
+05,2,6,8,Nelimitat,24,3,256M,
+06,2,6,8,Nelimitat,24,3,1024M,
+07,4,12,16,Nelimitat,24,3,64M,
+08,4,12,16,Nelimitat,24,3,256M,
+09,4,12,16,Nelimitat,24,3,1024M,
+10,8,24,32,Nelimitat,24,3,64M,
+11,8,24,32,Nelimitat,24,3,256M,
+12,8,24,32,Nelimitat,24,3,1024M,
+13,12,36,48,Nelimitat,24,3,64M,
+14,12,36,48,Nelimitat,24,3,256M,
+15,12,36,48,Nelimitat,24,3,1024M,
--- /dev/null
+#"experiment_id","no_of_trackers","file_size","download_speed","upload_speed","experiment_description"
+01,1,64,24,3,
+02,1,256,24,3,
+03,1,1024,24,3,
+04,2,64,24,3,
+05,2,256,24,3,
+06,2,1024,24,3,
+07,4,64,24,3,
+08,4,256,24,3,
+09,4,1024,24,3,
+10,8,64,24,3,
+11,8,256,24,3,
+12,8,1024,24,3,
+13,12,64,24,3,
+14,12,256,24,3,
+15,12,1024,24,3,
#!/bin/bash
#
-# Test scenario generators - generates *.cfg files
+# Test scenario generators - generates *.cfg files for unified trackers
#
# 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
#
--- /dev/null
+#!/bin/bash
+
+#
+# Test scenario generators - generates *.cfg files for unified trackers
+# (trackers are going to be started manually)
+# 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
+#
+# Sample run:
+# ./tgen gogu P2P_Experimente_Swarm-metrics.csv
+#
+
+if test $# -ne 2; then
+ echo "Usage: $0 campaign-name test-description-file" 1>&2
+ exit 1
+fi
+
+campaign_name=$1
+input=$2
+
+parse_conn()
+{
+ echo "" | awk -v var="$1" '{print var + 0;}'
+}
+
+parse_bw()
+{
+ echo "" | awk -v var="$1" '{print var + 0;}'
+}
+
+parse_file()
+{
+ size=$(echo "" | awk -v var="$2" '{print var + 0;}')
+ tracker_no=$(echo "" | awk -v var="$1" '{print var + 0;}')
+ echo "Data.${size}M.tracker${tracker_no}.torrent"
+}
+
+generate_scenario()
+{
+ exp_no=$1
+ num_trackers=$2
+ down_bw=$3
+ up_bw=$4
+ data_size=$5
+ description=$6
+
+ num_seeders=$num_trackers
+ num_clients_per_tracker=4
+ num_leechers=$(($num_trackers * $num_clients_per_tracker - $num_seeders))
+
+ echo -e "#\n# Campaign $campaign_name; scenario $exp_no\n#"
+ echo "### BEGIN SCENARIO INFO"
+ echo "# Campaign: $campaign_name"
+ echo "# Id: $exp_no"
+ echo "# Description: $description"
+ echo "# Number of trackers: $num_trackers"
+ echo "# Number of seeders: $num_seeders"
+ echo "# Number of leechers: $num_leechers"
+ echo "# Maximum download: $down_bw"
+ echo "# Maximum upload: $down_bw"
+ echo "# Client type: hrktorrent (libtorrent-rasterbar)"
+ echo "### END SCENARIO INFO"
+ echo ""
+
+ echo -e "# Hostname\t\t\tSSHport\t\tUser\t\tRemoteFolder\t\tNetInterface\t\tDownload(Mbps)\tDownloadBurst(K)\tUpload(Mbps)\tUploadBurst(K)\tOverallNoOfConnections\tPreRunScript\t\tPostRunScript\t\tClientType\t\t\tTorrentFile\t\tPeriods"
+# index=0
+# # generate trackers
+# for t_index in 301 302 303 304 305 306 307 308 309 310 311 312; do
+# echo -en "p2p-next-08.grid.pub.ro\t\t"
+# echo -en "${t_index}22\t\t"
+# echo -en "p2p\t\t"
+# echo -en "/home/p2p/george\t"
+# echo -en "eth0\t\t\t"
+# echo -en "0\t\t"
+# echo -en "0\t\t\t"
+# echo -en "0\t\t"
+# echo -en "0\t\t"
+# echo -en "0\t\t\t"
+# echo -en "pre-run_nop.sh\t\t"
+# echo -en "post-run_nop.sh\t\t"
+# echo -en "xbtut\t\t"
+# echo -en "N/A\t"
+# echo "(0,-)"
+#
+# index=$((index+1))
+#
+# if test $index -ge $(($num_trackers)); then
+# break
+# fi
+# done
+
+ index=0
+ for sys_index in 01 03 04 05 06 07 08 09 10; do
+ for ce_index in 1 2 3 4 5 6 7 8 9 10; do
+ echo -en "p2p-next-$sys_index.grid.pub.ro\t\t"
+ echo -en "1$(printf %02g $ce_index)22\t\t"
+ echo -en "p2p\t\t"
+ echo -en "/home/p2p/george\t"
+ echo -en "eth0\t\t\t"
+ echo -en "$down_bw\t\t"
+ echo -en "100\t\t\t"
+ echo -en "$up_bw\t\t"
+ echo -en "100\t\t"
+ echo -en "0\t\t\t"
+ echo -en "pre-run_nop.sh\t\t"
+ echo -en "post-run_nop.sh\t\t"
+
+ if test $(($index % $num_clients_per_tracker)) -eq 0; then
+ echo -en "hrktorrent_seeder_limit\t\t"
+ elif test $index -lt $(($num_seeders+$num_leechers)); then
+ echo -en "hrktorrent_leecher_limit\t"
+ fi
+
+ tracker_index=$(($index / $num_clients_per_tracker + 1))
+ seed_torrent=$(parse_file $tracker_index $data_size)
+ echo -en "$seed_torrent\t"
+ echo "(0,-)"
+
+ index=$((index+1))
+
+ if test $index -ge $(($num_seeders+$num_leechers)); then
+ return
+ fi
+ done
+ done
+}
+
+campaign_file=${campaign_name}.cfg
+
+> "${campaign_file}" cat <<END
+#
+# ${campaign_name}
+#
+# Scenario description R script for plotting
+END
+
+html_file=${campaign_name}.html
+cat start.html > ${html_file}
+cat >> ${html_file} <<END
+ <table id="box-table-a" summary="${campaign_name} results">
+ <thead>
+ <tr>
+ <th scope="col">Name</th>
+ <th scope="col">No. of Seeders</th>
+ <th scope="col">No. of Leechers</th>
+ <th scope="col">Bandwidth Rectrictions</th>
+ <th scope="col">Graphs</th>
+ </tr>
+ </thead>
+ <tbody>
+END
+
+while IFS="," read exp_no num_trackers data_size down_bw up_bw description; do
+ # generate test scenario
+ generate_scenario "$exp_no" "$num_trackers" "$down_bw" "$up_bw" "$data_size" "$description" > "${campaign_name}-${exp_no}".cfg
+
+ # update campaign configuration file
+ echo -e "${campaign_name}-${exp_no}.cfg\t${campaign_name}-${exp_no}.R" >> "${campaign_file}"
+
+ # update campaign HTML file
+ cat >> ${html_file} <<END
+ <tr>
+ <td>${campaign_name}-${exp_no}</td>
+ <td>TODO</td>
+ <td>TODO</td>
+ <td>TODO</td>
+ <td><a href="${campaign_name}-${exp_no}/${campaign_name}-${exp_no}-dlspeed-percent.png">dlspeed vs percent</a>; <a href="${campaign_name}-${exp_no}/${campaign_name}-${exp_no}-dlspeed-time.png">dlspeed vs time</a></td>
+ </tr>
+END
+done < <(grep -v '^#' $input)
+
+cat >> ${html_file} <<END
+ </tbody>
+ </table>
+END
+
+cat end.html >> ${html_file}
#
# Bash script used generate torrent files for the TSUP Experiment
# The script
-# * generates a torrent file for each of the 12 trackers, for files of 4MiB,
-# 16MiB, 64MiB, 256MiB, 1GiB.
+# * generates a torrent file for each of the 12 trackers
#
+if [ $! -ne 1 ]; then
+ echo "usage: $0 data_file"
+ exit 1
+fi
+
+filename=$1
+
tracker_url_array=( http://10.3.8.1:6969 http://10.3.8.2:6969
http://10.3.8.3:6969 http://10.3.8.4:6969
http://10.3.8.5:6969 http://10.3.8.6:6969
http://10.3.8.9:6969 http://10.3.8.10:6969
http://10.3.8.11:6969 http://10.3.8.12:6969 )
-for i in 4M 16M 64M 256M 1024M; do
- index=1
- for url_item in ${tracker_url_array[@]}; do
- filename=Data.$i
- if [ -e $filename ]; then
- echo "Making $filename.tracker$index.torrent for"
- echo " tracker_index: $index, tracker_url: $url_item, file_size: $i"
- btmakemetafile $url_item/announce $filename --target $filename.tracker$index.torrent
- else
- echo "Warning: $filename does not exist."
- fi
- index=$(($index + 1))
- done
+for url_item in ${tracker_url_array[@]}; do
+ if [ -e $filename ]; then
+ echo "Making $filename.tracker$index.torrent for"
+ echo " tracker_index: $index, tracker_url: $url_item"
+ btmakemetafile $url_item/announce $filename --target $filename.tracker$index.torrent
+ else
+ echo "Warning: $filename does not exist."
+ fi
+ index=$(($index + 1))
done