From 8463a833245938a2d5fc20d0d06e28a15f2c1a1c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 29 Oct 2017 20:30:36 -0400 Subject: [PATCH] graphstats: Fix graphing script Update the graphstats.py graphing script so that it works with recent stats changes - the stats can now contain groups that end with a ':' and the print_time is no longer reset to zero on a new print. Signed-off-by: Kevin O'Connor --- scripts/graphstats.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/graphstats.py b/scripts/graphstats.py index 3cb79cb2..d037983a 100755 --- a/scripts/graphstats.py +++ b/scripts/graphstats.py @@ -21,7 +21,8 @@ def parse_log(logname): #if parts and parts[0] == 'INFO:root:shutdown:': # break continue - keyparts = dict(p.split('=', 1) for p in parts[2:]) + keyparts = dict(p.split('=', 1) + for p in parts[2:] if not p.endswith(':')) if keyparts.get('bytes_write', '0') == '0': continue keyparts['#sampletime'] = float(parts[1][:-1]) @@ -34,10 +35,11 @@ def find_print_restarts(data): print_resets = [] for d in data: print_time = float(d.get('print_time', last_print_time)) - if print_time < last_print_time: + buffer_time = float(d.get('buffer_time', 0.)) + if print_time == last_print_time and not buffer_time: print_resets.append(d['#sampletime']) last_print_time = 0. - else: + elif buffer_time: last_print_time = print_time sample_resets = {} for d in data: @@ -74,7 +76,7 @@ def plot_mcu(data, maxbw, outname, graph_awake=False): load = 0. pt = float(d['print_time']) hb = float(d['buffer_time']) - if pt <= 2. * MAXBUFFER or hb >= MAXBUFFER or st in sample_resets: + if not hb or hb >= MAXBUFFER or st in sample_resets: hb = 0. else: hb = 100. * (MAXBUFFER - hb) / MAXBUFFER