ConfigScripts: add scripts to use client-centric bandwidth limitation
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 6 Aug 2010 13:42:24 +0000 (16:42 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 6 Aug 2010 14:48:14 +0000 (17:48 +0300)
ConfigFiles/client_script_mappings
ConfigFiles/scenario-pre-post-nop.r [new file with mode: 0644]
ConfigFiles/scenario-pre-post-nop.txt [new file with mode: 0644]

index a148a86..019a022 100644 (file)
@@ -5,13 +5,17 @@
 # start/stop/detect scripts
 #
 
-# Read scenarion configuration file
-source ${BASE_PATH}/ClientWorkingFolders/TmpLogs/scenario_config
+DEBUG()
+{
+       test ${_DEBUG} = "on" && $@
+}
 
 start_client()
 {
+       local client_type=$1
+
        DEBUG echo "starting client ..."
-       case "${CLIENT_TYPE}" in
+       case "${client_type}" in
                "hrktorrent_seeder")
                        ./start_hrk_seeder.sh &
                        return $!
@@ -25,7 +29,7 @@ start_client()
 
 stop_client()
 {
-       local CLIENT_TYPE=$1
+       local client_type=$1
 
        DEBUG echo "stopping client ..."
        case "${CLIENT_TYPE}" in
@@ -40,10 +44,11 @@ stop_client()
 
 detect_complete_client()
 {
-       local log_file=$1
+       local client_type=$1
+       local log_file=$2
 
        DEBUG echo "stopping client ..."
-       case "${CLIENT_TYPE}" in
+       case "${client_type}" in
                "hrktorrent_seeder")
                        ./detect_complete_hrk.sh ${log_file}
                        ;;
@@ -55,15 +60,18 @@ detect_complete_client()
 
 parse_client_log()
 {
-       local log_folder=$1
-       local log_file=$2
+       local client_type=$1
+       local log_folder=$2
+       local log_file=$3
 
-       DEBUG echo "stopping client ..."
-       case "${CLIENT_TYPE}" in
+       DEBUG echo "parsing client ${client_type} (${log_folder}/${log_file})..."
+       case "${client_type}" in
                "hrktorrent_seeder")
+                       DEBUG echo "hello hrktorrent_seeder"
                        ./parse_hrk.sh ${log_folder} ${log_file}
                        ;;
                "hrktorrent_leecher")
+                       DEBUG echo "hello hrktorrent_leecher"
                        ./parse_hrk.sh ${log_folder} ${log_file}
                        ;;
        esac
diff --git a/ConfigFiles/scenario-pre-post-nop.r b/ConfigFiles/scenario-pre-post-nop.r
new file mode 100644 (file)
index 0000000..906c1de
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright: George Milescu 2010 - george.milescu@gmail.com
+#
+# R script used to plot the results of a scenario
+
+# import ggplot2
+library(ggplot2)
+
+# Read transmitted command line arguments
+args <- commandArgs(trailingOnly = TRUE)
+
+# The data files are located in the target folder. Also, the graph will be saved in the target folder.
+target_folder <- args[2]
+campaign_name <- args[3]
+rm(args)
+
+# read data from the data file
+seeder=read.table(paste(target_folder, "p2p-next-01-101.log.data", sep="/"), header=T, sep=" ")
+leecher=read.table(paste(target_folder, "p2p-next-01-103.log.data", sep="/"), header=T, sep=" ")
+
+
+# transform KB/s to Mbit/s
+leecher$dlspeed <- leecher$dlspeed*8/1000
+
+
+# plot dlspeed-percent data
+p <- ggplot() + 
+geom_point(aes(x=leecher$percent, y=leecher$dlspeed, label="Leecher"), size=1) +
+theme_bw() +
+scale_x_continuous("Percent", limits=c(0, 100), breaks=seq(0, 100, 10)) +
+scale_y_continuous("Download speed (Mbit/s)", limits=c(0, 8), breaks=seq(0, 8, 0.5)) +
+coord_cartesian() +
+scale_colour_manual("Legend") +
+opts(title=paste(campaign_name, "Scenario-rd: 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-rd-dlspeed-percent.eps", sep="/"))
+print(p)
+dev.off()
+
+# plot data as an png file
+png(paste(target_folder, "scenario-rd-dlspeed-percent.png", sep="/"), width = 1280, height = 800)
+print(p)
+dev.off()
+
+
+
+# plot dlspeed-time data
+p <- ggplot() + 
+geom_point(aes(x=leecher$time, y=leecher$dlspeed, label="Leecher"), size=1) +
+theme_bw() +
+scale_x_continuous("Time(s)") +
+scale_y_continuous("Download speed (Mbit/s)", limits=c(0, 8), breaks=seq(0, 8, 0.5)) +
+coord_cartesian() +
+scale_colour_manual("Legend") +
+opts(title=paste(campaign_name, "Scenario-rd: 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-rd-dlspeed-time.eps", sep="/"))
+print(p)
+dev.off()
+
+# plot data as an png file
+png(paste(target_folder, "scenario-rd-dlspeed-time.png", sep="/"), width = 1280, height = 800)
+print(p)
+dev.off()
diff --git a/ConfigFiles/scenario-pre-post-nop.txt b/ConfigFiles/scenario-pre-post-nop.txt
new file mode 100644 (file)
index 0000000..609675c
--- /dev/null
@@ -0,0 +1,9 @@
+# Scenario01ct
+# Description:
+#   * 1 seeder
+#   * 1 leecher
+#   * client-wise limitation
+#
+# Hostname                     SSHport         User    RemoteFolder            NetInterface    Download(Mbps)  DownloadBurst(K)        Upload(Mbps)    UploadBurst(K)          PreRunScript            PostRunScript           ClientType              TorrentFile             Periods
+p2p-next-03.grid.pub.ro                10122           p2p     /home/p2p/george        eth0            8               100                     8               100                     pre-run_nop.sh  post-run_nop.sh         hrktorrent_seeder       Data.100M.ct.torrent    (10,60) (60,100) (120,200) (200,230) (250,600)
+p2p-next-03.grid.pub.ro                10222           p2p     /home/p2p/george        eth0            8               100                     8               100                     pre-run_nop.sh  post-run_nop.sh         hrktorrent_leecher      Data.100M.ct.torrent    (10,30) (40,70) (80,110) (130,160) (180,250) (300,600)