From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 4B51A4C74 for ; Thu, 27 Dec 2018 05:14:18 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AB0D9EBD; Wed, 26 Dec 2018 20:14:17 -0800 (PST) Received: from net-debian.shanghai.arm.com (net-debian.shanghai.arm.com [10.169.36.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E38AC3F5AF; Wed, 26 Dec 2018 20:14:15 -0800 (PST) From: Gavin Hu To: dev@dpdk.org Cc: thomas@monjalon.net, jerinj@marvell.com, hemant.agrawal@nxp.com, bruce.richardson@intel.com, chaozhu@linux.vnet.ibm.com, Honnappa.Nagarahalli@arm.com, stephen@networkplumber.org, david.marchand@redhat.com, nd@arm.com, Gavin Hu Date: Thu, 27 Dec 2018 12:13:46 +0800 Message-Id: <20181227041349.3058-4-gavin.hu@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181227041349.3058-1-gavin.hu@arm.com> References: <20181227041349.3058-1-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v3 3/6] test/spinlock: get timestamp more precisely X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Dec 2018 04:14:18 -0000 To precisely benchmark the spinlock performance, uses the precise version of getting timestamps, which enforces the timestamps are obtained at the expected places. Signed-off-by: Gavin Hu Reviewed-by: Phil Yang --- test/test/test_spinlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test/test_spinlock.c b/test/test/test_spinlock.c index 6795195ae..648474833 100644 --- a/test/test/test_spinlock.c +++ b/test/test/test_spinlock.c @@ -113,14 +113,14 @@ load_loop_fn(void *func_param) if (lcore != rte_get_master_lcore()) while (rte_atomic32_read(&synchro) == 0); - begin = rte_get_timer_cycles(); + begin = rte_rdtsc_precise(); while (time_diff < hz * TIME_MS / 1000) { if (use_lock) rte_spinlock_lock(&lk); lcount++; if (use_lock) rte_spinlock_unlock(&lk); - time_diff = rte_get_timer_cycles() - begin; + time_diff = rte_rdtsc_precise() - begin; } lock_count[lcore] = lcount; return 0; -- 2.11.0