Class TimedCalls

java.lang.Object
com.atlassian.crowd.common.util.TimedCalls

public class TimedCalls extends Object
Simple utility class to record execution time.
  • Constructor Details

    • TimedCalls

      public TimedCalls()
  • Method Details

    • addDuration

      public void addDuration(String name, long duration)
      Records duration with given name.
    • startTimer

      public void startTimer(String name)
      Starts new timer. Finishes the previous timer, if not yet finished.
    • finishTimer

      public void finishTimer()
      Finishes timer and logs duration.
    • createDurationMap

      public Map<String,Long> createDurationMap()
      Returns map of timer name to it's total duration.
    • getTopTimersToString

      public List<String> getTopTimersToString(int count)
      Returns string representations of longest timers.
    • getTopTimersToString

      public List<String> getTopTimersToString(long totalTimeMs, int count)
      Returns string representations of longest timers.
    • getInstance

      public static TimedCalls getInstance()
      Returns instance attached to the current thread.
    • clearInstance

      public static TimedCalls clearInstance()
      Detaches and returns instance for the current thread.
    • createInstanceForCurrentThread

      public static TimedCalls createInstanceForCurrentThread()
      Creates new instance and attaches it to the current thread.