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 <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-12-06 11:10:52 -05:00
parent 4565a73e91
commit 12d4888321
1 changed files with 7 additions and 2 deletions

View File

@ -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'))