From: David Kruger Date: Tue, 2 Apr 2013 17:10:47 +0000 (+0200) Subject: pybootchartgui: skip proc_stat.log entries without any times X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55da31779d51b74b87374f31287499a7c45217ae;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 --- 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]))