[tor-commits] [metrics-tasks/master] Add a bash script to make graphs (#2394).

karsten at torproject.org karsten at torproject.org
Wed Nov 9 07:31:29 UTC 2011


commit abef2d21b1af690b55d745b4173da1740a2ffa14
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Nov 9 08:31:09 2011 +0100

    Add a bash script to make graphs (#2394).
---
 task-2394/README  |    6 ++++++
 task-2394/plot.sh |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/task-2394/README b/task-2394/README
index b58f1e8..dbf31fb 100644
--- a/task-2394/README
+++ b/task-2394/README
@@ -1,6 +1,12 @@
 Visualize self-reported vs. measured bandwidth of relays
 ========================================================
 
+You can either
+
+ - Run plot.sh.
+
+or run the steps manually:
+
  - Download a single consensus and all referenced votes and server
    descriptors from the metrics website, e.g.,
 
diff --git a/task-2394/plot.sh b/task-2394/plot.sh
new file mode 100755
index 0000000..d3744e0
--- /dev/null
+++ b/task-2394/plot.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+COMMONS="commons-codec-1.4.jar"
+CURRENT=`date -u +%Y-%m-%d-%H-00-00`
+
+if [ ! -f commons-codec-1.4.jar ]; then
+  echo "$COMMONS not found.  Please download Apache Commons Codec 1.4."
+  exit 1
+fi
+
+if [ ! -d descriptors ]; then
+  mkdir descriptors
+else
+  rm descriptors/*
+fi
+
+echo "Downloading descriptors from the metrics website..."
+curl https://metrics.torproject.org/votes?valid-after=$CURRENT \
+  > descriptors/$CURRENT-votes
+curl https://metrics.torproject.org/consensus?valid-after=$CURRENT \
+  > descriptors/$CURRENT-consensus
+curl https://metrics.torproject.org/serverdesc?valid-after=$CURRENT \
+  > descriptors/$CURRENT-serverdesc
+
+if [ ! -f ParseDescriptors.class ]; then
+  echo "Compiling..."
+  javac -cp commons-codec-1.4.jar ParseDescriptors.java
+fi
+
+echo "Parsing descriptors..."
+java -cp .:commons-codec-1.4.jar ParseDescriptors
+
+echo "Plotting..."
+R --slave -f bandwidth-comparison.R
+
+echo "Terminating.  Please find the .png files in this directory."
+



More information about the tor-commits mailing list