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 <xiangxia.m.yue@gmail.com>
dev
Tonghao Zhang 2017-08-30 19:48:48 -07:00
parent a7b42f3d80
commit 1bdefaef52
1 changed files with 5 additions and 0 deletions

View File

@ -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;
}