Measuring Effective Bandwidth

You can collect traces of network traffic from your computer using tcpdump or windump for Windows, the latter available at http://windump.polito.it/.
windump > traffic-log.txt
produces output like
traffic-log.txt
15:53:33.185845 holy.1639 > piquet.statslab.cam.ac.uk.22: P 3720086289:3720086309(20) ack 2559336644 win 16688 (DF)
15:53:33.191214 piquet.statslab.cam.ac.uk.22 > holy.1639: P 1:21(20) ack 20 win 6432 (DF) [tos 0x10]
15:53:33.295332 holy.1639 > piquet.statslab.cam.ac.uk.22: P 20:40(20) ack 21 win 16668 (DF)
15:53:33.301179 piquet.statslab.cam.ac.uk.22 > holy.1639: P 21:41(20) ack 40 win 6432 (DF) [tos 0x10]
15:53:33.392815 holy.1639 > piquet.statslab.cam.ac.uk.22: P 40:60(20) ack 41 win 16648 (DF)
15:53:33.401299 piquet.statslab.cam.ac.uk.22 > holy.1639: P 41:61(20) ack 60 win 6432 (DF) [tos 0x10]
15:53:33.506042 holy.1639 > piquet.statslab.cam.ac.uk.22: . ack 61 win 16628 (DF)
15:53:33.530759 holy.1639 > piquet.statslab.cam.ac.uk.22: P 60:80(20) ack 61 win 16628 (DF)
15:53:33.541416 piquet.statslab.cam.ac.uk.22 > holy.1639: P 61:81(20) ack 80 win 6432 (DF) [tos 0x10]
15:53:33.561430 piquet.statslab.cam.ac.uk.22 > holy.1639: P 81:173(92) ack 80 win 6432 (DF) [tos 0x10]
The timestamp and the packet size can be extracted using, for example, awk, available for Windows at http://cm.bell-labs.com/cm/cs/awkbook/index.html. The following awk script
extract.awk
BEGIN { 
  OFMT = "%.17f"
  print "Time","Bytes"
  }
{ 
where = match($6,/\([^\)]*/)
if (where)
  {
  len = substr($6,RSTART+1,RLENGTH-1)
  split($1,atime,":")
  hour=atime[1]+0
  min=atime[2]+0
  sec=atime[3]
  split(sec,asec,".")
  print (hour*60+min)*60+sec, len
  }
}
invoked by
awk -f extract.awk traffic-log.txt > traffic-data.txt
extracts this information. It can be analysed using R, available at http://www.r-project.org. The following functions may be useful.
eb.R
its.to.ts <- function(times,values,delta=1) {
  m <- min(times)
  M <- max(times)
  mm <- delta*floor(m/delta)
  MM <- delta*ceiling(M/delta)
  cuts <- seq(from=mm,to=MM,by=delta)
  nullvals <- rep(0,length(cuts)-1)
  nulltimes <- cuts[-1]-delta/2
  time.factor <- cut(c(times,nulltimes),cuts,labels=FALSE)
  dd <- aggregate(c(values,nullvals),by=list(time=time.factor),sum)
  ts(data=dd$x,start=mm,deltat=delta)
  }

partial.sums <- function(x,t)
  {
  n <- length(x)-t+1
  s <- x[1:n]
  if (t>1) for (i in 1:(t-1)) s <- s + x[1:n+i]
  s
  }

cgf.emp <- function(x,theta) {
  log(mean(exp(theta*x)))
  }

eb <- function(x,theta=0,t) {
  d <- deltat(x)
  tt <- ceiling(t/d)
  if (theta==0)
    mean(x)/d
  else
    cgf.emp(partial.sums(x,tt),theta=theta)/(theta*t)
  }
The following commands show some analysis.
# Read the functions defined above
source("eb.R")

# Read the traffic data, as a data frame
traffic.full <- read.table("traffic-data.txt",header=TRUE)
# Convert to a time series, sampling every 0.1s
traffic <- its.to.ts(traffic.full$Time,(traffic.full$Bytes+20)/1024,delta=.1)

plot(arrivals)
# Select a stationary-looking part of the data
tr1 <- window(traffic,start=57500,end=58000)

th <- seq(from=0,to=1,by=0.02)
ebs <- sapply(th, function(th) eb(tr1,th,10)) # 10~Inf!
xyplot(ebs ~ th)
Trace of the traffic process
Plot of effective bandwidth