mirror of https://github.com/Desuuuu/klipper.git
graphstats: Fix filtering of normal buffer_time runoff stats
Update the mechanism to filter out cases where buffer_time is below MAXBUFFER so that it works with the statistics currently generated. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
054cbbe094
commit
896c31fd05
|
@ -42,25 +42,31 @@ def parse_log(logname):
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def find_print_restarts(data):
|
def find_print_restarts(data):
|
||||||
last_print_time = 0.
|
runoff_samples = {}
|
||||||
print_resets = []
|
last_runoff_start = last_buffer_time = last_sampletime = 0.
|
||||||
for d in data:
|
last_print_stall = 0
|
||||||
print_time = float(d.get('print_time', last_print_time))
|
for d in reversed(data):
|
||||||
|
# Check for buffer runoff
|
||||||
|
sampletime = d['#sampletime']
|
||||||
buffer_time = float(d.get('buffer_time', 0.))
|
buffer_time = float(d.get('buffer_time', 0.))
|
||||||
if print_time == last_print_time and not buffer_time:
|
if buffer_time < 1. or (buffer_time < MAXBUFFER
|
||||||
print_resets.append(d['#sampletime'])
|
and buffer_time > last_buffer_time):
|
||||||
last_print_time = 0.
|
if not last_runoff_start:
|
||||||
elif buffer_time:
|
last_runoff_start = last_sampletime
|
||||||
last_print_time = print_time
|
runoff_samples[last_runoff_start] = [False, []]
|
||||||
sample_resets = {}
|
runoff_samples[last_runoff_start][1].append(sampletime)
|
||||||
for d in data:
|
else:
|
||||||
st = d['#sampletime']
|
last_runoff_start = 0.
|
||||||
while print_resets and st > print_resets[0]:
|
last_buffer_time = buffer_time
|
||||||
print_resets.pop(0)
|
last_sampletime = sampletime
|
||||||
if not print_resets:
|
# Check for print stall
|
||||||
break
|
print_stall = int(d['print_stall'])
|
||||||
if st + 2. * MAXBUFFER > print_resets[0]:
|
if print_stall < last_print_stall:
|
||||||
sample_resets[st] = 1
|
if last_runoff_start:
|
||||||
|
runoff_samples[last_runoff_start][0] = True
|
||||||
|
last_print_stall = print_stall
|
||||||
|
sample_resets = {sampletime: 1 for stall, samples in runoff_samples.values()
|
||||||
|
for sampletime in samples if not stall}
|
||||||
return sample_resets
|
return sample_resets
|
||||||
|
|
||||||
def plot_mcu(data, maxbw, outname, graph_awake=False):
|
def plot_mcu(data, maxbw, outname, graph_awake=False):
|
||||||
|
@ -87,7 +93,7 @@ def plot_mcu(data, maxbw, outname, graph_awake=False):
|
||||||
load = 0.
|
load = 0.
|
||||||
pt = float(d['print_time'])
|
pt = float(d['print_time'])
|
||||||
hb = float(d['buffer_time'])
|
hb = float(d['buffer_time'])
|
||||||
if not hb or hb >= MAXBUFFER or st in sample_resets:
|
if hb >= MAXBUFFER or st in sample_resets:
|
||||||
hb = 0.
|
hb = 0.
|
||||||
else:
|
else:
|
||||||
hb = 100. * (MAXBUFFER - hb) / MAXBUFFER
|
hb = 100. * (MAXBUFFER - hb) / MAXBUFFER
|
||||||
|
|
Loading…
Reference in New Issue