[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-web/master] Support Torperf's new .data format, too.
commit bb0e124a8e8c32bf6c4481a4f0d642fb2260f25f
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Wed Mar 16 15:30:03 2011 +0100
Support Torperf's new .data format, too.
Torperf's new .data format has a 21st column that says whether the run
timeout out or not. At the same time, the timestamp in columns 17 and 18
(datacompletesec and datacompleteusec) is set even in the timeout case.
We now support both .data formats (even in a single file) by checking how
many columns a row has and detecting timeouts accordingly.
---
.../torproject/ernie/cron/TorperfProcessor.java | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/org/torproject/ernie/cron/TorperfProcessor.java b/src/org/torproject/ernie/cron/TorperfProcessor.java
index 1883e9c..7caccf6 100644
--- a/src/org/torproject/ernie/cron/TorperfProcessor.java
+++ b/src/org/torproject/ernie/cron/TorperfProcessor.java
@@ -86,7 +86,7 @@ public class TorperfProcessor {
while ((line = br.readLine()) != null) {
String[] parts = line.split(" ");
// remove defective lines as they occurred on gabelmoo
- if (parts.length == 20 && parts[0].length() == 10) {
+ if (parts.length >= 20 && parts[0].length() == 10) {
long startSec = Long.parseLong(parts[0]);
String dateTime = formatter.format(startSec * 1000L);
long completeMillis = Long.parseLong(parts[16])
@@ -95,7 +95,8 @@ public class TorperfProcessor {
+ Long.parseLong(parts[1]) / 1000L;
String key = source + "," + dateTime;
String value = key;
- if (parts[16].equals("0")) {
+ if ((parts.length == 20 && parts[16].equals("0")) ||
+ (parts.length == 21 && parts[20].equals("1"))) {
value += ",-2"; // -2 for timeout
} else if (Long.parseLong(parts[19]) < receivedBytes) {
value += ",-1"; // -1 for failure
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits