summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-06-18 12:49:46 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-06-18 12:49:46 +0200
commit430a4d337810ec9b424a0281ba5945e7e901acc4 (patch)
treea7160ca1ac709511e61071d16b3a88fa75154a50
parent7ef2b1487fa6bd6e0a4b931870e12e60ff498ebc (diff)
downloadscripts-430a4d337810ec9b424a0281ba5945e7e901acc4.tar.gz
interrupts-graph.py: Allow unbounded x history
-rwxr-xr-xrare/interrupts-graph.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/rare/interrupts-graph.py b/rare/interrupts-graph.py
index 1d6fd1f..ae30eb3 100755
--- a/rare/interrupts-graph.py
+++ b/rare/interrupts-graph.py
@@ -46,12 +46,23 @@ parser.add_argument('-i', dest='input_filename',
help='Source to read interrupts entries from')
parser.add_argument('-o', dest='output_filename',
help='Target file to write interrupt entries to')
+parser.add_argument('-l', dest='limit_seconds', type=float,
+ help='Maximum number of seconds to remember in the graph (0 for unbounded)')
args = parser.parse_args()
if args.input_filename:
input_filename = args.input_filename
if args.output_filename:
output_filename = args.output_filename
+if args.limit_seconds is not None:
+ if args.limit_seconds > 0:
+ x_entries_max = int(args.limit_seconds / INTERVAL)
+ else:
+ # Unbounded
+ x_entries_max = None
+else:
+ x_entries_max = int(XRANGE / INTERVAL)
+
def is_line_ok(name, yvalues):
"""Returns True if a line should be displayed for this name."""
if max(yvalues) < 5:
@@ -180,15 +191,14 @@ plt.connect('pick_event', on_pick)
names = [name for name, _ in get_diffs()]
yvalues = {}
-x_count = int(XRANGE / INTERVAL)
# Initialize y values for each name
for name in names:
- ydata = deque([], x_count)
+ ydata = deque([], x_entries_max)
yvalues[name] = ydata
lines = {}
def update_title():
- title = 'Figure'
+ title = input_filename
if paused:
title += ' (paused - press Space to resume)'
plt.gcf().canvas.set_window_title(title)