Interface IOStatisticsContext

All Superinterfaces:
IOStatisticsSource
All Known Implementing Classes:
IOStatisticsContextImpl

public interface IOStatisticsContext extends IOStatisticsSource
An interface defined to capture thread-level IOStatistics by using per thread context.

The aggregator should be collected in their constructor by statistics-generating classes to obtain the aggregator to update across all threads.

The snapshot() call creates a snapshot of the statistics;

The reset() call resets the statistics in the context so that later snapshots will get the incremental data.

  • Method Details

    • getAggregator

      IOStatisticsAggregator getAggregator()
      Get the IOStatisticsAggregator for the context.
      Returns:
      return the aggregator for the context.
    • snapshot

      Capture the snapshot of the context's IOStatistics.
      Returns:
      IOStatisticsSnapshot for the context.
    • getID

      long getID()
      Get a unique ID for this context, for logging purposes.
      Returns:
      an ID unique for all contexts in this process.
    • reset

      void reset()
      Reset the context's IOStatistics.
    • getCurrentIOStatisticsContext

      static IOStatisticsContext getCurrentIOStatisticsContext()
      Get the context's IOStatisticsContext.
      Returns:
      instance of IOStatisticsContext for the context.
    • setThreadIOStatisticsContext

      static void setThreadIOStatisticsContext(IOStatisticsContext statisticsContext)
      Set the IOStatisticsContext for the current thread.
      Parameters:
      statisticsContext - IOStatistics context instance for the current thread. If null, the context is reset.
    • enabled

      static boolean enabled()
      Static probe to check if the thread-level IO statistics enabled.
      Returns:
      if the thread-level IO statistics enabled.