[or-cvs] r20273: {} Add R script to calculate expected bandwidth at each node (projects/performance/node-selection)

sjm217 at seul.org sjm217 at seul.org
Wed Aug 12 14:53:53 UTC 2009


Author: sjm217
Date: 2009-08-12 10:53:53 -0400 (Wed, 12 Aug 2009)
New Revision: 20273

Added:
   projects/performance/node-selection/marginal-bandwidth.R
Log:
Add R script to calculate expected bandwidth at each node

Added: projects/performance/node-selection/marginal-bandwidth.R
===================================================================
--- projects/performance/node-selection/marginal-bandwidth.R	                        (rev 0)
+++ projects/performance/node-selection/marginal-bandwidth.R	2009-08-12 14:53:53 UTC (rev 20273)
@@ -0,0 +1,33 @@
+## Load in data files
+tt <- read.table("opt_tor.pickle.dat", header=TRUE)
+
+## Node bandwidth
+bw <- tt$bw
+
+## Calculate network capcity
+capacity <- sum(bw)
+
+## Calculate selection probabilties
+torProb <- bw/capacity
+optProb <- tt$prob
+
+## Calculate bandwidth given to each user,
+##  assuming 1 million users
+torShare <- bw/(torProb*1e6)
+optShare <- bw/(optProb*1e6)
+
+## Output graph
+col <- rainbow(8)
+ylim <- range(c(torShare, optShare), finite=TRUE)
+pdf("marginal-bandwidth.pdf")
+plot(bw, torShare, ylim=ylim, ylab="Bandwidth per user (cells/s)",
+     log="y", type="l", xlab="Node bandwidth (cells/s)",
+     main="Comparison of bandwidth at each node,\nfor Tor and Optimized weighting algorithms",
+     frame.plot=FALSE, lwd=2)
+lines(bw, optShare, type="b", col=col[8])
+
+par(xpd=NA)
+text(x=rep(max(bw), 2), y=c(torShare[length(bw)], optShare[length(bw)]), pos=3, c("Tor", "Optimized"))
+
+## Close output device
+dev.off()



More information about the tor-commits mailing list