1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Ericsson AB
8 #include <rte_common.h>
9 #include <rte_cycles.h>
10 #include <rte_random.h>
14 static volatile uint64_t vsum;
16 #define ITERATIONS (100000000)
23 rand_type_desc(enum rand_type rand_type)
27 return "Full 64-bit [rte_rand()]";
33 static __rte_always_inline void
34 test_rand_perf_type(enum rand_type rand_type)
44 for (i = 0; i < ITERATIONS; i++) {
54 /* to avoid an optimizing compiler removing the whole loop */
57 op_latency = (end - start) / ITERATIONS;
59 printf("%s: %"PRId64" TSC cycles/op\n", rand_type_desc(rand_type),
68 printf("Pseudo-random number generation latencies:\n");
70 test_rand_perf_type(rand_type_64);
75 REGISTER_TEST_COMMAND(rand_perf_autotest, test_rand_perf);