[or-cvs] r23158: {arm} added: incremental y-axis measurements to the graph (request (in arm/trunk: . src/interface/graphing)

Damian Johnson atagar1 at gmail.com
Fri Sep 10 07:18:35 UTC 2010


Author: atagar
Date: 2010-09-10 07:18:35 +0000 (Fri, 10 Sep 2010)
New Revision: 23158

Modified:
   arm/trunk/TODO
   arm/trunk/armrc.sample
   arm/trunk/src/interface/graphing/graphPanel.py
Log:
added: incremental y-axis measurements to the graph (requested by voidzero)



Modified: arm/trunk/TODO
===================================================================
--- arm/trunk/TODO	2010-09-09 22:09:01 UTC (rev 23157)
+++ arm/trunk/TODO	2010-09-10 07:18:35 UTC (rev 23158)
@@ -55,6 +55,16 @@
             instance)
   [ ] setup scripts for arm
         [X] setup scrpt to add to /usr/bin/arm (requested by ioerror)
+        [ ] mac installer
+            Couple of options include macport and dmg...
+            - macport (http://guide.macports.org/#development)
+              Build-from-source distribution method (like BSD portinstall).
+              This has been suggested by several people.
+            
+            - dmg (http://en.wikipedia.org/wiki/Apple_Disk_Image)
+              Most conventional method of software distribution on mac. This is
+              just a container (no updating/removal support), but could contain
+              an icon for the dock that starts a terminal with arm.
         [ ] updater (checks for a new tarball and installs it automatically)
         [ ] look into CAPs to get around permission issues for connection
             listing sudo wrapper for arm to help arm run as the same user as

Modified: arm/trunk/armrc.sample
===================================================================
--- arm/trunk/armrc.sample	2010-09-09 22:09:01 UTC (rev 23157)
+++ arm/trunk/armrc.sample	2010-09-10 07:18:35 UTC (rev 23158)
@@ -28,13 +28,15 @@
 #           3 -> minutely,     4 -> half hour,  5 -> hourly,      6 -> daily
 # bound:    0 -> global maxima,        1 -> local maxima, 2 -> tight
 # type:     0 -> None, 1 -> Bandwidth, 2 -> Connections,  3 -> System Resources
+# showIntermediateBounds: shows y-axis increments between the top/bottom bounds
 # frequentRefrsh: updates stats each second if true, otherwise matches interval
 
-features.graph.height 5
+features.graph.height 7
 features.graph.maxWidth 150
 features.graph.interval 0
 features.graph.bound 1
 features.graph.type 1
+features.graph.showIntermediateBounds true
 features.graph.frequentRefresh true
 
 # ps graph parameters

Modified: arm/trunk/src/interface/graphing/graphPanel.py
===================================================================
--- arm/trunk/src/interface/graphing/graphPanel.py	2010-09-09 22:09:01 UTC (rev 23157)
+++ arm/trunk/src/interface/graphing/graphPanel.py	2010-09-10 07:18:35 UTC (rev 23158)
@@ -41,7 +41,7 @@
 WIDE_LABELING_GRAPH_COL = 50  # minimum graph columns to use wide spacing for x-axis labels
 
 # used for setting defaults when initializing GraphStats and GraphPanel instances
-CONFIG = {"features.graph.height": 5, "features.graph.interval": 0, "features.graph.bound": 1, "features.graph.maxWidth": 150, "features.graph.frequentRefresh": True}
+CONFIG = {"features.graph.height": 7, "features.graph.interval": 0, "features.graph.bound": 1, "features.graph.maxWidth": 150, "features.graph.showIntermediateBounds": True, "features.graph.frequentRefresh": True}
 
 def loadConfig(config):
   config.update(CONFIG)
@@ -285,16 +285,16 @@
       
       # determines max/min value on the graph
       if self.bounds == BOUNDS_GLOBAL_MAX:
-        primaryMaxBound = param.maxPrimary[self.updateInterval]
-        secondaryMaxBound = param.maxSecondary[self.updateInterval]
+        primaryMaxBound = int(param.maxPrimary[self.updateInterval])
+        secondaryMaxBound = int(param.maxSecondary[self.updateInterval])
       else:
         # both BOUNDS_LOCAL_MAX and BOUNDS_TIGHT use local maxima
         if graphCol < 2:
           # nothing being displayed
           primaryMaxBound, secondaryMaxBound = 0, 0
         else:
-          primaryMaxBound = max(param.primaryCounts[self.updateInterval][1:graphCol + 1])
-          secondaryMaxBound = max(param.secondaryCounts[self.updateInterval][1:graphCol + 1])
+          primaryMaxBound = int(max(param.primaryCounts[self.updateInterval][1:graphCol + 1]))
+          secondaryMaxBound = int(max(param.secondaryCounts[self.updateInterval][1:graphCol + 1]))
       
       primaryMinBound = secondaryMinBound = 0
       if self.bounds == BOUNDS_TIGHT:
@@ -306,13 +306,28 @@
         if primaryMinBound == primaryMaxBound: primaryMinBound = 0
         if secondaryMinBound == secondaryMaxBound: secondaryMinBound = 0
       
-      # displays bound
+      # displays upper and lower bounds
       self.addstr(2, 0, "%4i" % primaryMaxBound, primaryColor)
       self.addstr(self.graphHeight + 1, 0, "%4i" % primaryMinBound, primaryColor)
       
       self.addstr(2, graphCol + 5, "%4i" % secondaryMaxBound, secondaryColor)
       self.addstr(self.graphHeight + 1, graphCol + 5, "%4i" % secondaryMinBound, secondaryColor)
       
+      # displays intermediate bounds on every other row
+      if CONFIG["features.graph.showIntermediateBounds"]:
+        ticks = (self.graphHeight - 3) / 2
+        for i in range(ticks):
+          row = self.graphHeight - (2 * i) - 3
+          if self.graphHeight % 2 == 0 and i >= (ticks / 2): row -= 1
+          
+          if primaryMinBound != primaryMaxBound:
+            primaryVal = (primaryMaxBound - primaryMinBound) / (self.graphHeight - 1) * (self.graphHeight - row - 1)
+            self.addstr(row + 2, 0, "%4i" % primaryVal, primaryColor)
+          
+          if secondaryMinBound != secondaryMaxBound:
+            secondaryVal = (secondaryMaxBound - secondaryMinBound) / (self.graphHeight - 1) * (self.graphHeight - row - 1)
+            self.addstr(row + 2, graphCol + 5, "%4i" % secondaryVal, secondaryColor)
+      
       # creates bar graph (both primary and secondary)
       for col in range(graphCol):
         colCount = param.primaryCounts[self.updateInterval][col + 1] - primaryMinBound



More information about the tor-commits mailing list