Revert per-ms timings for now.

This commit is contained in:
Herbert Wolverson committed 2024-03-08 14:53:49 -06:00
1 parent 1fb151aa1b
commit 79fa1d42a8
1 file changed
+3 -3
+3 -3
View File
@@ -97,7 +97,7 @@ static __always_inline struct flow_data_t new_flow_data(
.packets_sent = { 0, 0 },
// Track flow rates at an MS scale rather than per-second
// to minimize rounding errors.
.next_count_time = { now + MS_IN_NANOS_T10, now + MS_IN_NANOS_T10 },
.next_count_time = { now + SECOND_IN_NANOS, now + SECOND_IN_NANOS },
.last_count_time = { now, now },
.next_count_bytes = { dissector->skb_len, dissector->skb_len },
.rate_estimate_bps = { 0, 0 },
@@ -162,9 +162,9 @@ static __always_inline void update_flow_rates(
if (now > data->next_count_time[rate_index]) {
// Calculate the rate estimate
__u64 bits = (data->bytes_sent[rate_index] - data->next_count_bytes[rate_index])*8;
__u64 time = (now - data->last_count_time[rate_index]) / 100000; // 10 Milliseconds
__u64 time = (now - data->last_count_time[rate_index]) / 10000000; // 1 Second
data->rate_estimate_bps[rate_index] = (bits/time); // bits per second
data->next_count_time[rate_index] = now + MS_IN_NANOS_T10;
data->next_count_time[rate_index] = now + SECOND_IN_NANOS;
data->next_count_bytes[rate_index] = data->bytes_sent[rate_index];
data->last_count_time[rate_index] = now;
//bpf_debug("[FLOWS] Rate Estimate: %llu", data->rate_estimate_bps[rate_index]);