From 60a70053f3df0ab419106d161ae1407a6d5671ab Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 30 Mar 2020 19:00:15 -0400 Subject: ... --- scripts/thr_hist.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/thr_hist.py b/scripts/thr_hist.py index 6f385e5..646c2af 100644 --- a/scripts/thr_hist.py +++ b/scripts/thr_hist.py @@ -56,14 +56,15 @@ if __name__ == '__main__': lats.append(float(m.group(2))) timestamps.sort() for timestamp in timestamps: - if begin_time and timestamp < next_begin_time: - cnt += 1 - else: - if begin_time: - values.append(cnt) + if begin_time is None: begin_time = timestamp - next_begin_time = begin_time + timedelta(seconds=interval) - cnt = 1 + next_begin_time = timestamp + timedelta(seconds=interval) + while timestamp >= next_begin_time: + begin_time = next_begin_time + next_begin_time += timedelta(seconds=interval) + values.append(cnt) + cnt = 0 + cnt += 1 values.append(cnt) print(values) print("lat = {:.3f}ms".format(sum(lats) / len(lats) * 1e3)) -- cgit v1.2.3-70-g09d2