Class QueryPerformanceRecorderImpl
java.lang.Object
io.deephaven.engine.table.impl.perf.QueryPerformanceRecorderImpl
- All Implemented Interfaces:
QueryPerformanceRecorder
Query performance instrumentation implementation. Manages a hierarchy of
QueryPerformanceNugget
instances.
Many methods are synchronized to 1) support external abort of query and 2) for scenarios where the query is suspended and resumed on another thread.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.perf.QueryPerformanceRecorder
QueryPerformanceRecorder.QueryDataConsumer
-
Field Summary
Fields inherited from interface io.deephaven.engine.table.impl.perf.QueryPerformanceRecorder
UNINSTRUMENTED_CODE_DESCRIPTION
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort a query.void
accumulate
(@NotNull QueryPerformanceRecorder subQuery) Accumulate performance information from another recorder into this one.boolean
endQuery()
End a query.getCompilationNugget
(@NotNull String name) Create a nugget at the top of the user stack for a compilation task.This is the nugget enclosing the current operation.Create a nugget at the top of the user stack.This getter should be called by exclusive owners of the recorder, and never concurrently with mutators.getState()
Return the query's current stateboolean
Resumes a suspend query.Starts a query.void
supplyQueryData
(@NotNull QueryPerformanceRecorder.QueryDataConsumer consumer) Provide current query data via the consumer.void
Suspends a query.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.engine.table.impl.perf.QueryPerformanceRecorder
getNugget
-
Method Details
-
abortQuery
public void abortQuery()Description copied from interface:QueryPerformanceRecorder
Abort a query.A query is
RUNNING
if it has beenstarted
orresumed
without a subsequentend
,suspend
, or abort.Note that this method is invoked out-of-band and does not throw if the query has been completed.
- Specified by:
abortQuery
in interfaceQueryPerformanceRecorder
-
getState
Return the query's current state- Specified by:
getState
in interfaceQueryPerformanceRecorder
- Returns:
- the query's state or null if it isn't initialized yet
-
startQuery
Description copied from interface:QueryPerformanceRecorder
Starts a query.A query is
RUNNING
if it has been started orresumed
without a subsequentend
,suspend
, orabort
.- Specified by:
startQuery
in interfaceQueryPerformanceRecorder
-
endQuery
public boolean endQuery()Description copied from interface:QueryPerformanceRecorder
End a query.A query is
RUNNING
if it has beenstarted
orresumed
without a subsequent end,suspend
, orabort
.- Specified by:
endQuery
in interfaceQueryPerformanceRecorder
- Returns:
- whether the query should be logged
-
suspendQuery
public void suspendQuery()Suspends a query.This resets the thread local and assumes that this performance nugget may be resumed on another thread.
- Specified by:
suspendQuery
in interfaceQueryPerformanceRecorder
-
resumeQuery
Resumes a suspend query.It is an error to resume a query while another query is running on this thread.
- Specified by:
resumeQuery
in interfaceQueryPerformanceRecorder
- Returns:
- this
-
getNugget
Description copied from interface:QueryPerformanceRecorder
Create a nugget at the top of the user stack. May return aQueryPerformanceNugget.DUMMY_NUGGET
if no recorder is installed.- Specified by:
getNugget
in interfaceQueryPerformanceRecorder
- Parameters:
name
- the nugget nameinputSize
- the nugget's input size- Returns:
- A new QueryPerformanceNugget to encapsulate user query operations.
QueryPerformanceNugget.close()
must be called on the nugget.
-
getCompilationNugget
Description copied from interface:QueryPerformanceRecorder
Create a nugget at the top of the user stack for a compilation task. May return aQueryPerformanceNugget.DUMMY_NUGGET
if no recorder is installed.- Specified by:
getCompilationNugget
in interfaceQueryPerformanceRecorder
- Parameters:
name
- the nugget name- Returns:
- A new QueryPerformanceNugget to encapsulate the compilation.
QueryPerformanceNugget.close()
must be called on the nugget.
-
getEnclosingNugget
Description copied from interface:QueryPerformanceRecorder
This is the nugget enclosing the current operation. It may belong to the dummy recorder, or a real one.- Specified by:
getEnclosingNugget
in interfaceQueryPerformanceRecorder
- Returns:
- Either a "catch-all" nugget, or the top of the user nugget stack.
-
supplyQueryData
Description copied from interface:QueryPerformanceRecorder
Provide current query data via the consumer.- Specified by:
supplyQueryData
in interfaceQueryPerformanceRecorder
- Parameters:
consumer
- a callback to receive query data
-
getQueryLevelPerformanceData
- Specified by:
getQueryLevelPerformanceData
in interfaceQueryPerformanceRecorder
- Returns:
- the query level performance data
-
getOperationLevelPerformanceData
Description copied from interface:QueryPerformanceRecorder
This getter should be called by exclusive owners of the recorder, and never concurrently with mutators.- Specified by:
getOperationLevelPerformanceData
in interfaceQueryPerformanceRecorder
- Returns:
- A list of loggable operation performance data.
-
accumulate
Description copied from interface:QueryPerformanceRecorder
Accumulate performance information from another recorder into this one. The provided recorder will not be mutated.- Specified by:
accumulate
in interfaceQueryPerformanceRecorder
- Parameters:
subQuery
- the recorder to accumulate into this
-
hasSubQueries
public boolean hasSubQueries()- Specified by:
hasSubQueries
in interfaceQueryPerformanceRecorder
- Returns:
- whether a sub-query was ever accumulated into this recorder
-