Move rate estimate from 64-bits to 32-bits, saving some bytes.

This commit is contained in:
Herbert Wolverson
2024-03-14 11:03:43 -05:00
parent 8ec361b095
commit a937820a87
3 changed files with 5 additions and 5 deletions

View File

@@ -149,7 +149,7 @@ pub struct FlowbeeData {
/// Packets transmitted
pub packets_sent: [u64; 2],
/// Rate estimate
pub rate_estimate_bps: [u64; 2],
pub rate_estimate_bps: [u32; 2],
/// TCP Retransmission count (also counts duplicates)
pub tcp_retransmits: [u32; 2],
/// Most recent RTT

View File

@@ -50,7 +50,7 @@ struct flow_data_t {
// Bytes at the next rate estimate
__u64 next_count_bytes[2];
// Rate estimate
__u64 rate_estimate_bps[2];
__u32 rate_estimate_bps[2];
// Sequence number of the last packet
__u32 last_sequence[2];
// Acknowledgement number of the last packet
@@ -292,8 +292,8 @@ static __always_inline void process_tcp(
if (
tsecr == data->tsval[other_rate_index] &&
(data->rate_estimate_bps[rate_index] > HALF_MBPS_IN_BYTES_PER_SECOND ||
data->rate_estimate_bps[other_rate_index] > HALF_MBPS_IN_BYTES_PER_SECOND )
(data->rate_estimate_bps[rate_index] > 0 ||
data->rate_estimate_bps[other_rate_index] > 0 )
) {
__u64 elapsed = dissector->now - data->ts_change_time[other_rate_index];
if (elapsed < TWO_SECONDS_IN_NANOS) {

View File

@@ -42,7 +42,7 @@ pub struct FlowbeeData {
/// Bytes at the next rate estimate
pub next_count_bytes: [u64; 2],
/// Rate estimate
pub rate_estimate_bps: [u64; 2],
pub rate_estimate_bps: [u32; 2],
/// Sequence number of the last packet
pub last_sequence: [u32; 2],
/// Acknowledgement number of the last packet