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 9C931A0524; Wed, 5 May 2021 23:37:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1AD8B40040; Wed, 5 May 2021 23:37:35 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id 256174003C for ; Wed, 5 May 2021 23:37:33 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id B73135C0120; Wed, 5 May 2021 17:37:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 05 May 2021 17:37:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= 8ItpnD4MU+j5d7C/Od4Wluv93SLwPAm6PViRen/sk0c=; b=KV/k1P+0QXxQ2rM+ 7Twu+WHT1X0RD1wd9syenlTbAOT4tn13fwH77Uc4rPIRS+sICjhZ25eGmdTv5Txh mVc7huhHtOxVU9TCXHm9eZq9QOcRL1csJq82K7xox8u4qK7ueSXM8nRXKMPBp2eR TfrPgIjgNblkcWHLLIhrsbJn7W6zPZ8GlLBb8qnL6E4CA9fuuYN6PnGF5fOaLllh ZruGyT7ljhjEz5GtFOdkQxC793qERyfWSmvvTMip0T+nrBjtBuGefaDOrd2nb5PI gvKf1gpbMKac2AxdaKsR7IEYzmKgCwL6SODbjeer62fO6eLrJGfp8vnkAkUBXeIP A0YnfQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=8ItpnD4MU+j5d7C/Od4Wluv93SLwPAm6PViRen/sk 0c=; b=XvEf1vdUetj/Wx8LaYOkx8oIC5oC6QcHlJbtOhN/isD7C8sJ9ksbI4vFd bbotPu9iay7LqxrYbGQVNHGgW++HXt6K5chuqLAEo/uDYih8WSyNDkDAUfYfUdc7 WAZK8OUVTO/vZuPFh3blZ3Wo+IYjz91aJTNHDF58xUbwSsmnyFQeD5cAuv9b+z2P K82EIvXtIFfkkHYM1j2OSA5PLEBJREBDglDx7wHSGnFT1o3CKIovLVNcply5NDYR 1/Z+u2SvFz1wDke+pyb44J6HYVHR5PZ1bAAtZMHQCmygJVbl2jKF2C+vurM+uExw WN7zBKm+PPPOwMv5tE51eBGpq7E/w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefkedgudehlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdej ueeiiedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 May 2021 17:37:31 -0400 (EDT) From: Thomas Monjalon To: "Min Hu (Connor)" Cc: dev@dpdk.org, ferruh.yigit@intel.com, rsanford@akamai.com, erik.g.carrillo@intel.com Date: Wed, 05 May 2021 23:37:29 +0200 Message-ID: <1986861.sBpPVbSSCl@thomas> In-Reply-To: <1618470748-12369-1-git-send-email-humin29@huawei.com> References: <1618470748-12369-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] examples/timer: fix incorrect time interval 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 Sender: "dev" 15/04/2021 09:12, Min Hu (Connor): > From: Chengchang Tang > > Timer sample example assumes that the frequency of the timer is about > 2Ghz to control the period of calling rte_timer_manage(). But this > assumption is easy to fail. For example. the frequency of tsc on ARM64 > is much less than 2Ghz. > > This patch uses the frequency of the current timer to calculate the > correct time interval to ensure consistent result on all platforms. > > In addition, the rte_rdtsc() is replaced with the more recommended > rte_get_timer_cycles function in this patch. > > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > > Signed-off-by: Chengchang Tang > Signed-off-by: Min Hu (Connor) [...] > /* > - * Call the timer handler on each core: as we don't > - * need a very precise timer, so only call > - * rte_timer_manage() every ~10ms (at 2Ghz). In a real > - * application, this will enhance performances as > - * reading the HPET timer is not efficient. > + * Call the timer handler on each core: as we don't need a > + * very precise timer, so only call rte_timer_manage() > + * every ~10ms. since rte_eal_hpet_init() has not been > + * called, the rte_rdtsc() will be used at runtime. I don't understand this last sentence. > + * In a real application, this will enhance performances > + * as reading the HPET timer is not efficient. > */ > - cur_tsc = rte_rdtsc(); > + cur_tsc = rte_get_timer_cycles();