[v14,02/11] app/test: remove POSIX-specific code
Checks
Commit Message
- Replace POSIX-specific code with DPDK equivalents or
conditionally disable it on Windows
- Use NUL on Windows as /dev/null for Unix
- Exclude tests not supported on Windows yet
* multi-process
* PMD performance statistics display on signal
Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
app/test/commands.c | 2 --
app/test/packet_burst_generator.c | 1 +
app/test/process.h | 4 +++-
app/test/test.c | 5 ++++-
app/test/test_byteorder.c | 2 +-
app/test/test_cmdline_ipaddr.c | 13 ++++++-------
app/test/test_cmdline_lib.c | 13 +++++++++----
app/test/test_crc.c | 1 -
app/test/test_memcpy_perf.c | 29 +++++++++++++++--------------
app/test/test_pmd_perf.c | 6 +++++-
app/test/test_ring_stress_impl.h | 2 +-
app/test/test_telemetry_data.c | 2 ++
12 files changed, 47 insertions(+), 33 deletions(-)
Comments
On Wed, Dec 08, 2021 at 10:59:51AM -0800, Jie Zhou wrote:
> - Replace POSIX-specific code with DPDK equivalents or
> conditionally disable it on Windows
> - Use NUL on Windows as /dev/null for Unix
> - Exclude tests not supported on Windows yet
> * multi-process
> * PMD performance statistics display on signal
>
> Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
>
> ---
> app/test/commands.c | 2 --
> app/test/packet_burst_generator.c | 1 +
> app/test/process.h | 4 +++-
> app/test/test.c | 5 ++++-
> app/test/test_byteorder.c | 2 +-
> app/test/test_cmdline_ipaddr.c | 13 ++++++-------
> app/test/test_cmdline_lib.c | 13 +++++++++----
> app/test/test_crc.c | 1 -
> app/test/test_memcpy_perf.c | 29 +++++++++++++++--------------
> app/test/test_pmd_perf.c | 6 +++++-
> app/test/test_ring_stress_impl.h | 2 +-
> app/test/test_telemetry_data.c | 2 ++
> 12 files changed, 47 insertions(+), 33 deletions(-)
>
> diff --git a/app/test/commands.c b/app/test/commands.c
> index 2dced3bc44..887cabad64 100644
> --- a/app/test/commands.c
> +++ b/app/test/commands.c
> @@ -8,8 +8,6 @@
> #include <stdint.h>
> #include <string.h>
> #include <stdlib.h>
> -#include <netinet/in.h>
> -#include <termios.h>
> #include <inttypes.h>
> #include <errno.h>
> #include <sys/queue.h>
> diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c
> index 8ac24577ba..6b42b9b83b 100644
> --- a/app/test/packet_burst_generator.c
> +++ b/app/test/packet_burst_generator.c
> @@ -5,6 +5,7 @@
> #include <rte_byteorder.h>
> #include <rte_mbuf.h>
> #include <rte_ip.h>
> +#include <rte_os_shim.h>
>
> #include "packet_burst_generator.h"
>
> diff --git a/app/test/process.h b/app/test/process.h
> index 5b10cf64df..1f073b9c5c 100644
> --- a/app/test/process.h
> +++ b/app/test/process.h
> @@ -7,12 +7,14 @@
>
> #include <errno.h> /* errno */
> #include <limits.h> /* PATH_MAX */
> +#ifndef RTE_EXEC_ENV_WINDOWS
> #include <libgen.h> /* basename et al */
> +#include <sys/wait.h>
> +#endif
> #include <stdlib.h> /* NULL */
> #include <string.h> /* strerror */
> #include <unistd.h> /* readlink */
> #include <dirent.h>
> -#include <sys/wait.h>
>
> #include <rte_string_fns.h> /* strlcpy */
>
> diff --git a/app/test/test.c b/app/test/test.c
> index 5194131026..e69cae3eea 100644
> --- a/app/test/test.c
> +++ b/app/test/test.c
> @@ -8,7 +8,6 @@
> #include <stdarg.h>
> #include <stdlib.h>
> #include <errno.h>
> -#include <termios.h>
> #include <ctype.h>
> #include <sys/queue.h>
>
> @@ -63,7 +62,9 @@ do_recursive_call(void)
> const char *env_var;
> int (*action_fn)(void);
> } actions[] = {
> +#ifndef RTE_EXEC_ENV_WINDOWS
> { "run_secondary_instances", test_mp_secondary },
> +#endif
> #ifdef RTE_LIB_PDUMP
> #ifdef RTE_NET_RING
> { "run_pdump_server_tests", test_pdump },
> @@ -82,7 +83,9 @@ do_recursive_call(void)
> { "test_file_prefix", no_action },
> { "test_no_huge_flag", no_action },
> #ifdef RTE_LIB_TIMER
> +#ifndef RTE_EXEC_ENV_WINDOWS
> { "timer_secondary_spawn_wait", test_timer_secondary },
> +#endif
> #endif
> };
>
> diff --git a/app/test/test_byteorder.c b/app/test/test_byteorder.c
> index 03c08d9abf..de14ed539e 100644
> --- a/app/test/test_byteorder.c
> +++ b/app/test/test_byteorder.c
> @@ -46,7 +46,7 @@ test_byteorder(void)
> return -1;
>
> res_u16 = rte_bswap16(0x1337);
> - printf("const %"PRIx16" -> %"PRIx16"\n", 0x1337, res_u16);
> + printf("const %"PRIx16" -> %"PRIx16"\n", (uint16_t)0x1337, res_u16);
> if (res_u16 != 0x3713)
> return -1;
>
> diff --git a/app/test/test_cmdline_ipaddr.c b/app/test/test_cmdline_ipaddr.c
> index 2a1ee120fc..f540063508 100644
> --- a/app/test/test_cmdline_ipaddr.c
> +++ b/app/test/test_cmdline_ipaddr.c
> @@ -1,12 +1,9 @@
> /* SPDX-License-Identifier: BSD-3-Clause
> * Copyright(c) 2010-2014 Intel Corporation
> */
> -
> #include <stdio.h>
> #include <string.h>
> #include <inttypes.h>
> -#include <netinet/in.h>
> -#include <sys/socket.h>
>
> #include <rte_string_fns.h>
>
> @@ -15,7 +12,7 @@
>
> #include "test_cmdline.h"
>
> -#define IP4(a,b,c,d) {((uint32_t)(((a) & 0xff)) | \
> +#define IP4(a,b,c,d) {.s_addr = (uint32_t)(((a) & 0xff) | \
> (((b) & 0xff) << 8) | \
> (((c) & 0xff) << 16) | \
> ((d) & 0xff) << 24)}
> @@ -25,7 +22,11 @@
>
> /* create IPv6 address, swapping bytes where needed */
> #ifndef s6_addr16
> -# define s6_addr16 __u6_addr.__u6_addr16
> +#ifdef RTE_EXEC_ENV_WINDOWS
> +#define s6_addr16 u.Word
> +#else
> +#define s6_addr16 __u6_addr.__u6_addr16
> +#endif
> #endif
> #define IP6(a,b,c,d,e,f,g,h) .ipv6 = \
> {.s6_addr16 = \
> @@ -166,8 +167,6 @@ const char * ipaddr_garbage_network6_strs[] = {
> };
> #define IPv6_GARBAGE_PREFIX 64
>
> -
> -
> const char * ipaddr_invalid_strs[] = {
> /** IPv4 **/
>
> diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c
> index f50ccdb599..fcd58cb76a 100644
> --- a/app/test/test_cmdline_lib.c
> +++ b/app/test/test_cmdline_lib.c
> @@ -8,7 +8,6 @@
> #include <stdarg.h>
> #include <stdlib.h>
> #include <errno.h>
> -#include <termios.h>
> #include <ctype.h>
> #include <sys/queue.h>
>
> @@ -22,6 +21,12 @@
>
> #include "test_cmdline.h"
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
> +#define NULL_INPUT "/dev/null"
> +#else
> +#define NULL_INPUT "NUL"
> +#endif
> +
> /****************************************************************/
> /* static functions required for some tests */
> static void
> @@ -156,10 +161,10 @@ test_cmdline_socket_fns(void)
> cl = cmdline_stdin_new(&ctx, NULL);
> if (cl != NULL)
> goto error;
> - cl = cmdline_file_new(NULL, "prompt", "/dev/null");
> + cl = cmdline_file_new(NULL, "prompt", NULL_INPUT);
> if (cl != NULL)
> goto error;
> - cl = cmdline_file_new(&ctx, NULL, "/dev/null");
> + cl = cmdline_file_new(&ctx, NULL, NULL_INPUT);
> if (cl != NULL)
> goto error;
> cl = cmdline_file_new(&ctx, "prompt", NULL);
> @@ -171,7 +176,7 @@ test_cmdline_socket_fns(void)
> cmdline_free(cl);
> return -1;
> }
> - cl = cmdline_file_new(&ctx, "prompt", "/dev/null");
> + cl = cmdline_file_new(&ctx, "prompt", NULL_INPUT);
> if (cl == NULL) {
> printf("Error: failed to open /dev/null for reading!");
> return -1;
> diff --git a/app/test/test_crc.c b/app/test/test_crc.c
> index bf1d344359..0ed080e482 100644
> --- a/app/test/test_crc.c
> +++ b/app/test/test_crc.c
> @@ -14,7 +14,6 @@
> #define CRC32_VEC_LEN2 348
> #define CRC16_VEC_LEN1 12
> #define CRC16_VEC_LEN2 2
> -#define LINE_LEN 75
>
> /* CRC test vector */
> static const uint8_t crc_vec[CRC_VEC_LEN] = {
> diff --git a/app/test/test_memcpy_perf.c b/app/test/test_memcpy_perf.c
> index c711e36ba7..3727c160e6 100644
> --- a/app/test/test_memcpy_perf.c
> +++ b/app/test/test_memcpy_perf.c
> @@ -6,10 +6,11 @@
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
> -#include <sys/time.h>
> +#include <time.h>
>
> #include <rte_common.h>
> #include <rte_cycles.h>
> +#include <rte_os_shim.h>
> #include <rte_random.h>
> #include <rte_malloc.h>
>
> @@ -271,7 +272,7 @@ static int
> perf_test(void)
> {
> int ret;
> - struct timeval tv_begin, tv_end;
> + struct timespec tv_begin, tv_end;
> double time_aligned, time_unaligned;
> double time_aligned_const, time_unaligned_const;
>
> @@ -298,32 +299,32 @@ perf_test(void)
> printf("\n================================= %2dB aligned =================================",
> ALIGNMENT_UNIT);
> /* Do aligned tests where size is a variable */
> - gettimeofday(&tv_begin, NULL);
> + timespec_get(&tv_begin, TIME_UTC);
> perf_test_variable_aligned();
> - gettimeofday(&tv_end, NULL);
> + timespec_get(&tv_end, TIME_UTC);
> time_aligned = (double)(tv_end.tv_sec - tv_begin.tv_sec)
> - + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000;
> + + ((double)tv_end.tv_nsec - tv_begin.tv_nsec) / NS_PER_S;
> printf("\n------- ----------------- ----------------- ----------------- -----------------");
> /* Do aligned tests where size is a compile-time constant */
> - gettimeofday(&tv_begin, NULL);
> + timespec_get(&tv_begin, TIME_UTC);
> perf_test_constant_aligned();
> - gettimeofday(&tv_end, NULL);
> + timespec_get(&tv_end, TIME_UTC);
> time_aligned_const = (double)(tv_end.tv_sec - tv_begin.tv_sec)
> - + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000;
> + + ((double)tv_end.tv_nsec - tv_begin.tv_nsec) / NS_PER_S;
> printf("\n================================== Unaligned ==================================");
> /* Do unaligned tests where size is a variable */
> - gettimeofday(&tv_begin, NULL);
> + timespec_get(&tv_begin, TIME_UTC);
> perf_test_variable_unaligned();
> - gettimeofday(&tv_end, NULL);
> + timespec_get(&tv_end, TIME_UTC);
> time_unaligned = (double)(tv_end.tv_sec - tv_begin.tv_sec)
> - + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000;
> + + ((double)tv_end.tv_nsec - tv_begin.tv_nsec) / NS_PER_S;
> printf("\n------- ----------------- ----------------- ----------------- -----------------");
> /* Do unaligned tests where size is a compile-time constant */
> - gettimeofday(&tv_begin, NULL);
> + timespec_get(&tv_begin, TIME_UTC);
> perf_test_constant_unaligned();
> - gettimeofday(&tv_end, NULL);
> + timespec_get(&tv_end, TIME_UTC);
> time_unaligned_const = (double)(tv_end.tv_sec - tv_begin.tv_sec)
> - + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000;
> + + ((double)tv_end.tv_nsec - tv_begin.tv_nsec) / NS_PER_S;
> printf("\n======= ================= ================= ================= =================\n\n");
>
> printf("Test Execution Time (seconds):\n");
> diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
> index 0aa9dc1b1c..25611bfe9b 100644
> --- a/app/test/test_pmd_perf.c
> +++ b/app/test/test_pmd_perf.c
> @@ -296,6 +296,7 @@ reset_count(void)
> idle = 0;
> }
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
> static void
> stats_display(uint16_t port_id)
> {
> @@ -325,6 +326,7 @@ signal_handler(int signum)
> if (signum == SIGUSR2)
> stats_display(0);
> }
> +#endif
>
> struct rte_mbuf **tx_burst;
>
> @@ -638,7 +640,7 @@ exec_burst(uint32_t flags, int lcore)
> i = (i >= conf->nb_ports - 1) ? 0 : (i + 1);
> }
>
> - sleep(5);
> + rte_delay_us(5 * US_PER_S);
>
> /* only when polling second */
> if (flags == SC_BURST_XMIT_FIRST)
> @@ -669,8 +671,10 @@ test_pmd_perf(void)
>
> printf("Start PMD RXTX cycles cost test.\n");
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
> signal(SIGUSR1, signal_handler);
> signal(SIGUSR2, signal_handler);
> +#endif
>
> nb_ports = rte_eth_dev_count_avail();
> if (nb_ports < NB_ETHPORTS_USED) {
> diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h
> index 2825a9dce6..62f046a91a 100644
> --- a/app/test/test_ring_stress_impl.h
> +++ b/app/test/test_ring_stress_impl.h
> @@ -360,7 +360,7 @@ test_mt1(int (*test)(void *))
> /* signal worker to start test */
> __atomic_store_n(&wrk_cmd, WRK_CMD_RUN, __ATOMIC_RELEASE);
>
> - usleep(run_time * US_PER_S);
> + rte_delay_us(run_time * US_PER_S);
>
> /* signal worker to start test */
> __atomic_store_n(&wrk_cmd, WRK_CMD_STOP, __ATOMIC_RELEASE);
> diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c
> index 18b93db8ef..73eee293a1 100644
> --- a/app/test/test_telemetry_data.c
> +++ b/app/test/test_telemetry_data.c
> @@ -4,7 +4,9 @@
>
> #include <string.h>
> #include <sys/socket.h>
> +#ifndef RTE_EXEC_ENV_WINDOWS
> #include <sys/un.h>
> +#endif
> #include <unistd.h>
> #include <limits.h>
>
> --
> 2.31.0.vfs.0.1
lgtm
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
@@ -8,8 +8,6 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
-#include <netinet/in.h>
-#include <termios.h>
#include <inttypes.h>
#include <errno.h>
#include <sys/queue.h>
@@ -5,6 +5,7 @@
#include <rte_byteorder.h>
#include <rte_mbuf.h>
#include <rte_ip.h>
+#include <rte_os_shim.h>
#include "packet_burst_generator.h"
@@ -7,12 +7,14 @@
#include <errno.h> /* errno */
#include <limits.h> /* PATH_MAX */
+#ifndef RTE_EXEC_ENV_WINDOWS
#include <libgen.h> /* basename et al */
+#include <sys/wait.h>
+#endif
#include <stdlib.h> /* NULL */
#include <string.h> /* strerror */
#include <unistd.h> /* readlink */
#include <dirent.h>
-#include <sys/wait.h>
#include <rte_string_fns.h> /* strlcpy */
@@ -8,7 +8,6 @@
#include <stdarg.h>
#include <stdlib.h>
#include <errno.h>
-#include <termios.h>
#include <ctype.h>
#include <sys/queue.h>
@@ -63,7 +62,9 @@ do_recursive_call(void)
const char *env_var;
int (*action_fn)(void);
} actions[] = {
+#ifndef RTE_EXEC_ENV_WINDOWS
{ "run_secondary_instances", test_mp_secondary },
+#endif
#ifdef RTE_LIB_PDUMP
#ifdef RTE_NET_RING
{ "run_pdump_server_tests", test_pdump },
@@ -82,7 +83,9 @@ do_recursive_call(void)
{ "test_file_prefix", no_action },
{ "test_no_huge_flag", no_action },
#ifdef RTE_LIB_TIMER
+#ifndef RTE_EXEC_ENV_WINDOWS
{ "timer_secondary_spawn_wait", test_timer_secondary },
+#endif
#endif
};
@@ -46,7 +46,7 @@ test_byteorder(void)
return -1;
res_u16 = rte_bswap16(0x1337);
- printf("const %"PRIx16" -> %"PRIx16"\n", 0x1337, res_u16);
+ printf("const %"PRIx16" -> %"PRIx16"\n", (uint16_t)0x1337, res_u16);
if (res_u16 != 0x3713)
return -1;
@@ -1,12 +1,9 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
*/
-
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
#include <rte_string_fns.h>
@@ -15,7 +12,7 @@
#include "test_cmdline.h"
-#define IP4(a,b,c,d) {((uint32_t)(((a) & 0xff)) | \
+#define IP4(a,b,c,d) {.s_addr = (uint32_t)(((a) & 0xff) | \
(((b) & 0xff) << 8) | \
(((c) & 0xff) << 16) | \
((d) & 0xff) << 24)}
@@ -25,7 +22,11 @@
/* create IPv6 address, swapping bytes where needed */
#ifndef s6_addr16
-# define s6_addr16 __u6_addr.__u6_addr16
+#ifdef RTE_EXEC_ENV_WINDOWS
+#define s6_addr16 u.Word
+#else
+#define s6_addr16 __u6_addr.__u6_addr16
+#endif
#endif
#define IP6(a,b,c,d,e,f,g,h) .ipv6 = \
{.s6_addr16 = \
@@ -166,8 +167,6 @@ const char * ipaddr_garbage_network6_strs[] = {
};
#define IPv6_GARBAGE_PREFIX 64
-
-
const char * ipaddr_invalid_strs[] = {
/** IPv4 **/
@@ -8,7 +8,6 @@
#include <stdarg.h>
#include <stdlib.h>
#include <errno.h>
-#include <termios.h>
#include <ctype.h>
#include <sys/queue.h>
@@ -22,6 +21,12 @@
#include "test_cmdline.h"
+#ifndef RTE_EXEC_ENV_WINDOWS
+#define NULL_INPUT "/dev/null"
+#else
+#define NULL_INPUT "NUL"
+#endif
+
/****************************************************************/
/* static functions required for some tests */
static void
@@ -156,10 +161,10 @@ test_cmdline_socket_fns(void)
cl = cmdline_stdin_new(&ctx, NULL);
if (cl != NULL)
goto error;
- cl = cmdline_file_new(NULL, "prompt", "/dev/null");
+ cl = cmdline_file_new(NULL, "prompt", NULL_INPUT);
if (cl != NULL)
goto error;
- cl = cmdline_file_new(&ctx, NULL, "/dev/null");
+ cl = cmdline_file_new(&ctx, NULL, NULL_INPUT);
if (cl != NULL)
goto error;
cl = cmdline_file_new(&ctx, "prompt", NULL);
@@ -171,7 +176,7 @@ test_cmdline_socket_fns(void)
cmdline_free(cl);
return -1;
}
- cl = cmdline_file_new(&ctx, "prompt", "/dev/null");
+ cl = cmdline_file_new(&ctx, "prompt", NULL_INPUT);
if (cl == NULL) {
printf("Error: failed to open /dev/null for reading!");
return -1;
@@ -14,7 +14,6 @@
#define CRC32_VEC_LEN2 348
#define CRC16_VEC_LEN1 12
#define CRC16_VEC_LEN2 2
-#define LINE_LEN 75
/* CRC test vector */
static const uint8_t crc_vec[CRC_VEC_LEN] = {
@@ -6,10 +6,11 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <sys/time.h>
+#include <time.h>
#include <rte_common.h>
#include <rte_cycles.h>
+#include <rte_os_shim.h>
#include <rte_random.h>
#include <rte_malloc.h>
@@ -271,7 +272,7 @@ static int
perf_test(void)
{
int ret;
- struct timeval tv_begin, tv_end;
+ struct timespec tv_begin, tv_end;
double time_aligned, time_unaligned;
double time_aligned_const, time_unaligned_const;
@@ -298,32 +299,32 @@ perf_test(void)
printf("\n================================= %2dB aligned =================================",
ALIGNMENT_UNIT);
/* Do aligned tests where size is a variable */
- gettimeofday(&tv_begin, NULL);
+ timespec_get(&tv_begin, TIME_UTC);
perf_test_variable_aligned();
- gettimeofday(&tv_end, NULL);
+ timespec_get(&tv_end, TIME_UTC);
time_aligned = (double)(tv_end.tv_sec - tv_begin.tv_sec)
- + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000;
+ + ((double)tv_end.tv_nsec - tv_begin.tv_nsec) / NS_PER_S;
printf("\n------- ----------------- ----------------- ----------------- -----------------");
/* Do aligned tests where size is a compile-time constant */
- gettimeofday(&tv_begin, NULL);
+ timespec_get(&tv_begin, TIME_UTC);
perf_test_constant_aligned();
- gettimeofday(&tv_end, NULL);
+ timespec_get(&tv_end, TIME_UTC);
time_aligned_const = (double)(tv_end.tv_sec - tv_begin.tv_sec)
- + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000;
+ + ((double)tv_end.tv_nsec - tv_begin.tv_nsec) / NS_PER_S;
printf("\n================================== Unaligned ==================================");
/* Do unaligned tests where size is a variable */
- gettimeofday(&tv_begin, NULL);
+ timespec_get(&tv_begin, TIME_UTC);
perf_test_variable_unaligned();
- gettimeofday(&tv_end, NULL);
+ timespec_get(&tv_end, TIME_UTC);
time_unaligned = (double)(tv_end.tv_sec - tv_begin.tv_sec)
- + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000;
+ + ((double)tv_end.tv_nsec - tv_begin.tv_nsec) / NS_PER_S;
printf("\n------- ----------------- ----------------- ----------------- -----------------");
/* Do unaligned tests where size is a compile-time constant */
- gettimeofday(&tv_begin, NULL);
+ timespec_get(&tv_begin, TIME_UTC);
perf_test_constant_unaligned();
- gettimeofday(&tv_end, NULL);
+ timespec_get(&tv_end, TIME_UTC);
time_unaligned_const = (double)(tv_end.tv_sec - tv_begin.tv_sec)
- + ((double)tv_end.tv_usec - tv_begin.tv_usec)/1000000;
+ + ((double)tv_end.tv_nsec - tv_begin.tv_nsec) / NS_PER_S;
printf("\n======= ================= ================= ================= =================\n\n");
printf("Test Execution Time (seconds):\n");
@@ -296,6 +296,7 @@ reset_count(void)
idle = 0;
}
+#ifndef RTE_EXEC_ENV_WINDOWS
static void
stats_display(uint16_t port_id)
{
@@ -325,6 +326,7 @@ signal_handler(int signum)
if (signum == SIGUSR2)
stats_display(0);
}
+#endif
struct rte_mbuf **tx_burst;
@@ -638,7 +640,7 @@ exec_burst(uint32_t flags, int lcore)
i = (i >= conf->nb_ports - 1) ? 0 : (i + 1);
}
- sleep(5);
+ rte_delay_us(5 * US_PER_S);
/* only when polling second */
if (flags == SC_BURST_XMIT_FIRST)
@@ -669,8 +671,10 @@ test_pmd_perf(void)
printf("Start PMD RXTX cycles cost test.\n");
+#ifndef RTE_EXEC_ENV_WINDOWS
signal(SIGUSR1, signal_handler);
signal(SIGUSR2, signal_handler);
+#endif
nb_ports = rte_eth_dev_count_avail();
if (nb_ports < NB_ETHPORTS_USED) {
@@ -360,7 +360,7 @@ test_mt1(int (*test)(void *))
/* signal worker to start test */
__atomic_store_n(&wrk_cmd, WRK_CMD_RUN, __ATOMIC_RELEASE);
- usleep(run_time * US_PER_S);
+ rte_delay_us(run_time * US_PER_S);
/* signal worker to start test */
__atomic_store_n(&wrk_cmd, WRK_CMD_STOP, __ATOMIC_RELEASE);
@@ -4,7 +4,9 @@
#include <string.h>
#include <sys/socket.h>
+#ifndef RTE_EXEC_ENV_WINDOWS
#include <sys/un.h>
+#endif
#include <unistd.h>
#include <limits.h>