From 1c7fd696da879bb50d0c0267fea32193362cafe6 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 18 Jun 2014 13:03:45 +0200 Subject: 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). --- rare/interrupts-graph.py | 29 ++++++++++++++++------------- 1 file 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() -- cgit v1.2.1