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:
Jukka Rissanen 2019-03-12 13:42:43 +02:00 committed by Anas Nashif
parent 0c465bbec1
commit 0cd9b3e267
3 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1 @@
CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME=y

View file

@ -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();

View file

@ -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);