diff mbox

[dpdk-dev,RFC,v2,1/2] lib/librte_eal: Reduce timer initialization time

Message ID 1447984428-137897-2-git-send-email-zhihong.wang@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Zhihong Wang Nov. 20, 2015, 1:53 a.m. UTC
Changing from 1/2 second to 1/10 doesn't compromise the precision, and a 4/10 second is worth saving.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Hemminger Nov. 20, 2015, 4:31 p.m. UTC | #1
On Thu, 19 Nov 2015 20:53:47 -0500
Zhihong Wang <zhihong.wang@intel.com> wrote:

> +	struct timespec sleeptime = {.tv_nsec = 1E8 }; /* 1/10 second */

Why not NSEC_PER_SEC / 10
Zhihong Wang Nov. 23, 2015, 1:29 a.m. UTC | #2
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Saturday, November 21, 2015 12:32 AM
> To: Wang, Zhihong <zhihong.wang@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH RFC v2 1/2] lib/librte_eal: Reduce timer
> initialization time
> 
> On Thu, 19 Nov 2015 20:53:47 -0500
> Zhihong Wang <zhihong.wang@intel.com> wrote:
> 
> > +	struct timespec sleeptime = {.tv_nsec = 1E8 }; /* 1/10 second */
> 
> Why not NSEC_PER_SEC / 10

Yes, it looks better using macro :)
diff mbox

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_timer.c b/lib/librte_eal/linuxapp/eal/eal_timer.c
index e0642de..4de0353 100644
--- a/lib/librte_eal/linuxapp/eal/eal_timer.c
+++ b/lib/librte_eal/linuxapp/eal/eal_timer.c
@@ -271,7 +271,7 @@  get_tsc_freq(void)
 #ifdef CLOCK_MONOTONIC_RAW
 #define NS_PER_SEC 1E9
 
-	struct timespec sleeptime = {.tv_nsec = 5E8 }; /* 1/2 second */
+	struct timespec sleeptime = {.tv_nsec = 1E8 }; /* 1/10 second */
 
 	struct timespec t_start, t_end;
 	uint64_t tsc_hz;