Mac OS X System.nanoTime Improvements

Thomas Schatzl thomas.schatzl at oracle.com
Wed May 15 00:14:32 PDT 2013


Hi all,

On Wed, 2013-05-15 at 01:35 +0400, Dennis Ushakov wrote:
> On May 15, 2013, at 12:53 AM, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:
> > Any clue how this performs with the CPU power management interventions?
> Unfortunately documentation on these functions is very sparse, only topic except usage example says that mach_absolute_time() is absolute time value for current wall clock time in units (https://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KernelProgramming/services/services.html#//apple_ref/doc/uid/TP30000905-CH219-CHDGFEFE, Handling Version Dependencies section)

One alternative (not sure if already considered) is clock_get_time()
with the SYSTEM_CLOCK clock.
(http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/clock_get_time.html)

It is guaranteed to be increasing and monotonic according to the source
(http://opensource.apple.com/source/xnu/xnu-344.2/osfmk/mach/clock_types.h)

It's precision is nanoseconds, don't know about accuracy or how fast the
call(s) are.

Maybe this helps,
Thomas




More information about the hotspot-dev mailing list