Class QueryPerformanceNugget

java.lang.Object
com.illumon.iris.db.tables.utils.QueryPerformanceNugget
All Implemented Interfaces:
Serializable, AutoCloseable

public class QueryPerformanceNugget extends Object implements Serializable, AutoCloseable
Per-operation instrumentation node for hierarchical performance recording. Note that this class has an unusually intimate relationship with another class, QueryPerformanceRecorder. Changes to either should take this lack of encapsulation into account.
See Also:
  • Method Details

    • done

      public void done()
    • done

      public boolean done(QueryPerformanceRecorder recorder)
      Mark this nugget QueryState.FINISHED and notify the recorder.
      Parameters:
      recorder - The recorder to notify
      Returns:
      if the nugget passes logging thresholds.
    • close

      public void close()
      AutoCloseable implementation - wraps the no-argument version of done() used by query code outside of the QueryPerformance(Recorder/Nugget), reporting successful completion to the thread-local QueryPerformanceRecorder instance.
      Specified by:
      close in interface AutoCloseable
    • abort

      public void abort(QueryPerformanceRecorder recorder)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getName

      public String getName()
    • isUser

      public boolean isUser()
    • isTopLevel

      public boolean isTopLevel()
    • getInputSize

      public long getInputSize()
    • getCallerLine

      public String getCallerLine()
    • getTotalTime

      public Long getTotalTime()
      Returns:
      nanoseconds elapsed, once state != QueryState.RUNNING() has been called.
    • getStartClockTime

      public long getStartClockTime()
      Returns:
      wall clock time in milliseconds from the epoch
    • getCpuNanos

      public long getCpuNanos()
      Get nanoseconds of CPU time attributed to the instrumented operation.
      Returns:
      The nanoseconds of CPU time attributed to the instrumented operation, or QueryConstants.NULL_LONG if not enabled/supported.
    • getUserCpuNanos

      public long getUserCpuNanos()
      Get nanoseconds of user mode CPU time attributed to the instrumented operation.
      Returns:
      The nanoseconds of user mode CPU time attributed to the instrumented operation, or QueryConstants.NULL_LONG if not enabled/supported.
    • getEndFreeMemory

      public long getEndFreeMemory()
      Returns:
      free memory at completion
    • getEndTotalMemory

      public long getEndTotalMemory()
      Returns:
      total memory used at completion
    • getDiffFreeMemory

      public long getDiffFreeMemory()
      Returns:
      free memory difference between time of completion and creation
    • getDiffTotalMemory

      public long getDiffTotalMemory()
      Returns:
      total (allocated high water mark) memory difference between time of completion and creation
    • getAllocatedBytes

      public long getAllocatedBytes()
      Get bytes of allocated memory attributed to the instrumented operation.
      Returns:
      The bytes of allocated memory attributed to the instrumented operation, or QueryConstants.NULL_LONG if not enabled/supported.
    • getPoolAllocatedBytes

      public long getPoolAllocatedBytes()
      Get bytes of allocated pooled/reusable memory attributed to the instrumented operation.
      Returns:
      The bytes of allocated pooled/reusable memory attributed to the instrumented operation, or QueryConstants.NULL_LONG if not enabled/supported.
    • getFirstTimeDataReads

      public long getFirstTimeDataReads()
      Returns:
      number of first time data reads that occurred during this query
    • getAverageFirstTimeDataReadTime

      public double getAverageFirstTimeDataReadTime()
      Returns:
      average first time data read duration in nanos
    • getRepeatedDataReads

      public long getRepeatedDataReads()
      Returns:
      number of repeated data reads that occurred during this query
    • getAverageRepeatedDataReadTime

      public double getAverageRepeatedDataReadTime()
      Returns:
      average repeated data read duration in nanos
    • wasInterrupted

      public boolean wasInterrupted()
      Returns:
      true if this nugget was interrupted by an abort() call.
    • addSubEntry

      public void addSubEntry(UpdatePerformanceTracker.SubEntry subEntry)
      When we track data from other threads that should be attributed to this operation, we tack extra SubEntry values onto this nugget when it is closed. The CPU time, reads, and allocations are counted against this nugget. Wall clock time is ignored.