From: P2P-Next User Date: Thu, 23 Dec 2010 10:56:13 +0000 (+0200) Subject: clean-up and updates X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=a483208d0727b3a999e90b4d6aa230562a6cd8b8;p=p2p-testing-infrastructure.git clean-up and updates --- diff --git a/ClientWorkingFolders/TorrentsAndData/.gitignore b/ClientWorkingFolders/TorrentsAndData/.gitignore index ec83022..f26c584 100644 --- a/ClientWorkingFolders/TorrentsAndData/.gitignore +++ b/ClientWorkingFolders/TorrentsAndData/.gitignore @@ -2,3 +2,4 @@ /Data.4M /Data.256M /Data.64M +/Data.1024M diff --git a/ClientWorkingFolders/TorrentsAndData/Data.700M b/ClientWorkingFolders/TorrentsAndData/Data.700M deleted file mode 120000 index 1bbdc15..0000000 --- a/ClientWorkingFolders/TorrentsAndData/Data.700M +++ /dev/null @@ -1 +0,0 @@ -Data.700M.bin \ No newline at end of file diff --git a/ControlScripts/clients/swift/parse_swift.sh b/ControlScripts/clients/swift/parse_swift.sh new file mode 100755 index 0000000..12c9c6f --- /dev/null +++ b/ControlScripts/clients/swift/parse_swift.sh @@ -0,0 +1,74 @@ +#!/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 diff --git a/ControlScripts/clients/swift/start_swift_leecher.sh b/ControlScripts/clients/swift/start_swift_leecher.sh index e3e723a..0ac6f1a 100755 --- a/ControlScripts/clients/swift/start_swift_leecher.sh +++ b/ControlScripts/clients/swift/start_swift_leecher.sh @@ -33,15 +33,12 @@ HASH=$(echo $TORRENT_FILE | cut -d"/" -f2) 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}* diff --git a/ControlScripts/clients/swift/start_swift_seeder.sh b/ControlScripts/clients/swift/start_swift_seeder.sh index be07bee..3c2128b 100755 --- a/ControlScripts/clients/swift/start_swift_seeder.sh +++ b/ControlScripts/clients/swift/start_swift_seeder.sh @@ -56,6 +56,5 @@ DATA_PATH=$(pwd) 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 diff --git a/ControlScripts/hook_monitor_pid.sh b/ControlScripts/hook_monitor_pid.sh index 7bff3c6..b3c8f02 100755 --- a/ControlScripts/hook_monitor_pid.sh +++ b/ControlScripts/hook_monitor_pid.sh @@ -17,6 +17,7 @@ pid=$1 # 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 " 1>&2 exit 1 fi diff --git a/ControlScripts/parse_mon_log.sh b/ControlScripts/parse_mon_log.sh new file mode 100755 index 0000000..d34d288 --- /dev/null +++ b/ControlScripts/parse_mon_log.sh @@ -0,0 +1,21 @@ +#!/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 diff --git a/ControlScripts/parse_mon_log/parse_all b/ControlScripts/parse_mon_log/parse_all new file mode 100755 index 0000000..9aba8e6 --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_all @@ -0,0 +1,24 @@ +#!/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 diff --git a/ControlScripts/parse_mon_log/parse_cpu_process b/ControlScripts/parse_mon_log/parse_cpu_process new file mode 100755 index 0000000..ecb8dbe --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_cpu_process @@ -0,0 +1,20 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_cpu_system b/ControlScripts/parse_mon_log/parse_cpu_system new file mode 100755 index 0000000..74eaca2 --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_cpu_system @@ -0,0 +1,20 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_io_process b/ControlScripts/parse_mon_log/parse_io_process new file mode 100755 index 0000000..4fb14d7 --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_io_process @@ -0,0 +1,20 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_io_system b/ControlScripts/parse_mon_log/parse_io_system new file mode 100755 index 0000000..801a85a --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_io_system @@ -0,0 +1,20 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_memory_process b/ControlScripts/parse_mon_log/parse_memory_process new file mode 100755 index 0000000..74089f1 --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_memory_process @@ -0,0 +1,20 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_memory_system b/ControlScripts/parse_mon_log/parse_memory_system new file mode 100755 index 0000000..860a59b --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_memory_system @@ -0,0 +1,20 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_packets_in b/ControlScripts/parse_mon_log/parse_packets_in new file mode 100755 index 0000000..8d5b59c --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_packets_in @@ -0,0 +1,20 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_packets_out b/ControlScripts/parse_mon_log/parse_packets_out new file mode 100755 index 0000000..e547d94 --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_packets_out @@ -0,0 +1,20 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_udp_in b/ControlScripts/parse_mon_log/parse_udp_in new file mode 100755 index 0000000..1423559 --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_udp_in @@ -0,0 +1,42 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/parse_udp_out b/ControlScripts/parse_mon_log/parse_udp_out new file mode 100755 index 0000000..2ebb99e --- /dev/null +++ b/ControlScripts/parse_mon_log/parse_udp_out @@ -0,0 +1,42 @@ +#!/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 +} +' diff --git a/ControlScripts/parse_mon_log/r_parse_all b/ControlScripts/parse_mon_log/r_parse_all new file mode 100755 index 0000000..a0a3293 --- /dev/null +++ b/ControlScripts/parse_mon_log/r_parse_all @@ -0,0 +1,18 @@ +#!/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 diff --git a/ControlScripts/parse_mon_log/r_parse_cp.R b/ControlScripts/parse_mon_log/r_parse_cp.R new file mode 100644 index 0000000..2980a33 --- /dev/null +++ b/ControlScripts/parse_mon_log/r_parse_cp.R @@ -0,0 +1,12 @@ +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() diff --git a/ControlScripts/parse_mon_log/r_parse_mp.R b/ControlScripts/parse_mon_log/r_parse_mp.R new file mode 100644 index 0000000..4d48b10 --- /dev/null +++ b/ControlScripts/parse_mon_log/r_parse_mp.R @@ -0,0 +1,14 @@ +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() diff --git a/ControlScripts/parse_mon_log/r_parse_udp.R b/ControlScripts/parse_mon_log/r_parse_udp.R new file mode 100644 index 0000000..ac1bb9d --- /dev/null +++ b/ControlScripts/parse_mon_log/r_parse_udp.R @@ -0,0 +1,15 @@ +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() diff --git a/ControlScripts/run_scenario.sh b/ControlScripts/run_scenario.sh index 24f9355..36f0b05 100755 --- a/ControlScripts/run_scenario.sh +++ b/ControlScripts/run_scenario.sh @@ -275,7 +275,7 @@ scenario_parse() { 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 diff --git a/ControlScripts/schedule_client.sh b/ControlScripts/schedule_client.sh index 0bf2078..45503dd 100755 --- a/ControlScripts/schedule_client.sh +++ b/ControlScripts/schedule_client.sh @@ -8,7 +8,7 @@ # * 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 @@ -81,6 +81,7 @@ test_infinite() cleanup() { + echo "*** cleanup" stop_client ${CLIENT_TYPE} kill ${mon_pid} } @@ -100,30 +101,58 @@ to_sleep=${start_time} 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]} diff --git a/ControlScripts/tags b/ControlScripts/tags new file mode 100644 index 0000000..373f3b6 --- /dev/null +++ b/ControlScripts/tags @@ -0,0 +1,35 @@ +!_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 diff --git a/TestSpecs/gen/P2P_Experimente_TSUP-1Tracker-3.csv b/TestSpecs/gen/P2P_Experimente_TSUP-1Tracker-3.csv new file mode 100644 index 0000000..72cfa7e --- /dev/null +++ b/TestSpecs/gen/P2P_Experimente_TSUP-1Tracker-3.csv @@ -0,0 +1,15 @@ +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, diff --git a/TestSpecs/gen/P2P_Experimente_TSUP-MoreTrackers-3.csv b/TestSpecs/gen/P2P_Experimente_TSUP-MoreTrackers-3.csv new file mode 100644 index 0000000..3116319 --- /dev/null +++ b/TestSpecs/gen/P2P_Experimente_TSUP-MoreTrackers-3.csv @@ -0,0 +1,16 @@ +#"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, diff --git a/TestSpecs/gen/P2P_Experimente_TSUP-1Tracker-2.csv b/TestSpecs/gen/old/P2P_Experimente_TSUP-1Tracker-2.csv similarity index 100% rename from TestSpecs/gen/P2P_Experimente_TSUP-1Tracker-2.csv rename to TestSpecs/gen/old/P2P_Experimente_TSUP-1Tracker-2.csv diff --git a/TestSpecs/gen/P2P_Experimente_TSUP-1Tracker.csv b/TestSpecs/gen/old/P2P_Experimente_TSUP-1Tracker.csv similarity index 100% rename from TestSpecs/gen/P2P_Experimente_TSUP-1Tracker.csv rename to TestSpecs/gen/old/P2P_Experimente_TSUP-1Tracker.csv diff --git a/TestSpecs/gen/P2P_Experimente_TSUP-MoreTrackers-2.csv b/TestSpecs/gen/old/P2P_Experimente_TSUP-MoreTrackers-2.csv similarity index 100% rename from TestSpecs/gen/P2P_Experimente_TSUP-MoreTrackers-2.csv rename to TestSpecs/gen/old/P2P_Experimente_TSUP-MoreTrackers-2.csv diff --git a/TestSpecs/gen/P2P_Experimente_TSUP-MoreTrackers.csv b/TestSpecs/gen/old/P2P_Experimente_TSUP-MoreTrackers.csv similarity index 100% rename from TestSpecs/gen/P2P_Experimente_TSUP-MoreTrackers.csv rename to TestSpecs/gen/old/P2P_Experimente_TSUP-MoreTrackers.csv diff --git a/TestSpecs/gen/tracker-tgen b/TestSpecs/gen/tracker-tgen index 471e6c9..40a1faa 100755 --- a/TestSpecs/gen/tracker-tgen +++ b/TestSpecs/gen/tracker-tgen @@ -1,7 +1,7 @@ #!/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 # diff --git a/TestSpecs/gen/tracker-tgen-manual b/TestSpecs/gen/tracker-tgen-manual new file mode 100755 index 0000000..7cf31d0 --- /dev/null +++ b/TestSpecs/gen/tracker-tgen-manual @@ -0,0 +1,176 @@ +#!/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 < ${html_file} +cat >> ${html_file} < + + + Name + No. of Seeders + No. of Leechers + Bandwidth Rectrictions + Graphs + + + +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} < + ${campaign_name}-${exp_no} + TODO + TODO + TODO + dlspeed vs percent; dlspeed vs time + +END +done < <(grep -v '^#' $input) + +cat >> ${html_file} < + +END + +cat end.html >> ${html_file} diff --git a/Utils/tsup-experiment/tsup_torrents_gen.sh b/Utils/tsup-experiment/tsup_torrents_gen.sh index f9ea5e0..165bbda 100755 --- a/Utils/tsup-experiment/tsup_torrents_gen.sh +++ b/Utils/tsup-experiment/tsup_torrents_gen.sh @@ -4,10 +4,16 @@ # # 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 @@ -15,17 +21,13 @@ http://10.3.8.7:6969 http://10.3.8.8: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