[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [metrics-web/master] Export list of platform strings of currently running relays.
Author: karsten <karsten@xxxxxxxxxxxx>
Date: Tue, 30 Nov 2010 09:32:57 +0100
Subject: Export list of platform strings of currently running relays.
Commit: 62695064fb1a2020b3351a154fa7112e6fe9de84
---
rserve/csv.R | 16 ++++++++++++++++
src/org/torproject/ernie/web/CsvServlet.java | 1 +
web/WEB-INF/network.jsp | 4 ++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/rserve/csv.R b/rserve/csv.R
index d54b58c..3df0561 100644
--- a/rserve/csv.R
+++ b/rserve/csv.R
@@ -28,6 +28,22 @@ export_versions <- function(path) {
write.csv(versions, path, quote = FALSE, row.names = FALSE)
}
+export_current_platform_strings <- function(path) {
+ drv <- dbDriver("PostgreSQL")
+ con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
+ q <- paste("SELECT platform FROM statusentry",
+ "JOIN descriptor ON statusentry.descriptor =",
+ "descriptor.descriptor WHERE validafter IN (",
+ "SELECT MAX(validafter) FROM statusentry)",
+ "ORDER BY platform DESC")
+ rs <- dbSendQuery(con, q)
+ platforms <- fetch(rs, n = -1)
+ dbDisconnect(con)
+ dbUnloadDriver(drv)
+ write.table(platforms, path, quote = FALSE, row.names = FALSE,
+ col.names = FALSE)
+}
+
export_platforms <- function(path) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
diff --git a/src/org/torproject/ernie/web/CsvServlet.java b/src/org/torproject/ernie/web/CsvServlet.java
index eff5bec..0c285e5 100644
--- a/src/org/torproject/ernie/web/CsvServlet.java
+++ b/src/org/torproject/ernie/web/CsvServlet.java
@@ -31,6 +31,7 @@ public class CsvServlet extends HttpServlet {
this.availableCsvFiles = new HashSet<String>();
this.availableCsvFiles.add("bandwidth");
this.availableCsvFiles.add("bridge-users");
+ this.availableCsvFiles.add("current-platform-strings");
this.availableCsvFiles.add("direct-users");
this.availableCsvFiles.add("dirbytes");
this.availableCsvFiles.add("gettor");
diff --git a/web/WEB-INF/network.jsp b/web/WEB-INF/network.jsp
index b154665..91dcbc2 100644
--- a/web/WEB-INF/network.jsp
+++ b/web/WEB-INF/network.jsp
@@ -127,6 +127,8 @@ version.</p>
</div>
</form>
<p><a href="csv/versions.csv">CSV</a> file containing all data.</p>
+<p><a href="csv/current-platform-strings.csv">CSV</a> file containing
+platform strings of currently running relays.</p>
<br>
<h3>Relays by platform</h3>
@@ -153,6 +155,8 @@ platform.</p>
</div>
</form>
<p><a href="csv/platforms.csv">CSV</a> file containing all data.</p>
+<p><a href="csv/current-platform-strings.csv">CSV</a> file containing
+platform strings of currently running relays.</p>
<br>
<h3>Total relay bandwidth in the network</h3>
--
1.7.1