aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2020-03-30 19:00:15 -0400
committerDeterminant <tederminant@gmail.com>2020-03-30 19:00:15 -0400
commit60a70053f3df0ab419106d161ae1407a6d5671ab (patch)
treede61aee54eb52e476a6d7cd618093ef80ccc09a3
parenta7dcb6db441baf5b7928a44afd5da9bb81cf0023 (diff)
...
-rw-r--r--scripts/thr_hist.py15
1 files changed, 8 insertions, 7 deletions
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))