[ovs-dev] [PATCH 1/2] timeval: On Linux x86-64 systems refresh time whenever it is requested.

Ben Pfaff blp at nicira.com
Thu Aug 9 05:04:35 UTC 2012


On Wed, Aug 08, 2012 at 05:52:57PM -0700, Leo Alterman wrote:
> 64-bit glibc appears to avoid syscalls for clock_gettime(), so we can get
> higher resolution timing and avoid having a timer firing off SIGALRM
> without introducing extra overhead.
> 
> Signed-off-by: Leo Alterman <lalterman at nicira.com>

"git am" reported some trailing whitespace:

Applying: timeval: On Linux x86-64 systems refresh time whenever it is requested.
/home/blp/nicira/ovs/.git/rebase-apply/patch:108: trailing whitespace.
 * 
/home/blp/nicira/ovs/.git/rebase-apply/patch:112: trailing whitespace.
 * 
/home/blp/nicira/ovs/.git/rebase-apply/patch:121: trailing whitespace.

> +/* On Linux x86-64 systems, glibc avoids using syscalls for clock_gettime().

I don't think that this is a feature of glibc.  I think that it is a
feature of the kernel system call interface, which includes a stub that
implements clock_gettime() without doing a user-to-supervisor ring
transition and thereby avoids most of the normal system call overhead.

> +#if defined __LP64__ && defined __linux__
> +#define CACHE_TIME 0
> +#else
> +#define CACHE_TIME 1
> +#endif

I think that __LP64__ is meant to indicate that the system has "long"
and pointer types that are 64-bits wide.  (But I can't find it in the
usually comprehensive listing at predef.sf.net.)  I think it would be
better to test for __x86_64__ instead.

In test-timeval.c please add {} around the conditional statements.

Thanks,

Ben.



More information about the dev mailing list