SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

com.solarmetric.kodo.impl.jdbc
Class PerformanceTracker

java.lang.Object
  |
  +--com.solarmetric.kodo.impl.jdbc.AbstractSQLExecutionListener
        |
        +--com.solarmetric.kodo.impl.jdbc.PerformanceTracker
All Implemented Interfaces:
SQLExecutionListener

public class PerformanceTracker
extends AbstractSQLExecutionListener
implements SQLExecutionListener

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 SQLExecutionListener in the SQLExecutionManager 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.

Since:
2.4

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 connectionMaxTime
          The slowest Connection to be opened.
static long connectionMinTime
          The fastest Connection to be opened.
static long connections
          The total number of Connections opened.
static long connectionTimes
          The total time taken on the opening of 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 String PERFORMANCE_LOG
           
static long resultSetMaxTime
          The slowest ResultSet that have been closed.
static long resultSetMinTime
          The fastest ResultSet that has been closed.
static long resultSets
          The total number of ResultSets that have been closed.
static long resultSetTimes
          The total time taken on the closing of all ResultSets.
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
(package private) static void ()
           
 void afterClose(SQLExecutionEvent event, Connection c)
           
 void afterCloseResultSet(SQLExecutionEvent event, ResultSet rs)
           
 void afterCommit(SQLExecutionEvent event, Connection c)
           
 void afterConnect(SQLExecutionEvent event, Connection c)
           
 void afterExecuteStatement(SQLExecutionEvent event, Statement stmnt)
           
 void afterRollback(SQLExecutionEvent event, Connection c)
           
 void beforeClose(SQLExecutionEvent event, Connection c)
           
 void beforeCloseResultSet(SQLExecutionEvent event, ResultSet rs)
           
 void beforeCommit(SQLExecutionEvent event, Connection c)
           
 void beforeConnect(SQLExecutionEvent event)
           
 void beforeExecuteStatement(SQLExecutionEvent event, Statement stmnt)
           
 void beforeRollback(SQLExecutionEvent event, Connection c)
           
 void creatingStatement(SQLExecutionEvent event, SQLBuffer[] buf)
           
 void preparingStatement(SQLExecutionEvent event, SQLBuffer[] buf)
           
static void reset()
          Reset all global statistics to their default values.
static String summarizePerformance()
           
 long time(SQLExecutionEvent event)
           
 String toString()
          Summarize the statistics.
 void trackSlowStatements(SQLBuffer[] buffer, long time)
           
 void trackSlowStatements(SQLBuffer buffer, long time)
           
 
Methods inherited from class com.solarmetric.kodo.impl.jdbc.AbstractSQLExecutionListener
eventOccured, eventOccurred
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.solarmetric.kodo.impl.jdbc.SQLExecutionListener
eventOccurred
 

Field Detail

PERFORMANCE_LOG

public static final String PERFORMANCE_LOG

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.

resultSets

public static long resultSets
The total number of ResultSets that have been closed.

resultSetTimes

public static long resultSetTimes
The total time taken on the closing of all ResultSets.

resultSetMinTime

public static long resultSetMinTime
The fastest ResultSet that has been closed.

resultSetMaxTime

public static long resultSetMaxTime
The slowest ResultSet that have been closed.

connections

public static long connections
The total number of Connections opened.

connectionTimes

public static long connectionTimes
The total time taken on the opening of all Connections.

connectionMinTime

public static long connectionMinTime
The fastest Connection to be opened.

connectionMaxTime

public static long connectionMaxTime
The slowest Connection to be opened.

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

static void ()

reset

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

preparingStatement

public void preparingStatement(SQLExecutionEvent event,
                               SQLBuffer[] buf)
Overrides:
preparingStatement in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.PREPARING_STATEMENT

creatingStatement

public void creatingStatement(SQLExecutionEvent event,
                              SQLBuffer[] buf)
Overrides:
creatingStatement in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.CREATING_STATEMENT

beforeExecuteStatement

public void beforeExecuteStatement(SQLExecutionEvent event,
                                   Statement stmnt)
Overrides:
beforeExecuteStatement in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.BEFORE_EXECUTE_STATEMENT

afterExecuteStatement

public void afterExecuteStatement(SQLExecutionEvent event,
                                  Statement stmnt)
Overrides:
afterExecuteStatement in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.AFTER_EXECUTE_STATEMENT

trackSlowStatements

public void trackSlowStatements(SQLBuffer[] buffer,
                                long time)

trackSlowStatements

public void trackSlowStatements(SQLBuffer buffer,
                                long time)

beforeCommit

public void beforeCommit(SQLExecutionEvent event,
                         Connection c)
Overrides:
beforeCommit in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.BEFORE_COMMIT

afterCommit

public void afterCommit(SQLExecutionEvent event,
                        Connection c)
Overrides:
afterCommit in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.AFTER_COMMIT

beforeRollback

public void beforeRollback(SQLExecutionEvent event,
                           Connection c)
Overrides:
beforeRollback in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.BEFORE_ROLLBACK

afterRollback

public void afterRollback(SQLExecutionEvent event,
                          Connection c)
Overrides:
afterRollback in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.AFTER_ROLLBACK

beforeClose

public void beforeClose(SQLExecutionEvent event,
                        Connection c)
Overrides:
beforeClose in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.BEFORE_CLOSE

afterClose

public void afterClose(SQLExecutionEvent event,
                       Connection c)
Overrides:
afterClose in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.AFTER_CLOSE

beforeConnect

public void beforeConnect(SQLExecutionEvent event)
Overrides:
beforeConnect in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.BEFORE_CONNECT

afterConnect

public void afterConnect(SQLExecutionEvent event,
                         Connection c)
Overrides:
afterConnect in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.AFTER_CONNECT

beforeCloseResultSet

public void beforeCloseResultSet(SQLExecutionEvent event,
                                 ResultSet rs)
Overrides:
beforeCloseResultSet in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.BEFORE_CLOSE_RESULTSET

afterCloseResultSet

public void afterCloseResultSet(SQLExecutionEvent event,
                                ResultSet rs)
Overrides:
afterCloseResultSet in class AbstractSQLExecutionListener
See Also:
SQLExecutionEvent.AFTER_CLOSE_RESULTSET

time

public final long time(SQLExecutionEvent 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 2.5.8 generated on January 11 2004

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