Package mondrian.olap
Class QueryTiming
- java.lang.Object
-
- mondrian.olap.QueryTiming
-
public class QueryTiming extends java.lang.Object
Provides hooks for recording timing information of components of Query execution.NOTE: This class is experimental and subject to change/removal without notice.
Code that executes as part of a Query can call
markStart(String)
before executing, andmarkEnd(String)
afterwards, or can track execution times manually and callmarkFull(String, long)
.To read timing information, add a handler to the statement using
Statement.enableProfiling(mondrian.spi.ProfileHandler)
and implement theProfileHandler.explain(String, QueryTiming)
method.- Author:
- jbarnett
-
-
Constructor Summary
Constructors Constructor Description QueryTiming()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
done()
java.util.Collection<java.lang.String>
getTimingKeys()
java.util.List<java.lang.Long>
getTimings(java.lang.String key)
void
init(boolean enabled)
Initializes (or re-initializes) a query timing, also setting whether enabled.void
markEnd(java.lang.String name)
Marks the end of a Query component's execution.void
markFull(java.lang.String name, long duration)
Marks the duration of a Query component's execution.void
markStart(java.lang.String name)
Marks the start of a Query component's execution.java.lang.String
toString()
-
-
-
Method Detail
-
init
public void init(boolean enabled)
Initializes (or re-initializes) a query timing, also setting whether enabled. All previous stats are removed.- Parameters:
enabled
- Whether to collect stats in future
-
done
public void done()
-
markStart
public final void markStart(java.lang.String name)
Marks the start of a Query component's execution.- Parameters:
name
- Name of the component
-
markEnd
public final void markEnd(java.lang.String name)
Marks the end of a Query component's execution.- Parameters:
name
- Name of the component
-
markFull
public final void markFull(java.lang.String name, long duration)
Marks the duration of a Query component's execution.- Parameters:
name
- Name of the componentduration
- Duration of the execution
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getTimingKeys
public java.util.Collection<java.lang.String> getTimingKeys()
- Returns:
- a collection of all Query component names
-
getTimings
public java.util.List<java.lang.Long> getTimings(java.lang.String key)
- Parameters:
key
- Name of the Query component to get timing information on- Returns:
- a List of durations
-
-