Package com.atlassian.crowd.common.util
Class TimedCalls
java.lang.Object
com.atlassian.crowd.common.util.TimedCalls
Simple utility class to record execution time.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDuration
(String name, long duration) Records duration with given name.static TimedCalls
Detaches and returns instance for the current thread.Returns map of timer name to it's total duration.static TimedCalls
Creates new instance and attaches it to the current thread.void
Finishes timer and logs duration.static TimedCalls
Returns instance attached to the current thread.getTopTimersToString
(int count) Returns string representations of longest timers.getTopTimersToString
(long totalTimeMs, int count) Returns string representations of longest timers.void
startTimer
(String name) Starts new timer.
-
Constructor Details
-
TimedCalls
public TimedCalls()
-
-
Method Details
-
addDuration
Records duration with given name. -
startTimer
Starts new timer. Finishes the previous timer, if not yet finished. -
finishTimer
public void finishTimer()Finishes timer and logs duration. -
createDurationMap
Returns map of timer name to it's total duration. -
getTopTimersToString
Returns string representations of longest timers. -
getTopTimersToString
Returns string representations of longest timers. -
getInstance
Returns instance attached to the current thread. -
clearInstance
Detaches and returns instance for the current thread. -
createInstanceForCurrentThread
Creates new instance and attaches it to the current thread.
-