[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-web/master] Update paths in R files.
commit 989f50f69f1e5273a2a6dbc4c50a96aaf6f267b9
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Wed Jan 22 12:55:59 2014 +0100
Update paths in R files.
---
website/rserve/csv.R | 64 +++++++++++++++++++++++------------------------
website/rserve/graphs.R | 64 +++++++++++++++++++++++------------------------
website/rserve/tables.R | 8 +++---
3 files changed, 68 insertions(+), 68 deletions(-)
diff --git a/website/rserve/csv.R b/website/rserve/csv.R
index 2ec6e7b..e2a2172 100644
--- a/website/rserve/csv.R
+++ b/website/rserve/csv.R
@@ -1,8 +1,8 @@
options(scipen = 15)
export_networksize <- function(path) {
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$flag == '' & s$country == '' & s$version == '' &
s$platform == '' & s$ec2bridge == '',
c("date", "relays", "bridges")]
@@ -10,8 +10,8 @@ export_networksize <- function(path) {
}
export_cloudbridges <- function(path) {
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$flag == '' & s$country == '' & s$version == '' &
s$platform == '' & s$ec2bridge == 't', ]
cloudbridges <- data.frame(date = s$date, cloudbridges = s$bridges)
@@ -19,8 +19,8 @@ export_cloudbridges <- function(path) {
}
export_relaycountries <- function(path) {
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$flag == '' & s$country != '' & s$version == '' &
s$platform == '' & s$ec2bridge == '',
c("date", "country", "relays")]
@@ -28,8 +28,8 @@ export_relaycountries <- function(path) {
}
export_versions <- function(path) {
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$flag == '' & s$country == '' & s$version != '' &
s$platform == '' & s$ec2bridge == '',
c("date", "version", "relays")]
@@ -39,8 +39,8 @@ export_versions <- function(path) {
}
export_platforms <- function(path) {
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$flag == '' & s$country == '' & s$version == '' &
s$platform != '' & s$ec2bridge == '',
c("date", "platform", "relays")]
@@ -53,8 +53,8 @@ export_platforms <- function(path) {
}
export_bandwidth <- function(path) {
- b <- read.csv("/srv/metrics.torproject.org/web/stats/bandwidth.csv",
- stringsAsFactors = FALSE)
+ b <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "bandwidth.csv", sep = ""), stringsAsFactors = FALSE)
b <- b[b$isexit == '' & b$isguard == '', ]
b <- data.frame(date = as.Date(b$date, "%Y-%m-%d"),
bwadv = b$advbw,
@@ -64,8 +64,8 @@ export_bandwidth <- function(path) {
}
export_bwhist_flags <- function(path) {
- b <- read.csv("/srv/metrics.torproject.org/web/stats/bandwidth.csv",
- stringsAsFactors = FALSE)
+ b <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "bandwidth.csv", sep = ""), stringsAsFactors = FALSE)
b <- b[b$isexit != '' & b$isguard != '' & !is.na(b$bwread) &
!is.na(b$bwwrite), ]
b <- data.frame(date = as.Date(b$date, "%Y-%m-%d"),
@@ -75,8 +75,8 @@ export_bwhist_flags <- function(path) {
}
export_dirbytes <- function(path) {
- b <- read.csv("/srv/metrics.torproject.org/web/stats/bandwidth.csv",
- stringsAsFactors = FALSE)
+ b <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "bandwidth.csv", sep = ""), stringsAsFactors = FALSE)
b <- b[b$isexit == '' & b$isguard == '' & !is.na(b$dirread) &
!is.na(b$dirwrite), ]
b <- data.frame(date = as.Date(b$date, "%Y-%m-%d"),
@@ -86,8 +86,8 @@ export_dirbytes <- function(path) {
}
export_relayflags <- function(path) {
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$country == '' & s$version == '' & s$platform == '' &
s$ec2bridge == '', ]
s <- data.frame(date = as.Date(s$date, "%Y-%m-%d"),
@@ -99,8 +99,8 @@ export_relayflags <- function(path) {
}
export_torperf <- function(path) {
- t <- read.csv("/srv/metrics.torproject.org/web/stats/torperf.csv",
- stringsAsFactors = FALSE)
+ t <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "torperf.csv", sep = ""), stringsAsFactors = FALSE)
t <- data.frame(
source = paste(ifelse(t$source == '', 'all', t$source),
ifelse(t$size == 50 * 1024, '50kb',
@@ -113,8 +113,8 @@ export_torperf <- function(path) {
}
export_torperf_failures <- function(path) {
- t <- read.csv("/srv/metrics.torproject.org/web/stats/torperf.csv",
- stringsAsFactors = FALSE)
+ t <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "torperf.csv", sep = ""), stringsAsFactors = FALSE)
t <- data.frame(
source = paste(ifelse(t$source == '', 'all', t$source),
ifelse(t$size == 50 * 1024, '50kb',
@@ -127,15 +127,15 @@ export_torperf_failures <- function(path) {
}
export_connbidirect <- function(path) {
- c <- read.csv("/srv/metrics.torproject.org/web/stats/connbidirect.csv",
- stringsAsFactors = FALSE)
+ c <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "connbidirect.csv", sep = ""), stringsAsFactors = FALSE)
write.csv(format(c, trim = TRUE, scientific = FALSE), path,
quote = FALSE, row.names = FALSE)
}
export_bandwidth_flags <- function(path) {
- b <- read.csv("/srv/metrics.torproject.org/web/stats/bandwidth.csv",
- stringsAsFactors = FALSE)
+ b <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "bandwidth.csv", sep = ""), stringsAsFactors = FALSE)
b <- b[b$isexit != '' & b$isguard != '', ]
b <- data.frame(date = as.Date(b$date, "%Y-%m-%d"),
isexit = b$isexit == 't', isguard = b$isguard == 't',
@@ -157,8 +157,8 @@ export_bandwidth_flags <- function(path) {
}
export_userstats <- function(path) {
- c <- read.csv("/srv/metrics.torproject.org/web/stats/clients.csv",
- stringsAsFactors = FALSE)
+ c <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "clients.csv", sep = ""), stringsAsFactors = FALSE)
c <- data.frame(date = c$date, node = c$node, country = c$country,
transport = c$transport, version = c$version,
frac = c$frac, users = c$clients)
@@ -167,8 +167,8 @@ export_userstats <- function(path) {
}
help_export_monthly_userstats <- function(path, aggr_fun) {
- c <- read.csv("/srv/metrics.torproject.org/web/stats/clients.csv",
- stringsAsFactors = FALSE)
+ c <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "clients.csv", sep = ""), stringsAsFactors = FALSE)
c <- c[c$country != '' & c$transport == '' & c$version == '', ]
u <- data.frame(date = c$date, country = c$country, users = c$clients,
stringsAsFactors = FALSE)
@@ -195,8 +195,8 @@ export_monthly_userstats_average <- function(path) {
}
export_userstats_detector <- function(path) {
- c <- read.csv("/srv/metrics.torproject.org/web/stats/clients.csv",
- stringsAsFactors = FALSE)
+ c <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "clients.csv", sep = ""), stringsAsFactors = FALSE)
c <- c[c$country != '' & c$transport == '' & c$version == '' &
c$node == 'relay', ]
u <- data.frame(country = c$country, date = c$date, users = c$clients,
diff --git a/website/rserve/graphs.R b/website/rserve/graphs.R
index c4170e7..614bcea 100644
--- a/website/rserve/graphs.R
+++ b/website/rserve/graphs.R
@@ -268,8 +268,8 @@ date_breaks <- function(days) {
plot_networksize <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 2))
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$date >= start & s$date <= end & s$flag == '' &
s$country == '' & s$version == '' & s$platform == '' &
s$ec2bridge == '', ]
@@ -302,8 +302,8 @@ plot_networksize <- function(start, end, path) {
plot_cloudbridges <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 2))
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$date >= start & s$date <= end & s$flag == '' &
s$country == '' & s$version == '' & s$platform == '' &
s$ec2bridge == 't', ]
@@ -332,8 +332,8 @@ plot_cloudbridges <- function(start, end, path) {
plot_relaycountries <- function(start, end, country, path) {
end <- min(end, as.character(Sys.Date() - 2))
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$date >= start & s$date <= end & s$flag == '' &
s$country == ifelse(country == "all", '', country) &
s$version == '' & s$platform == '' & s$ec2bridge == '', ]
@@ -366,8 +366,8 @@ plot_relaycountries <- function(start, end, country, path) {
plot_versions <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 2))
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$date >= start & s$date <= end & s$flag == '' &
s$country == '' & s$version != '' & s$platform == '' &
s$ec2bridge == '', ]
@@ -401,8 +401,8 @@ plot_versions <- function(start, end, path) {
plot_platforms <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 2))
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$date >= start & s$date <= end & s$flag == '' &
s$country == '' & s$version == '' & s$platform != '' &
s$ec2bridge == '', ]
@@ -429,8 +429,8 @@ plot_platforms <- function(start, end, path) {
plot_bandwidth <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 4))
- b <- read.csv("/srv/metrics.torproject.org/web/stats/bandwidth.csv",
- stringsAsFactors = FALSE)
+ b <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "bandwidth.csv", sep = ""), stringsAsFactors = FALSE)
b <- b[b$date >= start & b$date <= end & b$isexit == '' &
b$isguard == '', ]
b <- data.frame(date = as.Date(b$date, "%Y-%m-%d"),
@@ -458,8 +458,8 @@ plot_bandwidth <- function(start, end, path) {
plot_bwhist_flags <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 4))
- b <- read.csv("/srv/metrics.torproject.org/web/stats/bandwidth.csv",
- stringsAsFactors = FALSE)
+ b <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "bandwidth.csv", sep = ""), stringsAsFactors = FALSE)
b <- b[b$date >= start & b$date <= end & b$isexit != '' &
b$isguard != '', ]
bw <- data.frame(date = as.Date(b$date, "%Y-%m-%d"),
@@ -503,8 +503,8 @@ plot_bwhist_flags <- function(start, end, path) {
plot_dirbytes <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 4))
- b <- read.csv("/srv/metrics.torproject.org/web/stats/bandwidth.csv",
- stringsAsFactors = FALSE)
+ b <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "bandwidth.csv", sep = ""), stringsAsFactors = FALSE)
b <- b[b$date >= start & b$date <= end & b$isexit == '' &
b$isguard == '', ]
b <- data.frame(date = as.Date(b$date, "%Y-%m-%d"),
@@ -532,8 +532,8 @@ plot_dirbytes <- function(start, end, path) {
plot_relayflags <- function(start, end, flags, path) {
end <- min(end, as.character(Sys.Date() - 2))
- s <- read.csv("/srv/metrics.torproject.org/web/stats/servers.csv",
- stringsAsFactors = FALSE)
+ s <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "servers.csv", sep = ""), stringsAsFactors = FALSE)
s <- s[s$date >= start & s$date <= end & s$country == '' &
s$version == '' & s$platform == '' & s$ec2bridge == '', ]
s <- data.frame(date = as.Date(s$date, "%Y-%m-%d"),
@@ -574,8 +574,8 @@ plot_torperf <- function(start, end, source, filesize, path) {
end <- min(end, as.character(Sys.Date() - 2))
size <- ifelse(filesize == '50kb', 50 * 1024,
ifelse(filesize == '1mb', 1024 * 1024, 5 * 1024 * 1024))
- t <- read.csv("/srv/metrics.torproject.org/web/stats/torperf.csv",
- stringsAsFactors = FALSE)
+ t <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "torperf.csv", sep = ""), stringsAsFactors = FALSE)
t <- t[t$date >= start & t$date <= end & t$size == size &
t$source == ifelse(source == 'all', '', source), ]
torperf <- data.frame(date = as.Date(t$date, "%Y-%m-%d"),
@@ -622,8 +622,8 @@ plot_torperf_failures <- function(start, end, source, filesize, path) {
end <- min(end, as.character(Sys.Date() - 2))
size <- ifelse(filesize == '50kb', 50 * 1024,
ifelse(filesize == '1mb', 1024 * 1024, 5 * 1024 * 1024))
- t <- read.csv("/srv/metrics.torproject.org/web/stats/torperf.csv",
- stringsAsFactors = FALSE)
+ t <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "torperf.csv", sep = ""), stringsAsFactors = FALSE)
t <- t[t$date >= start & t$date <= end & t$size == size &
t$source == ifelse(source == 'all', '', source), ]
torperf <- data.frame(date = as.Date(t$date, "%Y-%m-%d"),
@@ -673,8 +673,8 @@ plot_torperf_failures <- function(start, end, source, filesize, path) {
plot_connbidirect <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 2))
- c <- read.csv("/srv/metrics.torproject.org/web/stats/connbidirect.csv",
- stringsAsFactors = FALSE)
+ c <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "connbidirect.csv", sep = ""), stringsAsFactors = FALSE)
c <- c[c$date >= start & c$date <= end &
c$read + c$write + c$both > 0, ]
c <- data.frame(date = as.Date(c$date, "%Y-%m-%d"),
@@ -717,8 +717,8 @@ plot_connbidirect <- function(start, end, path) {
}
plot_fast_exits <- function(start, end, path) {
- f <- read.csv("/srv/metrics.torproject.org/web/stats/fast-exits.csv",
- stringsAsFactors = FALSE)
+ f <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "fast-exits.csv", sep = ""), stringsAsFactors = FALSE)
f <- f[f$date >= start & f$date <= end, ]
f <- data.frame(date = as.Date(f$date, "%Y-%m-%d"),
relays = f$fastnum, P_exit = f$fastprob)
@@ -739,8 +739,8 @@ plot_fast_exits <- function(start, end, path) {
}
plot_almost_fast_exits <- function(start, end, path) {
- f <- read.csv("/srv/metrics.torproject.org/web/stats/fast-exits.csv",
- stringsAsFactors = FALSE)
+ f <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "fast-exits.csv", sep = ""), stringsAsFactors = FALSE)
f <- f[f$date >= start & f$date <= end, ]
f <- melt(f, id.vars = c("date"))
t <- data.frame(date = as.Date(f$date, "%Y-%m-%d"),
@@ -766,8 +766,8 @@ plot_almost_fast_exits <- function(start, end, path) {
plot_bandwidth_flags <- function(start, end, path) {
end <- min(end, as.character(Sys.Date() - 4))
- b <- read.csv("/srv/metrics.torproject.org/web/stats/bandwidth.csv",
- stringsAsFactors = FALSE)
+ b <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "bandwidth.csv", sep = ""), stringsAsFactors = FALSE)
b <- b[b$date >= start & b$date <= end & b$isexit != '' &
b$isguard != '', ]
b <- data.frame(date = as.Date(b$date, "%Y-%m-%d"),
@@ -830,8 +830,8 @@ plot_bandwidth_flags <- function(start, end, path) {
plot_userstats <- function(start, end, node, variable, value, events,
path) {
end <- min(end, as.character(Sys.Date() - 2))
- c <- read.csv("/srv/metrics.torproject.org/web/stats/clients.csv",
- stringsAsFactors = FALSE)
+ c <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "clients.csv", sep = ""), stringsAsFactors = FALSE)
u <- c[c$date >= start & c$date <= end, ]
if (node == 'relay') {
if (value != 'all') {
diff --git a/website/rserve/tables.R b/website/rserve/tables.R
index 091a4de..3e5fcb4 100644
--- a/website/rserve/tables.R
+++ b/website/rserve/tables.R
@@ -4,8 +4,8 @@ countrynames <- function(countries) {
write_userstats <- function(start, end, node, path) {
end <- min(end, as.character(Sys.Date()))
- c <- read.csv("/srv/metrics.torproject.org/web/stats/clients.csv",
- stringsAsFactors = FALSE)
+ c <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "clients.csv", sep = ""), stringsAsFactors = FALSE)
c <- c[c$date >= start & c$date <= end & c$country != '' &
c$transport == '' & c$version == '' & c$node == node, ]
u <- data.frame(country = c$country, users = c$clients,
@@ -34,8 +34,8 @@ write_userstats_bridge <- function(start, end, path) {
write_userstats_censorship_events <- function(start, end, path) {
end <- min(end, as.character(Sys.Date()))
- c <- read.csv("/srv/metrics.torproject.org/web/stats/clients.csv",
- stringsAsFactors = FALSE)
+ c <- read.csv(paste("/srv/metrics.torproject.org/web/shared/stats/",
+ "clients.csv", sep = ""), stringsAsFactors = FALSE)
c <- c[c$date >= start & c$date <= end & c$country != '' &
c$transport == '' & c$version == '' & c$node == 'relay', ]
r <- data.frame(date = c$date, country = c$country,
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits