[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [metrics-web/master] Add resolution parameter to all graphs.
commit 5578187f04b09b255b9bcbc8c968d194832030c7
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Mon Jan 31 12:35:58 2011 +0100
Add resolution parameter to all graphs.
---
rserve/graphs.R | 45 ++++++++++----------
.../ernie/web/GraphParameterChecker.java | 22 +++++-----
web/WEB-INF/network.jsp | 42 ++++++++++++++++++
web/WEB-INF/packages.jsp | 6 +++
web/WEB-INF/performance.jsp | 18 ++++++++
5 files changed, 100 insertions(+), 33 deletions(-)
diff --git a/rserve/graphs.R b/rserve/graphs.R
index 3d0da80..e20e133 100644
--- a/rserve/graphs.R
+++ b/rserve/graphs.R
@@ -1,4 +1,4 @@
-plot_networksize <- function(start, end, path) {
+plot_networksize <- function(start, end, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
q <- paste("SELECT date, avg_running AS relays FROM network_size ",
@@ -36,10 +36,10 @@ plot_networksize <- function(start, end, path) {
scale_colour_hue("", breaks = c("relays", "bridges"),
labels = c("Relays", "Bridges")) +
opts(title = "Number of relays\n")
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_versions <- function(start, end, path) {
+plot_versions <- function(start, end, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
q <- paste("SELECT date, version, relays FROM relay_versions ",
@@ -64,10 +64,10 @@ plot_versions <- function(start, end, path) {
scale_colour_hue(name = "Tor version", h.start = 280,
breaks = visible_versions, labels = visible_versions) +
opts(title = "Relay versions\n")
- ggsave(filename = path, width = 8,height = 5,dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_platforms <- function(start, end, path) {
+plot_platforms <- function(start, end, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user=dbuser, password=dbpassword, dbname=db)
q <- paste("SELECT date, avg_linux, avg_darwin, avg_bsd, avg_windows, ",
@@ -90,10 +90,10 @@ plot_platforms <- function(start, end, path) {
"avg_other"),
labels = c("Linux", "Darwin", "FreeBSD", "Windows", "Other")) +
opts(title = "Relay platforms\n")
- ggsave(filename = path,width = 8,height = 5,dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_bandwidth <- function(start, end, path) {
+plot_bandwidth <- function(start, end, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
q <- paste("SELECT date, bwadvertised FROM total_bandwidth ",
@@ -122,10 +122,10 @@ plot_bandwidth <- function(start, end, path) {
breaks = c("bwadv", "bwhist"),
labels = c("Advertised bandwidth", "Bandwidth history")) +
opts(title = "Total relay bandwidth", legend.position = "top")
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_dirbytes <- function(start, end, path) {
+plot_dirbytes <- function(start, end, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
q <- paste("SELECT date, dr, dw, brp, bwp, brd, bwd FROM user_stats",
@@ -152,10 +152,10 @@ plot_dirbytes <- function(start, end, path) {
labels = c("Written dir bytes", "Read dir bytes")) +
opts(title = "Number of bytes spent on answering directory requests",
legend.position = "top")
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_relayflags <- function(start, end, flags, path) {
+plot_relayflags <- function(start, end, flags, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
columns <- paste("avg_", tolower(flags), sep = "", collapse = ", ")
@@ -180,10 +180,10 @@ plot_relayflags <- function(start, end, flags, path) {
scale_colour_hue(name = "Relay flags", h.start = 280,
breaks = paste("avg_", tolower(flags), sep = ""), labels = flags) +
opts(title = "Number of relays with relay flags assigned\n")
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_relayflags_hour <- function(start, end, flags, path) {
+plot_relayflags_hour <- function(start, end, flags, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
columns <- paste("avg_", tolower(flags), sep = "", collapse = ", ")
@@ -209,7 +209,7 @@ plot_relayflags_hour <- function(start, end, flags, path) {
scale_colour_hue(name = "Relay flags", h.start = 280,
breaks = paste("avg_", tolower(flags), sep = ""), labels = flags) +
opts(title = "Number of relays with relay flags assigned\n")
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
plot_direct_users <- function(start, end, country, path, dpi) {
@@ -311,7 +311,7 @@ plot_bridge_users <- function(start, end, country, path, dpi) {
ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_gettor <- function(start, end, bundle, path) {
+plot_gettor <- function(start, end, bundle, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
condition <- ifelse(bundle == "all", "<> 'none'",
@@ -341,10 +341,10 @@ plot_gettor <- function(start, end, bundle, path) {
scale_y_continuous(name = "", limits = c(0, max(downloads$downloads,
na.rm = TRUE))) +
opts(title = title)
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_torperf <- function(start, end, source, filesize, path) {
+plot_torperf <- function(start, end, source, filesize, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
q <- paste("SELECT date, q1, md, q3 FROM torperf_stats ",
@@ -384,10 +384,11 @@ plot_torperf <- function(start, end, source, filesize, path) {
values = paste(colour, c("", "66"), sep = "")) +
opts(title = paste("Time in seconds to complete", filesizeStr,
"request"), legend.position = "top")
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_torperf_failures <- function(start, end, source, filesize, path) {
+plot_torperf_failures <- function(start, end, source, filesize, path,
+ dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
q <- paste("SELECT date, timeouts, failures, requests ",
@@ -432,10 +433,10 @@ plot_torperf_failures <- function(start, end, source, filesize, path) {
labels = c("Timeouts", "Failures")) +
opts(title = paste("Timeouts and failures of", filesizeStr,
"requests"), legend.position = "top")
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
-plot_connbidirect <- function(start, end, path) {
+plot_connbidirect <- function(start, end, path, dpi) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = dbuser, password = dbpassword, dbname = db)
q <- paste("SELECT DATE(statsend) AS date, readnum, writenum, bothnum ",
@@ -459,7 +460,7 @@ plot_connbidirect <- function(start, end, path) {
"Both reading and writing")) +
opts(title = "Fraction of connections used uni-/bidirectionally",
legend.position = "top")
- ggsave(filename = path, width = 8, height = 5, dpi = 72)
+ ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
}
## TODO The bandwidth history shouldn't be based on the consensus weights
diff --git a/src/org/torproject/ernie/web/GraphParameterChecker.java b/src/org/torproject/ernie/web/GraphParameterChecker.java
index fe9bc3b..27f4956 100644
--- a/src/org/torproject/ernie/web/GraphParameterChecker.java
+++ b/src/org/torproject/ernie/web/GraphParameterChecker.java
@@ -39,24 +39,24 @@ public class GraphParameterChecker {
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
this.availableGraphs = new HashMap<String, String>();
- this.availableGraphs.put("networksize", "start,end,filename");
- this.availableGraphs.put("relayflags", "start,end,flag,filename");
+ this.availableGraphs.put("networksize", "start,end,filename,dpi");
+ this.availableGraphs.put("relayflags", "start,end,flag,filename,dpi");
this.availableGraphs.put("relayflags-hour",
- "start,end,flag,filename");
- this.availableGraphs.put("versions", "start,end,filename");
- this.availableGraphs.put("platforms", "start,end,filename");
- this.availableGraphs.put("bandwidth", "start,end,filename");
- this.availableGraphs.put("dirbytes", "start,end,filename");
+ "start,end,flag,filename,dpi");
+ this.availableGraphs.put("versions", "start,end,filename,dpi");
+ this.availableGraphs.put("platforms", "start,end,filename,dpi");
+ this.availableGraphs.put("bandwidth", "start,end,filename,dpi");
+ this.availableGraphs.put("dirbytes", "start,end,filename,dpi");
this.availableGraphs.put("direct-users",
"start,end,country,filename,dpi");
this.availableGraphs.put("bridge-users",
"start,end,country,filename,dpi");
- this.availableGraphs.put("gettor", "start,end,bundle,filename");
+ this.availableGraphs.put("gettor", "start,end,bundle,filename,dpi");
this.availableGraphs.put("torperf",
- "start,end,source,filesize,filename");
+ "start,end,source,filesize,filename,dpi");
this.availableGraphs.put("torperf-failures",
- "start,end,source,filesize,filename");
- this.availableGraphs.put("connbidirect", "start,end,filename");
+ "start,end,source,filesize,filename,dpi");
+ this.availableGraphs.put("connbidirect", "start,end,filename,dpi");
this.availableGraphs.put("routerdetail", "fingerprint,filename");
this.knownParameterValues = new HashMap<String, String>();
diff --git a/web/WEB-INF/network.jsp b/web/WEB-INF/network.jsp
index 91dcbc2..25e4125 100644
--- a/web/WEB-INF/network.jsp
+++ b/web/WEB-INF/network.jsp
@@ -31,6 +31,12 @@ bridges in the network.</p>
<input type="text" name="end" size="10"
value="${networksize_end[0]}">
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${networksize_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${networksize_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${networksize_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
@@ -64,6 +70,12 @@ average number of relays with these flags assigned.</p>
<input type="checkbox" name="flag" value="Guard"> Guard
<input type="checkbox" name="flag" value="Stable"> Stable
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${relayflags_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${relayflags_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${relayflags_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
@@ -96,6 +108,12 @@ available on 1-hour detail.</p>
<input type="checkbox" name="flag" value="Guard"> Guard
<input type="checkbox" name="flag" value="Stable"> Stable
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${relayflags_hour_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${relayflags_hour_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${relayflags_hour_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
@@ -122,6 +140,12 @@ version.</p>
<input type="text" name="end" size="10"
value="${versions_end[0]}">
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${versions_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${versions_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${versions_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
@@ -150,6 +174,12 @@ platform.</p>
<input type="text" name="end" size="10"
value="${platforms_end[0]}">
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${platforms_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${platforms_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${platforms_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
@@ -179,6 +209,12 @@ in the network.</p>
<input type="text" name="end" size="10"
value="${bandwidth_end[0]}">
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${bandwidth_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${bandwidth_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${bandwidth_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
@@ -207,6 +243,12 @@ the number of written and read dir bytes by all relays.</p>
<input type="text" name="end" size="10"
value="${dirbytes_end[0]}">
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${dirbytes_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${dirbytes_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${dirbytes_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
diff --git a/web/WEB-INF/packages.jsp b/web/WEB-INF/packages.jsp
index 8869155..bd8f756 100644
--- a/web/WEB-INF/packages.jsp
+++ b/web/WEB-INF/packages.jsp
@@ -38,6 +38,12 @@ graph shows the number of packages requested from GetTor per day.</p>
<input type="radio" name="bundle" value="zh_CN"> TBB (zh_CN)
<input type="radio" name="bundle" value="fa"> TBB (fa)
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${gettor_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${gettor_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${gettor_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
diff --git a/web/WEB-INF/performance.jsp b/web/WEB-INF/performance.jsp
index 921fd61..6793a08 100644
--- a/web/WEB-INF/performance.jsp
+++ b/web/WEB-INF/performance.jsp
@@ -44,6 +44,12 @@ quartile of request times.</p>
<input type="radio" name="filesize" value="1mb"> 1 MiB
<input type="radio" name="filesize" value="5mb"> 5 MiB
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${torperf_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${torperf_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${torperf_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
@@ -84,6 +90,12 @@ than 50 KiB (1 MiB, 5 MiB).</p>
<input type="radio" name="filesize" value="1mb"> 1 MiB
<input type="radio" name="filesize" value="5mb"> 5 MiB
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${torperf_failures_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${torperf_failures_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${torperf_failures_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>
@@ -118,6 +130,12 @@ classifying connections, read and write counters are reset for the next
<input type="text" name="end" size="10"
value="${connbidirect_end[0]}">
</p><p>
+ Resolution: <select name="dpi">
+ <option value="72"<c:if test="${connbidirect_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
+ <option value="150"<c:if test="${connbidirect_dpi[0] eq '150'}"> selected</c:if>>Print low - 1200x750</option>
+ <option value="300"<c:if test="${connbidirect_dpi[0] eq '300'}"> selected</c:if>>Print high - 2400x1500</option>
+ </select>
+ </p><p>
<input class="submit" type="submit" value="Update graph">
</p>
</div>