2.5. gettimeofday speedup

2.5. gettimeofday speedup

Many application workloads (especially databases and financial service applications) perform extremely frequent gettimeofday or similar time function calls. Optimizing the efficiency of this calls can provide major benefits.

Enable gettimeofday with VDSO

There is a Virtual Dynamic Shared Object (VDSO) implemented in the glibc runtime library. The VDSO maps some of the kernel code, which is necessary to read gettimeofday in the user-space. Standard Red Hat Enterprise Linux 5.1 allows the gettimeofday function to be performed entirely in user-space, removing the system call overhead.

  1. VDSO behavior is not enabled by default and must be enabled on a global basis. You will need to echo a parameter of 2 to the gettimeofday function:

    # echo 2 > /proc/sys/kernel/vsyscall64
    
  2. In addition to the above, the MRG Realtime kernel includes a further gettimeofday performance optimization. See Section 3.2, “MRG Realtime Specific gettimeofday speedup”.

Important

Currently the gettimeofday speed up is implemented only for 64 bit architectures (AMD64 and Intel 64) and is not available on x86 machines.

Related Manual Pages

For more information, or for further reading, the following man pages are related to the information given in this section.