From 55da31779d51b74b87374f31287499a7c45217ae Mon Sep 17 00:00:00 2001 From: David Kruger Date: Tue, 2 Apr 2013 19:10:47 +0200 Subject: [PATCH] pybootchartgui: skip proc_stat.log entries without any times This fixes a rare IndexError exception when 'times' is empty due to an incomplete entry in proc_stat.log. Signed-off-by: Armin Kuster --- scripts/pybootchartgui/pybootchartgui/parsing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py index 6e139bfbd16..0b5063b4f3a 100644 --- a/scripts/pybootchartgui/pybootchartgui/parsing.py +++ b/scripts/pybootchartgui/pybootchartgui/parsing.py @@ -426,8 +426,10 @@ def _parse_proc_stat_log(file): # skip emtpy lines if not lines: continue - # CPU times {user, nice, system, idle, io_wait, irq, softirq} tokens = lines[0].split() + if len(tokens) < 8: + continue + # CPU times {user, nice, system, idle, io_wait, irq, softirq} times = [ int(token) for token in tokens[1:] ] if ltimes: user = float((times[0] + times[1]) - (ltimes[0] + ltimes[1])) -- 2.47.2