This patch adds very low-overhead access to high-resolution process virtual time and, optionally, high-resolution virutalized user and system time. The timers are based on the CPU cycle counter and can be read at memory access speeds. Low overhead access to high-resolution process time is critical many profiling and benchmarking applications.
While other systems have offered access to high-resolution process time, they have required access through a system call interface.
This approach uses an extra per-pid entry, /proc/PID/hrtime, that contains timing values; these values can be mmapped into a user's address space. For convenience, a library is also provided that performs the mmaping and timer querying work for you.
These routines work both for a process timing itself and a process timing another process.
This work was done as part of the Paradyn Parallel Performance Tools project.
Processes that call hrtime_init and then fork will not get correct timing results when calling libhrtime functions from the child process. The parent process will continue to get correct results. This will be addressed with version 0.7 of the hrtime patch.
Users of versions 0.6 and earlier are strongly encouraged to upgrade to the latest version of the library and patch. There was a bug in the kernel patch that caused page reference counting errors if a process had mmaped any timing page and then forked. Version 0.6.1 is an interim release that addresses this issue.
Changes since 0.6:
Changes since 0.5:
get_hrtime 80 cycles get_hrvtime 110 cycles get_hrutime 116 cycles get_hrstime 103 cycles get_hrtime_self 71 cycles get_hrvtime_self 88 cycles get_hrutime_self 89 cycles get_hrstime_self 14 cyclesThese values were measured on a dual PIII 450.
Release 0.4 is the first public release of the high-resolution timer patch and library.