Class QueryPerformanceRecorder
- All Implemented Interfaces:
- Serializable
QueryPerformanceNugget instances.
 Thread-safety note: This used to be thread-safe only by virtue of using a thread-local instance. Now it's aggressively synchronized so we can abort it from outside the "owner" thread.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidThis is for use by the RemoteQueryProcessor.static voidClear any previously set callsite.booleanendQuery()This is for use by the RemoteQueryProcessor.static voidDeprecated.No longer used.static Stringstatic longstatic longstatic QueryPerformanceRecorderio.deephaven.enterprise.auth.UserContextstatic longGet the total bytes of pool-allocated memory attributed to this thread viarecordPoolAllocation(Supplier).io.deephaven.enterprise.auth.UserContextstatic longstatic longgetState()Return the query's current statestatic voidrecordFirstTimeDataRead(long durationNanos) static <RESULT_TYPE>
 RESULT_TYPErecordPoolAllocation(Supplier<RESULT_TYPE> operation) Record a single-threaded operation's allocations as "pool" allocated memory attributable to the current thread.static voidrecordRepeatedDataRead(long durationNanos) static voidstatic booleanAttempt to compute and set the thread local callsite so that invocations ofgetCallerLine()will not spend time trying to recompute.static booleansetCallsite(String callsite) Attempt to set the thread local callsite so that invocations ofgetCallerLine()will not spend time trying to recompute.voidDeprecated.Recording the caller line is now enabled for all nuggets by default.voidstartQuery(String description) Deprecated.voidstartQuery(String description, io.deephaven.enterprise.auth.UserContext primaryUserContext, io.deephaven.enterprise.auth.UserContext operationUserContext) This is for use by the RemoteQueryProcessor.static voidwithNugget(String name, long inputSize, com.fishlib.base.Procedure.Nullary r) Surround the given code with a Performance Nuggetstatic <T> TwithNugget(String name, long inputSize, Supplier<T> r) Surround the given code with a Performance Nuggetstatic voidwithNugget(String name, com.fishlib.base.Procedure.Nullary r) Surround the given code with a Performance Nuggetstatic <T> TwithNugget(String name, Supplier<T> r) Surround the given code with a Performance Nuggetstatic <R,ExceptionType extends Exception> 
 RwithNuggetThrowing(String name, long inputSize, com.fishlib.base.Function.ThrowingNullary<R, ExceptionType> r) Surround the given code with a Performance Nuggetstatic <T extends Exception>
 voidwithNuggetThrowing(String name, long inputSize, com.fishlib.base.Procedure.ThrowingNullary<T> r) Surround the given code with a Performance Nuggetstatic <R,ExceptionType extends Exception> 
 RwithNuggetThrowing(String name, com.fishlib.base.Function.ThrowingNullary<R, ExceptionType> r) Surround the given code with a Performance Nuggetstatic <T extends Exception>
 voidwithNuggetThrowing(String name, com.fishlib.base.Procedure.ThrowingNullary<T> r) Surround the given code with a Performance Nugget
- 
Constructor Details- 
QueryPerformanceRecorderpublic QueryPerformanceRecorder()
 
- 
- 
Method Details- 
getInstance
- 
resetInstancepublic static void resetInstance()
- 
startQuerypublic void startQuery(String description, io.deephaven.enterprise.auth.UserContext primaryUserContext, io.deephaven.enterprise.auth.UserContext operationUserContext) This is for use by the RemoteQueryProcessor. It should only be used by user classes in local queries.- Parameters:
- description- the query's Action name
- primaryUserContext- the query's user context
- operationUserContext- the client's user context
 
- 
startQueryDeprecated.startQuery for backwards-compatibility in case any customer code happens to use it- Parameters:
- description- the query's Action name
 
- 
abortQuerypublic void abortQuery()This is for use by the RemoteQueryProcessor. It should only be used by user classes in local queries.
- 
getStateReturn the query's current state- Returns:
- the query's state or null if it isn't initialized yet
 
- 
endQuerypublic boolean endQuery()This is for use by the RemoteQueryProcessor. It should only be used by user classes in local queries.
- 
getNugget- Parameters:
- name- the nugget name
- Returns:
- A new QueryPerformanceNugget to encapsulate user query operations. done() must be called on the nugget.
 
- 
getNugget- Parameters:
- name- the nugget name
- inputSize- the nugget's input size
- Returns:
- A new QueryPerformanceNugget to encapsulate user query operations. done() must be called on the nugget.
 
