Class UnmodifiableTimingSession


  • public final class UnmodifiableTimingSession
    extends TimingSession

    A "wrapper" class that allows retrieving values from an existing TimingSession but prevents users from modifying it.

    Since:
    2.4.0
    Author:
    oswaldo.bapvic.jr
    See Also:
    TimingSession
    • Method Detail

      • reset

        public void reset()
        Description copied from class: TimingSession
        Resets all counters associated with this timing session.
        Overrides:
        reset in class TimingSession
      • isStarted

        public boolean isStarted()
        Description copied from class: TimingSession
        Returns true if this timing session is started.
        Overrides:
        isStarted in class TimingSession
        Returns:
        true if the timing session is started; otherwise, false
      • elapsedTime

        public Duration elapsedTime​(Counter.Type type)
        Description copied from class: TimingSession
        A convenient method that returns the elapsed time of a specific counter.

        This has the same effect as calling: timingSession.getCounter(type).elapsedTime()

        Overrides:
        elapsedTime in class TimingSession
        Parameters:
        type - the counter type to be fetched
        Returns:
        the elapsed time for the specified counter
      • elapsedTime

        public double elapsedTime​(Counter.Type type,
                                  TimeUnit timeUnit)
        Description copied from class: TimingSession
        A convenient method that returns the elapsed time of a specific counter, in the specified time unit.

        This has the same effect as calling: timingSession.getCounter(type).elapsedTime(timeUnit)

        Overrides:
        elapsedTime in class TimingSession
        Parameters:
        type - the counter type to be fetched
        timeUnit - the time unit to which the elapsed time will be converted
        Returns:
        the elapsed time for the specified counter, converted to the given time unit using the default conversion mode.
      • elapsedTime

        public double elapsedTime​(Counter.Type type,
                                  TimeUnit timeUnit,
                                  ConversionMode conversionMode)
        Description copied from class: TimingSession
        A convenient method that returns the elapsed time of a specific counter, in the specified time unit, by applying a custom ConversionMode.

        This has the same effect as calling: timingSession.getCounter(type).elapsedTime(timeUnit, conversionMode)

        Overrides:
        elapsedTime in class TimingSession
        Parameters:
        type - the counter type to be fetched
        timeUnit - the time unit to which the elapsed time will be converted
        conversionMode - the ConversionMode to be applied
        Returns:
        the elapsed time for the specified counter, converted to the given time unit using the given conversion mode.