[or-cvs] r22586: {arm} Displaying the measured bandwidth stat. (arm/trunk/interface/graphing)

Damian Johnson atagar1 at gmail.com
Sun Jul 4 03:57:25 UTC 2010


Author: atagar
Date: 2010-07-04 03:57:25 +0000 (Sun, 04 Jul 2010)
New Revision: 22586

Modified:
   arm/trunk/interface/graphing/bandwidthStats.py
Log:
Displaying the measured bandwidth stat.



Modified: arm/trunk/interface/graphing/bandwidthStats.py
===================================================================
--- arm/trunk/interface/graphing/bandwidthStats.py	2010-07-04 02:47:56 UTC (rev 22585)
+++ arm/trunk/interface/graphing/bandwidthStats.py	2010-07-04 03:57:25 UTC (rev 22586)
@@ -179,6 +179,7 @@
       bwRate = conn.getMyBandwidthRate()
       bwBurst = conn.getMyBandwidthBurst()
       bwObserved = conn.getMyBandwidthObserved()
+      bwMeasured = conn.getMyBandwidthMeasured()
       
       if bwRate and bwBurst:
         bwRate = uiTools.getSizeLabel(bwRate, 1)
@@ -192,7 +193,13 @@
         stats.append("limit: %s" % bwRate)
         stats.append("burst: %s" % bwBurst)
       
-      if bwObserved: stats.append("observed: %s" % uiTools.getSizeLabel(bwObserved, 1))
+      # Provide the observed bandwidth either if the measured bandwidth isn't
+      # available or if the measured bandwidth is the observed (this happens
+      # if there isn't yet enough bandwidth measurements).
+      if bwObserved and (not bwMeasured or bwMeasured == bwObserved):
+        stats.append("observed: %s" % uiTools.getSizeLabel(bwObserved, 1))
+      elif bwMeasured:
+        stats.append("measured: %s" % uiTools.getSizeLabel(bwMeasured, 1))
       
       self._titleStats = stats
   



More information about the tor-commits mailing list