benchmark_udp: improve rtt record buffering#21712
Conversation
The ping sequence number is linear, so modulo calculation can be use to get the index of the oldest/ next entry in the record buffer.
I'm not super familiar with the code anymore, but what if the receiver doesn't receive a ping message, wouldn't that cause a collision in the array when the next one arrives? |
The code is on the client side, i.e. the side that sends the pings and does the linear increase of the sequence number. So I don't think it matters whether the receiver actually receives the ping. Or do you mean sth else? |
Contribution description
Small improvement when accessing the buffer that stores the records for pending pings.
There is no need to iterate through the buffer to find the oldest entry. The ping sequence number is linear and for each ping we add a record entry:
RIOT/sys/test_utils/benchmark_udp/benchmark_udp.c
Lines 124 to 134 in ef76a04
So modulo calculation can be used to get the index of the oldest/ next entry.
Testing procedure
Can be tested by running
dist/tools/benchmark_udp(server) on the host andsys/test_utils/benchmark_udp(client) on a connected node.Issues/PRs references