aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/graphstats.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-02-03 18:43:52 -0500
committerKevin O'Connor <kevin@koconnor.net>2018-02-03 18:43:52 -0500
commitd1c209c689f15f99edce1f6adf160edee800a222 (patch)
tree7e1451d9070f45fcbe8a77c6c47491d33df02586 /scripts/graphstats.py
parentf4bfce260a2ea38209646957d7c423db5bb54faa (diff)
downloadkutter-d1c209c689f15f99edce1f6adf160edee800a222.tar.gz
kutter-d1c209c689f15f99edce1f6adf160edee800a222.tar.xz
kutter-d1c209c689f15f99edce1f6adf160edee800a222.zip
graphstats: Fix multi-mcu parsing with reordered stats
The mcu stats (that contain a prefix) may occur before some other stats - make sure to only apply the stats prefix to those stats that need it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts/graphstats.py')
-rwxr-xr-xscripts/graphstats.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/graphstats.py b/scripts/graphstats.py
index ee6eeb94..accb19c2 100755
--- a/scripts/graphstats.py
+++ b/scripts/graphstats.py
@@ -15,7 +15,11 @@ MAXBUFFER=2.
STATS_INTERVAL=5.
TASK_MAX=0.0025
+APPLY_PREFIX = ['mcu_awake', 'mcu_task_avg', 'mcu_task_stddev', 'bytes_write',
+ 'bytes_read', 'bytes_retransmit', 'freq', 'adj']
+
def parse_log(logname):
+ apply_prefix = { p: 1 for p in APPLY_PREFIX }
f = open(logname, 'rb')
out = []
for line in f:
@@ -33,7 +37,9 @@ def parse_log(logname):
prefix = ''
continue
name, val = p.split('=', 1)
- keyparts[prefix + name] = val
+ if name in apply_prefix:
+ name = prefix + name
+ keyparts[name] = val
if keyparts.get('bytes_write', '0') == '0':
continue
keyparts['#sampletime'] = float(parts[1][:-1])