[tor-commits] [arm/master] More prompt redrawing of the graph

atagar at torproject.org atagar at torproject.org
Tue Nov 18 06:09:38 UTC 2014


commit ae079d9281478e23486c3868974585bd92543ba8
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Nov 16 10:59:12 2014 -0800

    More prompt redrawing of the graph
    
    We redrew the graph at 'some point in its interval' rather than right away when
    it had a new sampling to show. Fixing that.
---
 arm/graph_panel.py |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arm/graph_panel.py b/arm/graph_panel.py
index 60006db..b534f29 100644
--- a/arm/graph_panel.py
+++ b/arm/graph_panel.py
@@ -362,7 +362,6 @@ class GraphPanel(panel.Panel):
 
     self._graph_height = max(1, CONFIG['features.graph.height'])
     self._accounting_stats = None
-    self._last_redraw = 0
 
     self._stats = {
       GraphStat.BANDWIDTH: BandwidthStats(),
@@ -411,8 +410,9 @@ class GraphPanel(panel.Panel):
         arm.controller.get_controller().redraw()
 
     update_rate = INTERVAL_SECONDS[self._update_interval]
+    param = self.get_attr('_stats')[self._current_display]
 
-    if time.time() - self._last_redraw > update_rate:
+    if param.primary.tick % update_rate == 0:
       self.redraw(True)
 
   def reset_listener(self, controller, event_type, _):
@@ -572,8 +572,6 @@ class GraphPanel(panel.Panel):
     if not self._current_display:
       return
 
-    self._last_redraw = time.time()
-
     param = self.get_attr('_stats')[self._current_display]
     graph_column = min((width - 10) / 2, CONFIG['features.graph.max_width'])
 





More information about the tor-commits mailing list