There is a High Resolution Timer used within the dynaTrace Diagnostics agent which is used to provide the highly accurate metrics related to method invocation metrics. This Knowledge Base article provides background information regarding the various timers available and the switch options.
The dynaTrace Diagnostics Agent has an optional hirestimer=<type> parameter.
There are five choices of values for the HiResTimer switch.
- cpu On an x86 machine, this uses the RDTSC instruction. On other architectures, similar instructions are used.
- os Uses the Win32 QPC API call.
- java Uses jvmti based timer
- runtime Standard timer using getTimeOfDay()
- auto Default value
Additional Notes related to each timer
- The cpu timer is the preferred, cheapest cost and most accurate.
- The os timer only works on Win32 environments and accesses the QueryPerformanceCounter (QPC) API.
- If os is specified on a non-Win32 OS, the runtime timer is used.
- The java timer is only available in JVMs 1.5 and later.
- The java timer is usually as accurate as the cpu timer.
- The runtime timer is not really a hiResTimer, but more a fallback capability when all other choices do not work.
- The runtime timer should not be used on systems where system time is changed on the fly.
- If the HiResTimer agent argument is not specified, auto is assumed and the most appropriate timer for that environment is used. The order is java, os, cpu, runtime.
When a timer is tested, a quick sanity check is performed to confirm that the timer is returning values within an expected tolerance range. When this sanity check fails, alternate timers are tried and tested. As a fallback, the runtime timer is used and no sanity check is performed.
Starting in v2.6.1, if a timer is explicitly specified, it does not have to undergo a sanity check. This will assure, that hi-resolution times can be used on systems, where the sanity check would fail, either due to the scheduler's resolution or current system load.
The hirestimer can be specified in the java command line as an additional argument. Here's an example
Possible values for <type> are
cpu | os | java | runtime | auto.