Class TimeTracker


  • public final class TimeTracker
    extends Object
    A time tracker class to measure time spent on different sections of PMD analysis. The class is thread-aware, allowing to differentiate CPU and wall clock time.
    Author:
    Juan Martín Sotuyo Dodero
    • Method Detail

      • startGlobalTracking

        public static void startGlobalTracking()
        Starts global tracking. Allows tracking operations to take place and starts the wall clock. Must be called once PMD starts if tracking is desired, no tracking will be performed otherwise.
      • stopGlobalTracking

        public static TimingReport stopGlobalTracking()
        Stops global tracking. Stops the wall clock. All further operations will be treated as NOOP.
        Returns:
        The timed data obtained through the run.
      • initThread

        public static void initThread()
        Initialize a thread, starting to track it's own time.
      • finishThread

        public static void finishThread()
        Finishes tracking a thread.
      • startOperation

        public static TimedOperation startOperation​(TimedOperationCategory category)
        Starts tracking an operation.
        Parameters:
        category - The category under which to track the operation.
        Returns:
        The current timed operation being tracked.
      • startOperation

        public static TimedOperation startOperation​(TimedOperationCategory category,
                                                    String label)
        Starts tracking an operation.
        Parameters:
        category - The category under which to track the operation.
        label - A label to be added to the category. Allows to differentiate measures within a single category.
        Returns:
        The current timed operation being tracked.