From 12d4888321bdf44e2a6912b1c58188e748d99a9d Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 6 Dec 2016 11:10:52 -0500 Subject: [PATCH] graphstats: Updates for recent stats changes Update the graphstats helper script to account for recent changes in the statistics output. Signed-off-by: Kevin O'Connor --- scripts/graphstats.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/graphstats.py b/scripts/graphstats.py index 7fa1e901..64ef37e9 100755 --- a/scripts/graphstats.py +++ b/scripts/graphstats.py @@ -15,11 +15,13 @@ def parse_log(logname): out = [] for line in f: parts = line.split() - if not parts or parts[0] != 'INFO:root:Stats': + if not parts or parts[0] not in ('Stats', 'INFO:root:Stats'): #if parts and parts[0] == 'INFO:root:shutdown:': # break continue keyparts = dict(p.split('=', 1) for p in parts[2:]) + if keyparts.get('bytes_write', '0') == '0': + continue keyparts['#sampletime'] = float(parts[1][:-1]) out.append(keyparts) f.close() @@ -39,6 +41,9 @@ def plot_mcu(data, maxbw, outname): if timedelta <= 0.: continue bw = float(d['bytes_write']) + float(d['bytes_retransmit']) + if bw < lastbw: + lastbw = bw + continue load = float(d['mcu_task_avg']) + 3*float(d['mcu_task_stddev']) if st - basetime < 15.: load = 0. @@ -60,8 +65,8 @@ def plot_mcu(data, maxbw, outname): ax1.set_title("MCU bandwidth and load utilization") ax1.set_xlabel('Time (UTC)') ax1.set_ylabel('Usage (%)') - ax1.plot_date(times, loads, 'r', label='MCU load') ax1.plot_date(times, bwdeltas, 'g', label='Bandwidth') + ax1.plot_date(times, loads, 'r', label='MCU load') #ax1.plot_date(times, hostbuffers, 'c', label='Host buffer') ax1.legend() ax1.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))