Class TimerFactory


  • public class TimerFactory
    extends Object
    TimerFactory creates new Timer instances.
    • Constructor Detail

      • TimerFactory

        public TimerFactory​(long cyclesPerSecond,
                            TimerSet... timerSets)
        Create a TimerFactory.
        Parameters:
        cyclesPerSecond - Speed of the processor in clock cycles per second
        timerSets - Zero or more TimerSet instances that will become additional timers associated with the returned CpuRatioTimer. This is useful for tracking CPU usage outside of a request thread, such as hotspot or GC.
    • Method Detail

      • getWallclockTimer

        public Timer getWallclockTimer()
        Return a Timer that counts wallclock time.
      • getCpuCycleTimer

        public Timer getCpuCycleTimer​(Thread thread)
        Return a Timer that counts CPU time for the specified Thread.
        Throws:
        UnsupportedOperationException - If no CPU timer is available.
      • getThreadGroupCpuTimer

        public Timer getThreadGroupCpuTimer​(ThreadGroup threadGroup)
      • getCpuRatioTimer

        public CpuRatioTimer getCpuRatioTimer​(Thread thread)
        Returns a CpuRatioTimer that tracks both the CPU usage of the specified Thread and the wallclock time.
        Throws:
        UnsupportedOperationException - If thread CPU timing is not available.
      • getCpuRatioTimer

        public CpuRatioTimer getCpuRatioTimer​(ThreadGroup threadGroup)
        Returns a CpuRatioTimer that tracks both the CPU usage of the specified ThreadGroup and the wallclock time.
        Throws:
        UnsupportedOperationException - If thread CPU timing is not available.