The com.ibm.db2.jcc.DB2SystemMonitor interface is used for collecting system monitoring data for a connection. Each connection can have one DB2SystemMonitor instance.
The following fields are defined only for the IBM® Data Server Driver for JDBC and SQLJ.
The following methods are defined only for the IBM Data Server Driver for JDBC and SQLJ.
public void enable(boolean on)
throws java.sql.SQLException
Enables the system monitor that is associated with a connection. This method cannot be called during monitoring. All times are reset when enable is invoked.
public long getApplicationTimeMillis()
throws java.sql.SQLException
Returns the sum of the application, JDBC driver, network I/O, and database server elapsed times. The time is in milliseconds.
getApplicationTimeMillis returns 0 if system monitoring is disabled. Calling this method without first calling the stop method results in an SQLException.
public long getCoreDriverTimeMicros()
throws java.sql.SQLException
Returns the sum of elapsed monitored API times that were collected while system monitoring was enabled. The time is in microseconds.
A monitored API is a JDBC driver method for which processing time is collected. In general, elapsed times are monitored only for APIs that might result in network I/O or database server interaction. For example, PreparedStatement.setXXX methods and ResultSet.getXXX methods are not monitored.
Monitored API elapsed time includes the total time that is spent in the driver for a method call. This time includes any network I/O time and database server elapsed time.
getCoreDriverTimeMicros returns 0 if system monitoring is disabled. Calling this method without first calling the stop method, or calling this method when the underlying JVM does not support reporting times in microseconds results in an SQLException.
public long getNetworkIOTimeMicros()
throws java.sql.SQLException
Returns the sum of elapsed network I/O times that were collected while system monitoring was enabled. The time is in microseconds.
Network I/O time intervals are captured for all send and receive operations, including the sending of messages for commits and rollbacks.
The time spent waiting for network I/O might be impacted by delays in CPU dispatching at the database server for low-priority SQL requests.
getNetworkIOTimeMicros returns 0 if system monitoring is disabled. Calling this method without first calling the stop method, or calling this method when the underlying JVM does not support reporting times in microseconds results in an SQLException.
public long getServerTimeMicros()
throws java.sql.SQLException
Returns the sum of all reported database server elapsed times that were collected while system monitoring was enabled. The time is in microseconds.
DB2® for Linux, UNIX, and Windows Version 9.5 and later and DB2 for z/OS® support this function.
getServerTimeMicros returns 0 if system monitoring is disabled. Calling this method without first calling the stop method results in an SQLException.
public void start (int lapMode)
throws java.sql.SQLException
If the system monitor is enabled, start begins the collection of system monitoring data for a connection. Valid values for lapMode are RESET_TIMES or ACCUMULATE_TIMES.
Calling this method with system monitoring disabled does nothing. Calling this method more than once without an intervening stop call results in an SQLException.
public void stop()
throws java.sql.SQLException
If the system monitor is enabled, stop ends the collection of system monitoring data for a connection. After monitoring is stopped, monitored times can be obtained with the getXXX methods of DB2SystemMonitor.
Calling this method with system monitoring disabled does nothing. Calling this method without first calling start, or calling this method more than once without an intervening start call results in an SQLException.