mondrian.olap
Class QueryTiming

java.lang.Object
  extended by mondrian.olap.QueryTiming

public class QueryTiming
extends 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, and markEnd(String) afterwards, or can track execution times manually and call markFull(String, long).

To read timing information, add a handler to the statement using Statement.enableProfiling(mondrian.spi.ProfileHandler) and implement the ProfileHandler.explain(String, QueryTiming) method.

Author:
jbarnett

Constructor Summary
QueryTiming()
           
 
Method Summary
 void done()
           
 Collection<String> getTimingKeys()
           
 List<Long> getTimings(String key)
           
 void init(boolean enabled)
          Initializes (or re-initializes) a query timing, also setting whether enabled.
 void markEnd(String name)
          Marks the end of a Query component's execution.
 void markFull(String name, long duration)
          Marks the duration of a Query component's execution.
 void markStart(String name)
          Marks the start of a Query component's execution.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryTiming

public QueryTiming()
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(String name)
Marks the start of a Query component's execution.

Parameters:
name - Name of the component

markEnd

public final void markEnd(String name)
Marks the end of a Query component's execution.

Parameters:
name - Name of the component

markFull

public final void markFull(String name,
                           long duration)
Marks the duration of a Query component's execution.

Parameters:
name - Name of the component
duration - Duration of the execution

toString

public String toString()
Overrides:
toString in class Object

getTimingKeys

public Collection<String> getTimingKeys()
Returns:
a collection of all Query component names

getTimings

public List<Long> getTimings(String key)
Parameters:
key - Name of the Query component to get timing information on
Returns:
a List of durations

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads