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

[tor-commits] [onionoo/master] Remove lower-resolution bandwidth data that adds no information.



commit da5b4ebde05362390271c719307a61b0a7d2caa9
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Feb 13 11:08:47 2012 +0100

    Remove lower-resolution bandwidth data that adds no information.
    
    From GitHub issue #2: "We include bandwidth data for all time periods as
    soon as we have at least two data points.  But sometimes a time period is
    completely contained in another, shorter time period, where graphs have a
    higher resolution.  For example, if a relay is only running for a few
    months, we don't need to include bandwidth data for the 5-years graph, but
    only for the 1-year graph.  In general, we only need to include bandwidth
    data up to the point where the start of a time period precedes the first
    bandwidth data point.  No need to include larger time periods."
---
 .../torproject/onionoo/BandwidthDataWriter.java    |    7 +++++++
 web/index.html                                     |    8 +++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/org/torproject/onionoo/BandwidthDataWriter.java b/src/org/torproject/onionoo/BandwidthDataWriter.java
index 59789c0..7052e3c 100644
--- a/src/org/torproject/onionoo/BandwidthDataWriter.java
+++ b/src/org/torproject/onionoo/BandwidthDataWriter.java
@@ -341,6 +341,13 @@ public class BandwidthDataWriter {
       long firstDataPointMillis = (((this.now - graphInterval)
           / dataPointInterval) + firstNonNullIndex) * dataPointInterval
           + dataPointInterval / 2L;
+      if (i > 0 &&
+          firstDataPointMillis >= this.now - graphIntervals[i - 1]) {
+        /* Skip bandwidth history object, because it doesn't contain
+         * anything new that wasn't already contained in the last
+         * bandwidth history object(s). */
+        continue;
+      }
       long lastDataPointMillis = firstDataPointMillis
           + (lastNonNullIndex - firstNonNullIndex) * dataPointInterval;
       double factor = ((double) maxValue) / 999.0;
diff --git a/web/index.html b/web/index.html
index 6736aea..4e63c28 100755
--- a/web/index.html
+++ b/web/index.html
@@ -366,11 +366,9 @@ Keys are fixed strings <i>"3_days"</i>, <i>"1_week"</i>, <i>"1_month"</i>,
 <i>"3_months"</i>, <i>"1_year"</i>, and <i>"5_years"</i>.
 Keys refer to the last known bandwidth history of a relay, not to the time
 when the bandwidth document was published.
-<font color="red">A bandwidth history object is only contained if the time
-period it covers is not already contained in another bandwidth history
-object with shorter time period and higher data resolution.
-(Announced on February 13, redundant bandwidth history objects will be
-removed after March 13, 2012.)</font>
+A bandwidth history object is only contained if the time period it covers
+is not already contained in another bandwidth history object with shorter
+time period and higher data resolution.
 Each bandwidth history object contains the following key-value pairs:
 <ul>
 <li><b>"first":</b> UTC timestamp (YYYY-MM-DD hh:mm:ss) of the first data

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits