net: zperf: Fix wrong throughput in long-duration traffic test

The zperf received or sent bytes length and duration are in 32bits,
if running long-duration zperf test more than 20min, the value will
overflow, and the test result is wrong. Change it to 64bits can fix
this issue.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
This commit is contained in:
Maochen Wang 2024-02-27 14:51:11 +08:00 committed by Fabio Baltieri
commit eda7dd1460
7 changed files with 55 additions and 26 deletions

View file

@ -145,9 +145,9 @@ static void udp_received(int sock, const struct sockaddr *addr, uint8_t *data,
case STATE_ONGOING:
if (id < 0) { /* Negative id means session end. */
struct zperf_results results = { 0 };
uint32_t duration;
uint64_t duration;
duration = k_ticks_to_us_ceil32(time -
duration = k_ticks_to_us_ceil64(time -
session->start_time);
/* Update state machine */