mirror of
				https://github.com/Klipper3d/klipper.git
				synced 2025-10-31 02:15:52 +01:00 
			
		
		
		
	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>
This commit is contained in:
		| @@ -15,7 +15,11 @@ MAXBUFFER=2. | |||||||
| STATS_INTERVAL=5. | STATS_INTERVAL=5. | ||||||
| TASK_MAX=0.0025 | 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): | def parse_log(logname): | ||||||
|  |     apply_prefix = { p: 1 for p in APPLY_PREFIX } | ||||||
|     f = open(logname, 'rb') |     f = open(logname, 'rb') | ||||||
|     out = [] |     out = [] | ||||||
|     for line in f: |     for line in f: | ||||||
| @@ -33,7 +37,9 @@ def parse_log(logname): | |||||||
|                     prefix = '' |                     prefix = '' | ||||||
|                 continue |                 continue | ||||||
|             name, val = p.split('=', 1) |             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': |         if keyparts.get('bytes_write', '0') == '0': | ||||||
|             continue |             continue | ||||||
|         keyparts['#sampletime'] = float(parts[1][:-1]) |         keyparts['#sampletime'] = float(parts[1][:-1]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user