Class TimerFactory
- java.lang.Object
-
- com.google.apphosting.runtime.timer.TimerFactory
-
public class TimerFactory extends Object
TimerFactory
creates newTimer
instances.
-
-
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 Timer
getCpuCycleTimer(Thread thread)
Return aTimer
that counts CPU time for the specifiedThread
.CpuRatioTimer
getCpuRatioTimer(Thread thread)
Returns aCpuRatioTimer
that tracks both the CPU usage of the specifiedThread
and the wallclock time.CpuRatioTimer
getCpuRatioTimer(ThreadGroup threadGroup)
Returns aCpuRatioTimer
that tracks both the CPU usage of the specifiedThreadGroup
and the wallclock time.Timer
getThreadGroupCpuTimer(ThreadGroup threadGroup)
Timer
getWallclockTimer()
Return aTimer
that 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 moreTimerSet
instances 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 aTimer
that counts wallclock time.
-
getCpuCycleTimer
public Timer getCpuCycleTimer(Thread thread)
Return aTimer
that 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 aCpuRatioTimer
that tracks both the CPU usage of the specifiedThread
and the wallclock time.- Throws:
UnsupportedOperationException
- If thread CPU timing is not available.
-
getCpuRatioTimer
public CpuRatioTimer getCpuRatioTimer(ThreadGroup threadGroup)
Returns aCpuRatioTimer
that tracks both the CPU usage of the specifiedThreadGroup
and the wallclock time.- Throws:
UnsupportedOperationException
- If thread CPU timing is not available.
-
-