Class QueryPerformanceNugget

java.lang.Object
io.deephaven.engine.table.impl.perf.BasePerformanceEntry
io.deephaven.engine.table.impl.perf.QueryPerformanceNugget
All Implemented Interfaces:
LogOutputAppendable, SafeCloseable, AutoCloseable

public class QueryPerformanceNugget extends BasePerformanceEntry implements SafeCloseable
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.
  • Field Details

  • Constructor Details

    • QueryPerformanceNugget

      protected QueryPerformanceNugget(long evaluationNumber, long parentEvaluationNumber, int operationNumber, int parentOperationNumber, int depth, @NotNull @NotNull String description, @Nullable @Nullable String sessionId, boolean isUser, boolean isCompilation, long inputSize, @NotNull @NotNull Consumer<QueryPerformanceNugget> onCloseCallback)
      Full constructor for nuggets.
      Parameters:
      evaluationNumber - A unique identifier for the query evaluation that triggered this nugget creation
      parentEvaluationNumber - The unique identifier of the parent evaluation or QueryConstants.NULL_LONG if none
      operationNumber - A unique identifier for the operation within a query evaluation
      parentOperationNumber - The unique identifier of the parent operation or QueryConstants.NULL_INT if none
      depth - Depth in the evaluation chain for the respective operation
      description - The operation description
      isUser - Whether this is a "user" nugget or one created by the system
      isCompilation - Whether this is a compilation nugget
      inputSize - The size of the input data
      onCloseCallback - A callback that is invoked when the nugget is closed. It returns whether the nugget should be logged.
  • Method Details

    • onBaseEntryStart

      public void onBaseEntryStart()
      Start clock epoch nanos is set if this is the first time this nugget has been started.
      Overrides:
      onBaseEntryStart in class BasePerformanceEntry
    • onBaseEntryEnd

      public void onBaseEntryEnd()
      Overrides:
      onBaseEntryEnd in class BasePerformanceEntry
    • close

      public void close()
      Mark this nugget QueryState.FINISHED and notify the recorder.

      SafeCloseable implementation for try-with-resources.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SafeCloseable
    • abort

      public void abort()
    • toString

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

      public LogOutput append(@NotNull @NotNull LogOutput logOutput)
      Specified by:
      append in interface LogOutputAppendable
      Overrides:
      append in class BasePerformanceEntry
    • getEvaluationNumber

      public long getEvaluationNumber()
    • getParentEvaluationNumber

      public long getParentEvaluationNumber()
    • getOperationNumber

      public int getOperationNumber()
    • getParentOperationNumber

      public int getParentOperationNumber()
    • getDepth

      public int getDepth()
    • getDescription

      public String getDescription()
    • getSessionId

      @Nullable public @Nullable String getSessionId()
    • isUser

      public boolean isUser()
    • isCompilation

      public boolean isCompilation()
    • isQueryLevel

      public boolean isQueryLevel()
    • isTopLevelQuery

      public boolean isTopLevelQuery()
    • isTopLevelOperation

      public boolean isTopLevelOperation()
    • getInputSize

      public long getInputSize()
    • getAuthContext

      public AuthContext getAuthContext()
      Returns:
      The AuthContext that was installed when this QueryPerformanceNugget was constructed
    • getCallerLine

      public String getCallerLine()
    • getStartClockEpochNanos

      public long getStartClockEpochNanos()
      Returns:
      wall clock start time in nanoseconds from the epoch
    • getEndClockEpochNanos

      public long getEndClockEpochNanos()
      Returns:
      wall clock end time in nanoseconds from the epoch
    • 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 watermark) memory difference between time of completion and creation
    • getDiffCollections

      public long getDiffCollections()
      Returns:
      Number of garbage collections between time of completion and creation
    • getDiffCollectionTimeNanos

      public long getDiffCollectionTimeNanos()
      Returns:
      Time spent in garbage collection, in milliseconds, between time of completion and creation
    • wasInterrupted

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