[tor-commits] [arm/master] Separating inital BW totals into separate params

sebastian at torproject.org sebastian at torproject.org
Sun Apr 24 05:55:02 UTC 2011


commit b4ea3bd612d54ff1e33c4b52d4982ccfc207d9fb
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Apr 23 20:34:31 2011 -0700

    Separating inital BW totals into separate params
    
    Mixing the bandwidth totals fetched from Tor with the GraphStats param caused
    the average measurement to be skewed. Separating this total into a parameter
    just used for the total label.
---
 armrc.sample                             |    4 ----
 src/interface/graphing/bandwidthStats.py |   14 +++++++-------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/armrc.sample b/armrc.sample
index 11b62ea..4cda197 100644
--- a/armrc.sample
+++ b/armrc.sample
@@ -140,9 +140,6 @@ features.graph.showIntermediateBounds true
 # prepopulate
 #   attempts to use tor's state file to prepopulate the bandwidth graph at the
 #   15-minute interval (this requires the minimum of a day's worth of uptime)
-# prepopulateTotal
-#   populates the total stat from the state file if true (this only contains
-#   the last day's worth of information, so this metric isn't the true total)
 # transferInBystes
 #   shows rate measurments in bytes if true, bits otherwise
 # accounting.show
@@ -153,7 +150,6 @@ features.graph.showIntermediateBounds true
 #   provides verbose measurements of time if true
 
 features.graph.bw.prepopulate true
-features.graph.bw.prepopulateTotal false
 features.graph.bw.transferInBytes false
 features.graph.bw.accounting.show true
 features.graph.bw.accounting.rate 10
diff --git a/src/interface/graphing/bandwidthStats.py b/src/interface/graphing/bandwidthStats.py
index 70a1e16..f8e3020 100644
--- a/src/interface/graphing/bandwidthStats.py
+++ b/src/interface/graphing/bandwidthStats.py
@@ -60,19 +60,18 @@ class BandwidthStats(graphPanel.GraphStats):
     # https://trac.torproject.org/projects/tor/ticket/2345
     # 
     # further updates are still handled via BW events to avoid unnecessary
-    # GETINFO requests. This needs to update the pause buffer too because
-    # instances start paused, causing the primary value to be clobbered once
-    # just after initalization.
+    # GETINFO requests.
+    
+    self.initialPrimaryTotal = 0
+    self.initialSecondaryTotal = 0
     
     readTotal = conn.getInfo("traffic/read")
     if readTotal and readTotal.isdigit():
-      self.primaryTotal = int(readTotal) / 1024 # Bytes -> KB
-      self._pauseBuffer.primaryTotal = int(readTotal) / 1024
+      self.initialPrimaryTotal = int(readTotal) / 1024 # Bytes -> KB
     
     writeTotal = conn.getInfo("traffic/written")
     if writeTotal and writeTotal.isdigit():
-      self.secondaryTotal = int(writeTotal) / 1024 # Bytes -> KB
-      self._pauseBuffer.secondaryTotal = int(writeTotal) / 1024
+      self.initialSecondaryTotal = int(writeTotal) / 1024 # Bytes -> KB
   
   def resetListener(self, conn, eventType):
     # updates title parameters and accounting status if they changed
@@ -346,6 +345,7 @@ class BandwidthStats(graphPanel.GraphStats):
   
   def _getTotalLabel(self, isPrimary):
     total = self.primaryTotal if isPrimary else self.secondaryTotal
+    total += self.initialPrimaryTotal if isPrimary else self.initialSecondaryTotal
     return "total: %s" % uiTools.getSizeLabel(total * 1024, 1)
   
   def _updateAccountingInfo(self):



More information about the tor-commits mailing list