Class TimerFactory
java.lang.Object
com.google.apphosting.runtime.timer.TimerFactory
TimerFactory
creates new Timer
instances.-
Constructor Summary
ConstructorsConstructorDescriptionTimerFactory
(long cyclesPerSecond, TimerSet... timerSets) Create aTimerFactory
. -
Method Summary
Modifier and TypeMethodDescriptiongetCpuCycleTimer
(Thread thread) Return aTimer
that counts CPU time for the specifiedThread
.getCpuRatioTimer
(Thread thread) Returns aCpuRatioTimer
that tracks both the CPU usage of the specifiedThread
and the wallclock time.getCpuRatioTimer
(ThreadGroup threadGroup) Returns aCpuRatioTimer
that tracks both the CPU usage of the specifiedThreadGroup
and the wallclock time.getThreadGroupCpuTimer
(ThreadGroup threadGroup) Return aTimer
that counts wallclock time.
-
Constructor Details
-
TimerFactory
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 Details
-
getWallclockTimer
Return aTimer
that counts wallclock time. -
getCpuCycleTimer
Return aTimer
that counts CPU time for the specifiedThread
.- Throws:
UnsupportedOperationException
- If no CPU timer is available.
-
getThreadGroupCpuTimer
-
getCpuRatioTimer
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
Returns aCpuRatioTimer
that tracks both the CPU usage of the specifiedThreadGroup
and the wallclock time.- Throws:
UnsupportedOperationException
- If thread CPU timing is not available.
-