Commit 846b796c authored by Jonathon Duerig's avatar Jonathon Duerig

Bug fix for measuring abw. Various bug fixes for displaying TCP_TRACE compatible control data.

parent d174b055
......@@ -233,7 +233,7 @@ int main(int argc, char **argv) {
clientfd = accept(sockfd, (struct sockaddr*)&clientaddr, &clientlen);
if (clientfd) {
fprintf(stderr,"A new client connected\n");
// fprintf(stderr,"A new client connected\n");
FD_SET(clientfd,&real_fdset);
sock_types[clientfd] = DATA;
......@@ -259,7 +259,7 @@ int main(int argc, char **argv) {
&clientlen);
if (clientfd) {
fprintf(stderr,"A new client connected to the control socket\n");
// fprintf(stderr,"A new client connected to the control socket\n");
FD_SET(clientfd,&real_fdset);
sock_types[clientfd] = CONTROL;
......
......@@ -42,6 +42,7 @@ def main_loop():
quanta = 0.5# in seconds
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sys.stdout.write("stub_ip is %s\n" % stub_ip)
sys.stdout.flush()
conn.connect((stub_ip, 4200))
poll = select.poll()
poll.register(sys.stdin, select.POLLIN)
......@@ -206,13 +207,17 @@ def receive_characteristic(conn):
def set_bandwidth(kbps, dest):
# sys.stdout.write('<event> bandwidth=' + str(kbps) + '\n')
now = time.time()
sys.stderr.write('BANDWIDTH!purple\n')
sys.stderr.write('BANDWIDTH!line ' + ('%0.6f' % now) + ' 0 ' + ('%0.6f' % now)
+ ' ' + str(kbps) + '\n')
return set_link(this_ip, dest, 'bandwidth=' + str(kbps))
# Set delay on the link. We are given round trip time.
def set_delay(milliseconds, dest):
now = time.time()
sys.stderr.write('purple\n')
sys.stderr.write('line ' + ('%0.6f' % now) + ' 0 ' + ('%0.6f' % now)
sys.stderr.write('RTT!orange\n')
sys.stderr.write('RTT!line ' + ('%0.6f' % now) + ' 0 ' + ('%0.6f' % now)
+ ' ' + str(milliseconds) + '\n')
# Set the delay from here to there to 1/2 rtt.
error = set_link(this_ip, dest, 'delay=' + str(milliseconds/2))
......
......@@ -34,4 +34,5 @@ echo "Generating IP mapping file into $IPMAP";
$PERL ${MONITOR_DIR}/$GENIPMAP > $IPMAP
echo "Starting up monitor for $PROJECT/$EXPERIMENT $PELAB_IP $SIP";
exec $NETMON_DIR/$NETMOND -v 2 | $PYTHON $MONITOR_DIR/$MONITOR $IPMAP $PROJECT/$EXPERIMENT $PELAB_IP $SIP
#exec $NETMON_DIR/$NETMOND -v 2 | $PYTHON $MONITOR_DIR/$MONITOR $IPMAP $PROJECT/$EXPERIMENT $PELAB_IP $SIP
exec $NETMON_DIR/$NETMOND -v 2 | $PYTHON $MONITOR_DIR/$MONITOR ip-mapping.txt $PROJECT/$EXPERIMENT $PELAB_IP $SIP
......@@ -10,3 +10,8 @@
#/usr/testbed/bin/tevc -e tbres/pelab now planetc-planet1 modify dest=10.1.0.1 bandwidth=10000
#/usr/testbed/bin/tevc -e tbres/pelab now planetc-planet0 modify dest=10.1.0.2 lpr=0.0
#/usr/testbed/bin/tevc -e tbres/pelab now planetc-planet1 modify dest=10.1.0.1 lpr=0.0
/usr/testbed/bin/tevc -e tbres/pelab now rlink-router0 modify dest=10.4.0.1 delay=$1
/usr/testbed/bin/tevc -e tbres/pelab now rlink-router1 modify dest=10.1.0.1 delay=$1
/usr/testbed/bin/tevc -e tbres/pelab now rlink-router0 modify dest=10.4.0.1 bandwidth=$2
/usr/testbed/bin/tevc -e tbres/pelab now rlink-router1 modify dest=10.1.0.1 bandwidth=$2
......@@ -291,11 +291,11 @@ void reconnect_receiver(int index)
perror("connect");
clean_exit(1);
}
int send_buf_size = 0;
int int_size = sizeof(send_buf_size);
getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &send_buf_size,
(socklen_t*)&int_size);
fprintf(stderr, "Socket buffer size: %d\n", send_buf_size);
// int send_buf_size = 0;
// int int_size = sizeof(send_buf_size);
// getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &send_buf_size,
// (socklen_t*)&int_size);
// fprintf(stderr, "Socket buffer size: %d\n", send_buf_size);
struct sockaddr_in source_addr;
socklen_t len = sizeof(source_addr);
......
......@@ -473,32 +473,34 @@ u_int16_t handle_IP(u_char *args, const struct pcap_pkthdr* pkthdr, const u_char
}
if (is_live && delay_count[path_id] > 0)
{
int info_size = sizeof(info);
int error = getsockopt(rcvdb[path_id].sockfd,
SOL_TCP, TCP_INFO, &info,
&info_size);
if (error == -1)
{
perror("getsockopt() TCP_INFO");
clean_exit(1);
}
bandwidth = (info.tcpi_snd_cwnd * info.tcpi_snd_mss)
/ base_rtt[path_id];
if (bandwidth > max_throughput[path_id])
{
max_throughput[path_id] = bandwidth;
}
goodput = throughputTick(&throughput[path_id]);
logWrite(DELAY_DETAIL, NULL, "Goodput: %d", goodput);
logWrite(DELAY_DETAIL, NULL, "Throughput: %lu", bandwidth);
logWrite(DELAY_DETAIL, NULL, "Congestion Window Size: %lu",
info.tcpi_snd_cwnd);
logWrite(DELAY_DETAIL, NULL, "Sending MSS: %lu",
info.tcpi_snd_mss);
logWrite(DELAY_DETAIL, NULL, "Base RTT: %lu",
base_rtt[path_id]);
}
//append_delay_sample(path_id, delay, &(pkthdr->ts));
int info_size = sizeof(info);
int error = getsockopt(rcvdb[path_id].sockfd,
SOL_TCP, TCP_INFO, &info,
&info_size);
if (error == -1)
{
perror("getsockopt() TCP_INFO");
clean_exit(1);
}
bandwidth = (info.tcpi_snd_cwnd * info.tcpi_snd_mss * 8)
/ base_rtt[path_id];
if (bandwidth > max_throughput[path_id])
{
max_throughput[path_id] = bandwidth;
}
goodput = throughputTick(&throughput[path_id]);
logWrite(DELAY_DETAIL, NULL, "Goodput: %d", goodput);
logWrite(DELAY_DETAIL, NULL, "Throughput: %lu", bandwidth);
logWrite(DELAY_DETAIL, NULL, "Congestion Window Size: %lu",
info.tcpi_snd_cwnd);
logWrite(DELAY_DETAIL, NULL, "Sending MSS: %lu bytes",
info.tcpi_snd_mss);
logWrite(DELAY_DETAIL, NULL, "Base RTT: %lu",
base_rtt[path_id]);
logWrite(DELAY_DETAIL, NULL, "Receive Window: %lu",
tp->window);
}
// append_delay_sample(path_id, delay, &(pkthdr->ts));
logWrite(DELAY_DETAIL, &(pkthdr->ts),
"Delay: %lu, Sum: %lu, Count: %lu", delay,
delays[path_id], delay_count[path_id]);
......
......@@ -570,22 +570,22 @@ int send_delay_to_monitor(int monitor, int index)
unsigned long delay = 0;
unsigned long tmpulong;
delay = delays[index];
if (delay_count[index] > 0)
{
delay /= delay_count[index];
}
else
// delay = delays[index];
// if (delay_count[index] > 0)
// {
// delay /= delay_count[index];
// }
// else
// {
// delay = last_delays[index];
// }
delay = base_rtt[index];
if (delay_count[index] == 0)
{
delay = last_delays[index];
}
// delay = base_rtt[index];
// if (delay_count[index] == 0)
//{
// delay = 0;
//}
// If measurement changed since last send
// if (abs((long)delays[index] - (long)last_delays[index])
// > (long)(last_delays[index]/5)) {
......@@ -620,18 +620,18 @@ int send_delay_to_monitor(int monitor, int index)
gettimeofday(&now, NULL);
if (earlier.tv_sec != 0)
{
logWrite(TCPTRACE_SEND, NULL, "orange");
logWrite(TCPTRACE_SEND, NULL, "line %d%.6f %d %d%.6f %d",
earlier.tv_sec, earlier.tv_usec/1000000000.0,
logWrite(TCPTRACE_SEND, NULL, "RTT!orange");
logWrite(TCPTRACE_SEND, NULL, "RTT!line %.6f %d %.6f %d",
earlier.tv_sec + earlier.tv_usec/1000000000.0,
last_delays[index],
now.tv_sec, now.tv_usec/1000000000.0,
now.tv_sec + now.tv_usec/1000000000.0,
last_delays[index]);
}
logWrite(TCPTRACE_SEND, NULL, "orange");
logWrite(TCPTRACE_SEND, NULL, "line %d%.6f %d %d%.6f %d",
now.tv_sec, now.tv_usec/1000000000.0,
logWrite(TCPTRACE_SEND, NULL, "RTT!orange");
logWrite(TCPTRACE_SEND, NULL, "RTT!line %.6f %d %.6f %d",
now.tv_sec + now.tv_usec/1000000000.0,
last_delays[index],
now.tv_sec, now.tv_usec/1000000000.0,
now.tv_sec + now.tv_usec/1000000000.0,
delay);
earlier = now;
}
......@@ -640,7 +640,7 @@ int send_delay_to_monitor(int monitor, int index)
last_delays[index] = delay;
delays[index] = 0;
delay_count[index] = 0;
// base_rtt[index] = LONG_MAX;
base_rtt[index] = LONG_MAX;
return 1;
}
......@@ -650,8 +650,8 @@ int send_bandwidth_to_monitor(int monitor, int index)
int buffer_size = 3*SIZEOF_LONG + 2*sizeof(unsigned short);
char outbuf[buffer_size];
unsigned long code = htonl(CODE_BANDWIDTH);
unsigned long bandwidth = throughputTick(&throughput[index]);
//unsigned long bandwidth = max_throughput[index];
//unsigned long bandwidth = throughputTick(&throughput[index]);
unsigned long bandwidth = max_throughput[index];
if (bandwidth != 0) {
// Insert the address info
......@@ -679,11 +679,11 @@ int send_bandwidth_to_monitor(int monitor, int index)
struct timeval now;
unsigned long hostBand = ntohl(bandwidth);
gettimeofday(&now, NULL);
logWrite(TCPTRACE_SEND, NULL, "purple");
logWrite(TCPTRACE_SEND, NULL, "line %d%.6f %d %d%.6f %d",
now.tv_sec, now.tv_usec/1000000000.0,
logWrite(TCPTRACE_SEND, NULL, "BANDWIDTH!purple");
logWrite(TCPTRACE_SEND, NULL, "BANDWIDTH!line %.6f %d %.6f %d",
now.tv_sec + now.tv_usec/1000000000.0,
0,
now.tv_sec, now.tv_usec/1000000000.0,
now.tv_sec + now.tv_usec/1000000000.0,
hostBand);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment