]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
pybootchartgui: skip proc_stat.log entries without any times
authorDavid Kruger <David.Kruger@jdsu.com>
Tue, 2 Apr 2013 17:10:47 +0000 (19:10 +0200)
committerArmin Kuster <akuster808@gmail.com>
Sat, 4 May 2019 01:31:09 +0000 (18:31 -0700)
This fixes a rare IndexError exception when 'times' is empty due to an
incomplete entry in proc_stat.log.

Signed-off-by: Armin Kuster <akuster808@gmail.com>
scripts/pybootchartgui/pybootchartgui/parsing.py

index 6e139bfbd1650279657409a78751c0f383891f43..0b5063b4f3a1473046b0a3cc3752ca1ea50ea23e 100644 (file)
@@ -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]))