samples: net: zperf: Make client work in native_posix
As the clock does not run same way in native_posix, do some tricks here. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
0c465bbec1
commit
0cd9b3e267
1
samples/net/zperf/boards/native_posix.conf
Normal file
1
samples/net/zperf/boards/native_posix.conf
Normal file
|
@ -0,0 +1 @@
|
|||
CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME=y
|
|
@ -103,7 +103,11 @@ void zperf_tcp_upload(const struct shell *shell,
|
|||
time_elapsed = 1U;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ARCH_POSIX)
|
||||
k_busy_wait(K_MSEC(100));
|
||||
#else
|
||||
k_yield();
|
||||
#endif
|
||||
} while (!finished);
|
||||
|
||||
end_time = k_cycle_get_32();
|
||||
|
|
|
@ -323,9 +323,13 @@ void zperf_udp_upload(const struct shell *shell,
|
|||
}
|
||||
|
||||
/* Wait */
|
||||
#if defined(CONFIG_ARCH_POSIX)
|
||||
k_busy_wait(K_MSEC(100));
|
||||
#else
|
||||
while (time_delta(loop_time, k_cycle_get_32()) < delay) {
|
||||
k_yield();
|
||||
}
|
||||
#endif
|
||||
|
||||
} while (time_delta(start_time, last_loop_time) < duration);
|
||||
|
||||
|
|
Loading…
Reference in a new issue