-
Notifications
You must be signed in to change notification settings - Fork 2
/
vary_bandwidth_parking-lot.sh
131 lines (111 loc) · 4.58 KB
/
vary_bandwidth_parking-lot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# /*
# * Copyright (c) 2016 NITK, Surathkal
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License version 2 as
# * published by the Free Software Foundation;
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# *
# * Authors: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
# *
# */
# This script runs a series of parking-lot simulations with different TCP variants
# and varying bottleneck bandwidth. The bottleneck bandwidth is varied from
# 1Mbps to 100Mbps
# set output directory.
New_DIR="."
Original_DIR=`pwd`
# set working DIR
if [ ! -e "$New_DIR/tcp-eval-results" ]; then
mkdir "$New_DIR/tcp-eval-results"
fi
# set working DIR
if [ ! -e "$New_DIR/tcp-eval-results/parking-lot" ]; then
mkdir "$New_DIR/tcp-eval-results/parking-lot"
fi
# set working DIR
if [ ! -e "$New_DIR/tcp-eval-results/parking-lot/bandwidth" ]; then
mkdir "$New_DIR/tcp-eval-results/parking-lot/bandwidth"
fi
i=0
while true ; do
if [ ! -e "$New_DIR/tcp-eval-results/parking-lot/bandwidth/exp$i" ]; then
mkdir "$New_DIR/tcp-eval-results/parking-lot/bandwidth/exp$i"
Working_DIR="$New_DIR/tcp-eval-results/parking-lot/bandwidth/exp$i"
break
fi
let "i=i+1"
done
# run a parameter change session
# params are changing variable, scope and output file.
run_a_session ( ) {
for tcp_var in TcpTahoe TcpReno TcpNewReno TcpWestwood TcpWestwoodPlus
do
for var in $1
do
./waf --run "drive-parking-lot --bottleneckBandwidth=$var --tcp_variant=$tcp_var --fileName=$Working_DIR/bandwidth.$tcp_var"
done
done
}
# dwaw an eps graph
# params are output_eps_filename, title, x_range, y_range, x_label, y_label, key, gnuplot_file, input_data_file, column_x, column_y
function draw_eps ( ) {
echo "set terminal postscript eps color
set output \"$1\"
set title \"$2\"
set xrange [$3:$4]
set yrange [$5:$6]
set xlabel \"$7\"
set logscale x
set ylabel \"$8\"
set key $9
set grid " >> ${10}
echo -n "plot " >>${10}
echo -n \'./${11}.TcpTahoe\' using ${12}:${13} title \'Tahoe\' with lp, >>${10}
echo -n \'./${11}.TcpReno\' using ${12}:${13} title \'Reno\' with lp, >>${10}
echo -n \'./${11}.TcpNewReno\' using ${12}:${13} title \'Newreno\' with lp, >>${10}
echo -n \'./${11}.TcpWestwood\' using ${12}:${13} title \'Westwood\' with lp, >>${10}
echo -n \'./${11}.TcpWestwoodPlus\' using ${12}:${13} title \'Westwood+\' with lp, >>${10}
gnuplot ${10}
}
# generate tex files
# params are section name, graph name.
function output_tex () {
echo "\documentclass[11pt]{article}
\usepackage{fullpage,latexsym,graphicx, subfigure}
\begin{document}
\title{The TCP Performance Comparison Results for Changing Bandwidth } \maketitle" >>myreport.tex
echo "\section{$1}
\begin{figure} [htbp]
\begin{center}
\includegraphics[width=2.5in]{utilization.eps}
\includegraphics[width=2.5in]{queueLength.eps}
\includegraphics[width=2.5in]{dropRate.eps}
\end{center}
\caption{Utilization, Queue length and Drop rate with $1} \label{$1}
\end{figure} " >> myreport.tex
}
# run a series of parking-lot simulations
run_a_session "1 3 5 7 10 15 20 30 60 100"
# all work done in Working_DIR
cd $Working_DIR
# draw the graph for bottleneck link utilization
draw_eps "utilization.eps" "Link Utilization with Bandwidth Changes" 1 "" 0 100 "Bandwidth (Mbps) Log Scale" "Link Utilization (%)" "right bottom" "utilization.gnuplot" "bandwidth" 1 4
# draw the graph for mean queue length
draw_eps "queueLength.eps" "Percent of Mean Queue Length with Bandwidth Changes" 1 "" 0 100 "Bandwidth (Mbps) Log Scale" "Mean Queue Length (%)" "right top" "queueLength.gnuplot" "bandwidth" 1 5
# draw the graph for packet drop rate
draw_eps "dropRate.eps" "Packet Drop Rate with Bandwidth Changes" 1 "" -1 9 "Bandwidth (Mbps) Log Scale" "Packet Drop Rate (%)" "right top" "dropRate.gnuplot" "bandwidth" 1 6
# generate a pdf file containing the resultant graphs
output_tex "Changing Bandwidth"
echo "\end{document}" >>myreport.tex
latex -no-file-line-error myreport.tex
dvipdf myreport.dvi