Class TimerFactory
- java.lang.Object
-
- com.google.apphosting.runtime.timer.TimerFactory
-
public class TimerFactory extends Object
TimerFactorycreates newTimerinstances.
-
-
Constructor Summary
Constructors Constructor Description TimerFactory(long cyclesPerSecond, TimerSet... timerSets)Create aTimerFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimergetCpuCycleTimer(Thread thread)Return aTimerthat counts CPU time for the specifiedThread.CpuRatioTimergetCpuRatioTimer(Thread thread)Returns aCpuRatioTimerthat tracks both the CPU usage of the specifiedThreadand the wallclock time.CpuRatioTimergetCpuRatioTimer(ThreadGroup threadGroup)Returns aCpuRatioTimerthat tracks both the CPU usage of the specifiedThreadGroupand the wallclock time.TimergetThreadGroupCpuTimer(ThreadGroup threadGroup)TimergetWallclockTimer()Return aTimerthat counts wallclock time.
-
-
-
Constructor Detail
-
TimerFactory
public TimerFactory(long cyclesPerSecond, TimerSet... timerSets)Create aTimerFactory.- Parameters:
cyclesPerSecond- Speed of the processor in clock cycles per secondtimerSets- Zero or moreTimerSetinstances that will become additional timers associated with the returnedCpuRatioTimer. This is useful for tracking CPU usage outside of a request thread, such as hotspot or GC.
-
-
Method Detail
-
getWallclockTimer
public Timer getWallclockTimer()
Return aTimerthat counts wallclock time.
-
getCpuCycleTimer
public Timer getCpuCycleTimer(Thread thread)
Return aTimerthat counts CPU time for the specifiedThread.- Throws:
UnsupportedOperationException- If no CPU timer is available.
-
getThreadGroupCpuTimer
public Timer getThreadGroupCpuTimer(ThreadGroup threadGroup)
-
getCpuRatioTimer
public CpuRatioTimer getCpuRatioTimer(Thread thread)
Returns aCpuRatioTimerthat tracks both the CPU usage of the specifiedThreadand the wallclock time.- Throws:
UnsupportedOperationException- If thread CPU timing is not available.
-
getCpuRatioTimer
public CpuRatioTimer getCpuRatioTimer(ThreadGroup threadGroup)
Returns aCpuRatioTimerthat tracks both the CPU usage of the specifiedThreadGroupand the wallclock time.- Throws:
UnsupportedOperationException- If thread CPU timing is not available.
-
-