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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDuration(String name, long duration) Records duration with given name.static TimedCallsDetaches and returns instance for the current thread.Returns map of timer name to it's total duration.static TimedCallsCreates new instance and attaches it to the current thread.voidFinishes timer and logs duration.static TimedCallsReturns 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.voidstartTimer(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.
-