- 
getOuterNugget
- 
getOuterMostNugget
- 
getQueryLevelPerformanceData
- 
getPrimaryUserContextpublic io.deephaven.enterprise.auth.UserContext getPrimaryUserContext()
- 
getOperationUserContextpublic io.deephaven.enterprise.auth.UserContext getOperationUserContext()
- 
getOperationLevelPerformanceData
- 
getTimingResultsAsTable
- 
flushLocalInstanceDeprecated.No longer used.
- 
showLineNumbersDeprecated.Recording the caller line is now enabled for all nuggets by default.
- 
recordPoolAllocationpublic static <RESULT_TYPE> RESULT_TYPE recordPoolAllocation(@NotNull Supplier<RESULT_TYPE> operation) Record a single-threaded operation's allocations as "pool" allocated memory attributable to the current thread.- Parameters:
- operation- The operation to record allocation for
- Returns:
- The result of the operation.
 
- 
getPoolAllocatedBytesForCurrentThreadpublic static long getPoolAllocatedBytesForCurrentThread()Get the total bytes of pool-allocated memory attributed to this thread viarecordPoolAllocation(Supplier).- Returns:
- The total bytes of pool-allocated memory attributed to this thread.
 
- 
recordFirstTimeDataReadpublic static void recordFirstTimeDataRead(long durationNanos) 
- 
recordRepeatedDataReadpublic static void recordRepeatedDataRead(long durationNanos) 
- 
getFirstTimeDataReadspublic static long getFirstTimeDataReads()
- 
getFirstTimeDataReadNanospublic static long getFirstTimeDataReadNanos()
- 
getRepeatedDataReadspublic static long getRepeatedDataReads()
- 
getRepeatedDataReadNanospublic static long getRepeatedDataReadNanos()
- 
getCallerLine
- 
withNuggetSurround the given code with a Performance Nugget- Parameters:
- name- the nugget name
- r- the stuff to run
 
- 
withNuggetSurround the given code with a Performance Nugget- Parameters:
- name- the nugget name
- r- the stuff to run
- Returns:
- the result of the stuff to run
 
- 
withNuggetThrowingpublic static <T extends Exception> void withNuggetThrowing(String name, com.fishlib.base.Procedure.ThrowingNullary<T> r) throws T Surround the given code with a Performance Nugget- Parameters:
- r- the stuff to run
- Throws:
- T- exception of type T
 
- 
withNuggetThrowingpublic static <R,ExceptionType extends Exception> R withNuggetThrowing(String name, com.fishlib.base.Function.ThrowingNullary<R, ExceptionType> r) throws ExceptionTypeSurround the given code with a Performance Nugget- Parameters:
- name- the nugget name
- r- the stuff to run
- Returns:
- the result of the stuff to run
- Throws:
- ExceptionType- exception of type ExceptionType
 
- 
withNuggetSurround the given code with a Performance Nugget- Parameters:
- name- the nugget name
- r- the stuff to run
 
- 
withNuggetSurround the given code with a Performance Nugget- Parameters:
- name- the nugget name
- r- the stuff to run
- Returns:
- the result of the stuff to run
 
- 
withNuggetThrowingpublic static <T extends Exception> void withNuggetThrowing(String name, long inputSize, com.fishlib.base.Procedure.ThrowingNullary<T> r) throws T Surround the given code with a Performance Nugget- Parameters:
- r- the stuff to run
- Throws:
- T- exception of type T
 
- 
withNuggetThrowingpublic static <R,ExceptionType extends Exception> R withNuggetThrowing(String name, long inputSize, com.fishlib.base.Function.ThrowingNullary<R, ExceptionType> r) throws ExceptionTypeSurround the given code with a Performance Nugget- Parameters:
- name- the nugget name
- r- the stuff to run
- Returns:
- the result of the stuff to run
- Throws:
- ExceptionType- exception of type ExceptionType
 
- 
setCallsiteAttempt to set the thread local callsite so that invocations of getCallerLine()will not spend time trying to recompute.This method returns a boolean if the value was successfully set. In the event this returns true, it's the responsibility of the caller to invoke clearCallsite()when the operation is complete.It is good practice to do this with try{} finally{} block final boolean shouldClear = QueryPerformanceRecorder.setCallsite("CALLSITE"); try { // Do work } finally { if(shouldClear) { QueryPerformanceRecorder.clearCallsite(); } }- Parameters:
- callsite- The call site to use.
- Returns:
- true if successfully set, false otherwise/
 
- 
setCallsitepublic static boolean setCallsite()Attempt to compute and set the thread local callsite so that invocations of getCallerLine()will not spend time trying to recompute.Users should follow the best practice as described by setCallsite(String)- Returns:
- true if the callsite was computed and set.
 
- 
clearCallsitepublic static void clearCallsite()Clear any previously set callsite. SeesetCallsite(String)
 
-