[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [metrics-db/master] Remove even more unfinished torperf runs.



Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Wed, 1 Sep 2010 08:22:43 +0200
Subject: Remove even more unfinished torperf runs.
Commit: 58ed13f5f3ee348ce7ad10dd4b928848140d684b

We were removing torperf runs with last timestamp set to 0, but we didn't
look at the received bytes. When excluding all runs with fewer bytes than
the requested file size, we remove another 0.236 % of all runs. Not a huge
deal, but let's be precise if we can.
---
 src/org/torproject/ernie/db/TorperfProcessor.java |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/org/torproject/ernie/db/TorperfProcessor.java b/src/org/torproject/ernie/db/TorperfProcessor.java
index b8dfd66..6b4f633 100644
--- a/src/org/torproject/ernie/db/TorperfProcessor.java
+++ b/src/org/torproject/ernie/db/TorperfProcessor.java
@@ -67,6 +67,15 @@ public class TorperfProcessor {
           } else {
             String source = pop.getName().substring(0,
                 pop.getName().indexOf("."));
+            String size = pop.getName().split("-")[1];
+            long receivedBytes = 1L;
+            if (pop.getName().endsWith("kb.data")) {
+              receivedBytes *= 1024L;
+            } else if (pop.getName().endsWith("mb.data")) {
+              receivedBytes *= 1024L * 1024L;
+            }
+            receivedBytes *= Long.parseLong(size.substring(0,
+                size.length() - "xb.data".length()));
             BufferedReader br = new BufferedReader(new FileReader(pop));
             String line = null;
             SimpleDateFormat formatter =
@@ -75,9 +84,10 @@ public class TorperfProcessor {
             while ((line = br.readLine()) != null) {
               String[] parts = line.split(" ");
               // remove defective lines as they occurred on gabelmoo as well
-              // as and incomplete downloads 
+              // as incomplete downloads
               if (parts.length == 20 && parts[0].length() == 10
-                  && !parts[16].equals("0")) {
+                  && !parts[16].equals("0")
+                  && Long.parseLong(parts[19]) > receivedBytes) {
                 long startSec = Long.parseLong(parts[0]);
                 String dateTime = formatter.format(
                     new Date(startSec * 1000L));
-- 
1.7.1