From 1bdefaef529486d1eb6cea7083ab39ded3b9e994 Mon Sep 17 00:00:00 2001 From: Tonghao Zhang Date: Wed, 30 Aug 2017 19:48:48 -0700 Subject: [PATCH] redis: Use the ff_gettimeofday instead of gettimeofday. In the redis, the gettimeofday uses too much CPU, even using the vdso. This patch is useful to avoid wasting CPU cycles and improve the performance. Signed-off-by: Tonghao Zhang --- app/redis-3.2.8/src/ae.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/redis-3.2.8/src/ae.c b/app/redis-3.2.8/src/ae.c index 58514943..06df4df4 100644 --- a/app/redis-3.2.8/src/ae.c +++ b/app/redis-3.2.8/src/ae.c @@ -185,7 +185,12 @@ static void aeGetTime(long *seconds, long *milliseconds) { struct timeval tv; +#ifdef HAVE_FF_KQUEUE + ff_gettimeofday(&tv, NULL); +#else gettimeofday(&tv, NULL); +#endif + *seconds = tv.tv_sec; *milliseconds = tv.tv_usec/1000; }