### Quantifying University Network Frustrations

I’m sitting in class frustrated as could be. The Internet in this room (D3-3 in the dental tower of Shands Hospital at UF) is unbelievably annoying. For some reason, everything runs fine, then functionality drops to unusable levels. Downloading files (i.e., PDFs of lectures) occurs at about 0.5kb/s (wow), and Internet browsing is hopeless. At most, I can connect to IRC and enjoy myself in #electronics, #python, and #linux. I decided to channel my frustration into productivity, and wrote a quick Python script to let me visualize the problem. Notice the massive lag spikes around the time class begins. I think it’s caused by the retarded behavior of windows update and anti-virus software updates being downloaded on a gazillion computers all at the same time which are required to connect to the network on Windows machines. Class start times were 8:30am, 9:35am, and 10:40am. Let’s view it on a logarithmic scale: Finally, the code. It’s two scripts. One pings a website (kernel.org) every few seconds and records the ping time to “pings.txt”, and the other graphs the data. Here are the two scripts:

```import socket, time, os, sys, re

def getping():
pingaling = os.popen("ping -q -c2 kernel.org")
sys.stdout.flush()
while 1:
if not line: break
line=line.split("n")
for part in line:
if "rtt" in part:
part=part.split(" = ")
part=part.split('/')
print part+"ms"
return part

f=open("pings.txt",'a')
f.write(stuff+",")
f.close()

while 1:
print "pinging...",
stuff="[%s,%s]"%(time.time(),getping())
print stuff
time.sleep(1)
```
```import pylab, time, datetime, numpy

def smoothTriangle(data,degree,dropVals=False):
triangle=numpy.array(range(degree)+[degree]+range(degree)[::-1])+1
smoothed=[]
for i in range(degree,len(data)-degree*2):
point=data[i:i+len(triangle)]*triangle
smoothed.append(sum(point)/sum(triangle))
if dropVals:
print "smoothlen:",len(smoothed)
return smoothed
#smoothed=[smoothed]*(degree+degree/2)+smoothed
#while len(smoothed)<len(data):smoothed.append(smoothed[-1])
while len(smoothed)<len(data):smoothed=[None]+smoothed+[None]
if len(smoothed)>len(data):smoothed.pop(-1)
return smoothed

f=open("pings.txt")
f.close()

xs,ys,big=[],[],[]
for item in raw:
t=datetime.datetime.fromtimestamp(item)
maxping=20000
if item>maxping or item==None:
item=maxping
big.append(t)
ys.append(float(item))
xs.append(t)

#print xs
#raw_input("WAIT")

print "plotting"
fig=pylab.figure(figsize=(10,7))
pylab.plot(xs,ys,'k.',alpha=.1)
pylab.plot(xs,ys,'k-',alpha=.1)
pylab.plot(xs,smoothTriangle(ys,15),'b-')
pylab.grid(alpha=.3)
pylab.axis([None,None,None,2000])
#pylab.semilogy()
#pylab.xlabel("time")
pylab.ylabel("latency (ping kernel.org, ms)")
pylab.title("D3-3 Network Responsiveness")
fig.autofmt_xdate()
#pylab.show()
pylab.savefig('out.png')
pylab.semilogy()
pylab.savefig('out2.png')
fig.autofmt_xdate()
print "done"
```