On Fri Oct 31, 2025 at 8:28 PM CET, Martin KaFai Lau wrote:
> On 10/31/25 9:20 AM, [email protected] wrote:

[...]

>>> +   while (true) {
>>> +           send(conn->client_conn_fd, (void *)tx_buffer, BUFFER_LEN, 0);
>>> +           ts_end = get_time_ns();
>>> +           if ((ts_end - ts_start)/100000 >= TIMEOUT_MS) {
>>                                           ^^^^^^
>> 
>> Does this time conversion use the correct divisor? The timeout check
>> appears to divide nanoseconds by 100000, but TIMEOUT_MS is 2000
>> milliseconds. Converting nanoseconds to milliseconds requires dividing
>> by 1000000, not 100000. With the current calculation, the timeout would
>> trigger after 200 milliseconds rather than 2000 milliseconds.
>
> The report is correct, there is a typo in the denominator.

Gaaaah, that's one stupid mistake, and so I possibly got too enthusiastic
about the initial results. I'll redo some more tests with this point fixed.

> Use the send_recv_data() helper in network_helpers.c. It should simplify 
> this test and no need to pthread_create, while loop, ....etc. 
> send_recv_data limits by the number of bytes instead of the length of 
> time. There is a target rate in this test, so it should be easy to 
> convert from time limit to byte limit and reuse the send_recv_data.

Nice, thanks for the hint, I'll then simplify the whole test by using this
helper.

Alexis



-- 
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Reply via email to