From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 458C342DC6; Tue, 4 Jul 2023 01:21:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1833D40F18; Tue, 4 Jul 2023 01:21:34 +0200 (CEST) Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) by mails.dpdk.org (Postfix) with ESMTP id 9C05440E03 for ; Tue, 4 Jul 2023 01:21:32 +0200 (CEST) Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-1b07d97180dso5107912fac.3 for ; Mon, 03 Jul 2023 16:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688426491; x=1691018491; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2YMwaaGEduqiu83B6waOgpsbSlzi1nihMGAgccytlsk=; b=ReRo2/ljx1kOd11OPmHiJRhfbMnh6gK+MTnnUyCXO4NMezOTlc72kbWF7KVvqTDNNL HFRKYE4jIywMRuS7+LUdit4xUEvEgILdde93Lgtq4xaNFBY0UkjnXJOU5clwtraUeMXZ 2bpQaCkUK87K3vTuY3uHZ+vrYUtKLmxsL2zT0v0Vv4BnTL/W2ZzEQ9973hOOP4vAbtV2 mwUYNw3tS9FVjigUcZ9j9GoRoYuppRlG16Tor8xurHhDtvN/ypsLFWhnH4DbEgRW5iSh PtVXO0PN7EVtGxaayA19L9rwSqffU/gLZddssjnwiVdnxIZGdusmF5u/jomnJKobgzG0 BapA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688426491; x=1691018491; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2YMwaaGEduqiu83B6waOgpsbSlzi1nihMGAgccytlsk=; b=lkWA56/KuWGr8ZfWLTpj8X0oU19isjocG4C3xPjXBLWJFINtrKVxxXV0t17n8Kn75m CH7doGINnEOQBqOAGBt48GtXvxj3zypIxhb82yU9kNH+LZarZJPjkhh0e67MHnYQd7so jOKzqril3tHfiC6e26mJ7WmkiY/3Dkzq7j/xXnbo8S1scbIO04LG/2DE5bDx5C8KV5Pq IrKJRPH3I1Afue09HspQ+EkQTaos/3ShajFQ82NHgenLbGY5OnscBAWuHGWxtdXshLy6 +VsmpfOfFTyxEunlQHhp0qXGNj2qoe7/+CsUICqiagAeg9QcAxZq5yAvR4/3d+5dN6cs zw9Q== X-Gm-Message-State: AC+VfDykP4lUUB6ZWYj2LNuQ93FzVUeKUXF+vuzjOenNtJJ5PbrPICCU DzvLEjnwEqYF+BUKeTDeOCLcHh+01c80gz4ZZtI= X-Google-Smtp-Source: ACHHUZ6nMjOiGzbUrJkov90cOT95A2fXALdDBXiUAzu/oU6wLpnT1AFO7nMji4p8DvMsuFlBSJ9rJg== X-Received: by 2002:a05:6870:cf02:b0:19f:6711:8e0a with SMTP id xf2-20020a056870cf0200b0019f67118e0amr10816452oab.32.1688426491587; Mon, 03 Jul 2023 16:21:31 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id m17-20020a17090ade1100b00263987a50fcsm4764239pjv.22.2023.07.03.16.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 16:21:31 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v2] test: remove unnecessary rte_srand Date: Mon, 3 Jul 2023 16:21:28 -0700 Message-Id: <20230703232128.121849-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230703184903.51441-1-stephen@networkplumber.org> References: <20230703184903.51441-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The random number is already initialized to a better random seed during startup process. The calls to rte_srand() are redundant and actually make entropy worse. Signed-off-by: Stephen Hemminger --- v2 - fix spelling error in commit message app/test/test_fib6_perf.c | 2 -- app/test/test_fib_perf.c | 2 -- app/test/test_hash_multiwriter.c | 2 -- app/test/test_lpm6_perf.c | 2 -- app/test/test_lpm_perf.c | 2 -- app/test/test_malloc.c | 2 -- app/test/test_memzone.c | 1 - app/test/test_reciprocal_division.c | 1 - app/test/test_reciprocal_division_perf.c | 2 -- 9 files changed, 16 deletions(-) diff --git a/app/test/test_fib6_perf.c b/app/test/test_fib6_perf.c index add20c2331b1..f5c06b4fc9d0 100644 --- a/app/test/test_fib6_perf.c +++ b/app/test/test_fib6_perf.c @@ -83,8 +83,6 @@ test_fib6_perf(void) conf.trie.nh_sz = RTE_FIB6_TRIE_4B; conf.trie.num_tbl8 = RTE_MIN(get_max_nh(conf.trie.nh_sz), 1000000U); - rte_srand(rte_rdtsc()); - printf("No. routes = %u\n", (unsigned int) NUM_ROUTE_ENTRIES); print_route_distribution(large_route_table, diff --git a/app/test/test_fib_perf.c b/app/test/test_fib_perf.c index b56293e64f41..fcf8d222d90a 100644 --- a/app/test/test_fib_perf.c +++ b/app/test/test_fib_perf.c @@ -334,8 +334,6 @@ test_fib_perf(void) int status = 0; int64_t count = 0; - rte_srand(rte_rdtsc()); - generate_large_route_rule_table(); printf("No. routes = %u\n", (unsigned int) NUM_ROUTE_ENTRIES); diff --git a/app/test/test_hash_multiwriter.c b/app/test/test_hash_multiwriter.c index 0c5a8ca18607..3b70157b433b 100644 --- a/app/test/test_hash_multiwriter.c +++ b/app/test/test_hash_multiwriter.c @@ -146,8 +146,6 @@ test_hash_multiwriter(void) tbl_multiwriter_test_params.nb_tsx_insertion) * tbl_multiwriter_test_params.nb_tsx_insertion; - rte_srand(rte_rdtsc()); - keys = rte_malloc(NULL, sizeof(uint32_t) * nb_entries, 0); if (keys == NULL) { diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c index 5b684686a687..2e79655aa89c 100644 --- a/app/test/test_lpm6_perf.c +++ b/app/test/test_lpm6_perf.c @@ -66,8 +66,6 @@ test_lpm6_perf(void) config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - rte_srand(rte_rdtsc()); - printf("No. routes = %u\n", (unsigned) NUM_ROUTE_ENTRIES); print_route_distribution(large_route_table, (uint32_t) NUM_ROUTE_ENTRIES); diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index e72437ba3850..dcc2eb375ae9 100644 --- a/app/test/test_lpm_perf.c +++ b/app/test/test_lpm_perf.c @@ -605,8 +605,6 @@ test_lpm_perf(void) uint64_t cache_line_counter = 0; int64_t count = 0; - rte_srand(rte_rdtsc()); - generate_large_route_rule_table(); printf("No. routes = %u\n", (unsigned) NUM_ROUTE_ENTRIES); diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c index ff081dd93139..b1d8be1e0491 100644 --- a/app/test/test_malloc.c +++ b/app/test/test_malloc.c @@ -692,8 +692,6 @@ test_random_alloc_free(void *_ __rte_unused) unsigned i; unsigned count = 0; - rte_srand((unsigned)rte_rdtsc()); - for (i = 0; i < N; i++){ unsigned free_mem = 0; size_t allocated_size; diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index f10f4fd9cd39..dd42f783c7ce 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -573,7 +573,6 @@ test_memzone_reserve_max_aligned(void) socket = rte_socket_id_by_idx(i); /* random alignment */ - rte_srand((unsigned int)rte_rdtsc()); const unsigned int align = 1 << ((rte_rand() % 8) + 5); /* from 128 up to 4k alignment */ /* memzone size may be between size and size - align */ diff --git a/app/test/test_reciprocal_division.c b/app/test/test_reciprocal_division.c index 8ea9b1d24d27..c70b90d2f4d7 100644 --- a/app/test/test_reciprocal_division.c +++ b/app/test/test_reciprocal_division.c @@ -32,7 +32,6 @@ test_reciprocal(void) struct rte_reciprocal reci_u32 = {0}; struct rte_reciprocal_u64 reci_u64 = {0}; - rte_srand(rte_rdtsc()); printf("Validating unsigned 32bit division.\n"); for (i = 0; i < MAX_ITERATIONS; i++) { /* Change divisor every DIVIDE_ITER iterations. */ diff --git a/app/test/test_reciprocal_division_perf.c b/app/test/test_reciprocal_division_perf.c index 4f625873e53a..3d25be71cae5 100644 --- a/app/test/test_reciprocal_division_perf.c +++ b/app/test/test_reciprocal_division_perf.c @@ -37,8 +37,6 @@ test_reciprocal_division_perf(void) struct rte_reciprocal reci_u32 = {0}; struct rte_reciprocal_u64 reci_u64 = {0}; - rte_srand(rte_rdtsc()); - printf("Validating unsigned 32bit division.\n"); for (i = 0; i < MAX_ITERATIONS; i++) { /* Change divisor every DIVIDE_ITER iterations. */ -- 2.39.2