SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

com.solarmetric.jdbc
Class PerformanceTracker

java.lang.Object
  |
  +--com.solarmetric.jdbc.AbstractJDBCListener
        |
        +--com.solarmetric.jdbc.PerformanceTracker
All Implemented Interfaces:
JDBCListener

public class PerformanceTracker
extends AbstractJDBCListener

A global tracker of performance-related statistics. All the performance-related statistics are available as public static variables which can be accessed directly by an application. A PerformanceTracker must be added as a JDBCListener in the JDBCEventConnectionDecorator in order to be used. Performance statistics are logged whenever a commit occurs. A summary of performance statistics can be obtained by invoking the static summarizePerformance() method at any time.


Field Summary
static long commitMaxTime
          The slowest commit made on a Connection.
static long commitMinTime
          The fastest commit made on a Connection.
static long commits
          The total number of commits made on a Connection.
static long commitTimes
          The total time taken on the execution of commits made on all Connections.
static long executePreparedStatementMaxTime
          The slowest PreparedStatement execution.
static long executePreparedStatementMinTime
          The fastest PreparedStatement execution.
static long executePreparedStatements
          The total number of PreparedStatements executed.
static long executePreparedStatementTimes
          The total time taken on the execution of PreparedStatements.
static long executeStatementMaxTime
          The slowest Statement executions.
static long executeStatementMinTime
          The fastest Statement executions.
static long executeStatements
          The total number of Statements that have been executed.
static long executeStatementTimes
          The total time for all Statement executions.
static int maxStatementTracking
          The number of slow statements we will track.
static long rollbackMaxTime
          The slowest rollback made on a Connection.
static long rollbackMinTime
          The fastest rollback made on a Connection.
static long rollbacks
          The total number of rollbacks made on a Connection.
static long rollbackTimes
          The total time taken on the execution of rollbacks made on all Connections.
static Map slowestStatements
          A Map of SQLString : time, to track the slowest statements we have seen.
static SortedSet statementTimes
          A cache of the time elements in slowestStatements.
 
Constructor Summary
PerformanceTracker()
           
 
Method Summary
 void afterCommit(JDBCEvent event)
           
 void afterExecuteStatement(JDBCEvent event)
           
 void afterRollback(JDBCEvent event)
           
static void reset()
          Reset all global statistics to their default values.
static void setLog(Log log)
          Set the log to write to.
static String summarizePerformance()
           
 long time(JDBCEvent event)
           
 String toString()
          Summarize the statistics.
 void trackSlowStatements(String sql, long time)
           
 
Methods inherited from class com.solarmetric.jdbc.AbstractJDBCListener
afterConnect, afterCreateStatement, afterPrepareStatement, afterReturn, beforeClose, beforeCommit, beforeCreateStatement, beforeExecuteStatement, beforePrepareStatement, beforeReturn, beforeRollback, eventOccurred
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

executeStatements

public static long executeStatements
The total number of Statements that have been executed.

executeStatementTimes

public static long executeStatementTimes
The total time for all Statement executions.

executeStatementMinTime

public static long executeStatementMinTime
The fastest Statement executions.

executeStatementMaxTime

public static long executeStatementMaxTime
The slowest Statement executions.

executePreparedStatements

public static long executePreparedStatements
The total number of PreparedStatements executed.

executePreparedStatementTimes

public static long executePreparedStatementTimes
The total time taken on the execution of PreparedStatements.

executePreparedStatementMinTime

public static long executePreparedStatementMinTime
The fastest PreparedStatement execution.

executePreparedStatementMaxTime

public static long executePreparedStatementMaxTime
The slowest PreparedStatement execution.

commits

public static long commits
The total number of commits made on a Connection.

commitTimes

public static long commitTimes
The total time taken on the execution of commits made on all Connections.

commitMinTime

public static long commitMinTime
The fastest commit made on a Connection.

commitMaxTime

public static long commitMaxTime
The slowest commit made on a Connection.

rollbacks

public static long rollbacks
The total number of rollbacks made on a Connection.

rollbackTimes

public static long rollbackTimes
The total time taken on the execution of rollbacks made on all Connections.

rollbackMinTime

public static long rollbackMinTime
The fastest rollback made on a Connection.

rollbackMaxTime

public static long rollbackMaxTime
The slowest rollback made on a Connection.

maxStatementTracking

public static int maxStatementTracking
The number of slow statements we will track.

slowestStatements

public static Map slowestStatements
A Map of SQLString : time, to track the slowest statements we have seen.

statementTimes

public static SortedSet statementTimes
A cache of the time elements in slowestStatements.
Constructor Detail

PerformanceTracker

public PerformanceTracker()
Method Detail

reset

public static void reset()
Reset all global statistics to their default values.

setLog

public static void setLog(Log log)
Set the log to write to.

afterExecuteStatement

public void afterExecuteStatement(JDBCEvent event)
Overrides:
afterExecuteStatement in class AbstractJDBCListener
Following copied from interface: com.solarmetric.jdbc.JDBCListener
See Also:
JDBCEvent.AFTER_EXECUTE_STATEMENT

trackSlowStatements

public void trackSlowStatements(String sql,
                                long time)

afterCommit

public void afterCommit(JDBCEvent event)
Overrides:
afterCommit in class AbstractJDBCListener
Following copied from interface: com.solarmetric.jdbc.JDBCListener
See Also:
JDBCEvent.AFTER_COMMIT

afterRollback

public void afterRollback(JDBCEvent event)
Overrides:
afterRollback in class AbstractJDBCListener
Following copied from interface: com.solarmetric.jdbc.JDBCListener
See Also:
JDBCEvent.AFTER_ROLLBACK

time

public final long time(JDBCEvent event)
Returns:
the time it took for an event to complete, based on the specified event's time with the associated event's time subtracted.

summarizePerformance

public static String summarizePerformance()

toString

public String toString()
Summarize the statistics.
Overrides:
toString in class Object

SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.