summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-06-18 13:03:45 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-06-18 13:03:45 +0200
commit1c7fd696da879bb50d0c0267fea32193362cafe6 (patch)
treeeb40bc84ecebaa1a445f4e55ad2d1ba55078117a
parent2646f56dd84a981eaeac38b592706c7d13346606 (diff)
downloadscripts-1c7fd696da879bb50d0c0267fea32193362cafe6.tar.gz
interrupt-graph.py: fix double update; read fully
get_diffs() was called in update(), but that would invalidate numbers. Now the input file is fully read (allows moving).
-rwxr-xr-xrare/interrupts-graph.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/rare/interrupts-graph.py b/rare/interrupts-graph.py
index dbef311..7417726 100755
--- a/rare/interrupts-graph.py
+++ b/rare/interrupts-graph.py
@@ -232,7 +232,7 @@ def update():
"""Reads new data and updates the line values."""
global update_legend
# Update lines
- for name, n in get_diffs():
+ for name in names:
ys = yvalues[name]
# Consider only strictly positive values
ydata = [y for y in ys if y > 0]
@@ -328,19 +328,22 @@ def refresh_data_timer():
t.start()
refresh_data()
-# Fill xrange of entries
if not input_is_proc:
- for i in range(0, int(XRANGE / INTERVAL)):
- if not refresh_data():
- break
-refresh_data_timer()
-
-while running:
- if not paused:
- update()
+ # Read all yvalues data from file
+ while refresh_data():
+ pass
+ update()
do_draw()
- plt.pause(INTERVAL)
+ # Block until exited
+ plt.show()
+else:
+ refresh_data_timer()
+
+ while running:
+ if not paused:
+ update()
+ do_draw()
+ plt.pause(INTERVAL)
-# Cancel any scheduled timer
-if t:
+ # Cancel any scheduled timer
t.cancel()