patterntesting.runtime.monitor.db
Class SqlStatistic

Package class diagram package SqlStatistic
java.lang.Object
  extended by java.lang.Thread
      extended by patterntesting.runtime.monitor.ProfileStatistic
          extended by patterntesting.runtime.monitor.db.SqlStatistic
All Implemented Interfaces:
Runnable, SqlStatisticMBean, ProfileStatisticMBean

public class SqlStatistic
extends ProfileStatistic
implements SqlStatisticMBean

This class monitors and measures SQL statements. To be able to distinguish them from methods profiling it is a separate class derived from ProfileStatistic.

Since:
1.4.2 (16.04.2014)
Author:
oliver

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class patterntesting.runtime.monitor.ProfileStatistic
jamonAvailable
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
static void addAsShutdownHook()
          You can register the instance as shutdown hook.
static SqlStatistic getInstance()
          Gets the single instance of SqlStatistic.
 void reset()
          To start a new statistic call this method.
static ProfileMonitor start(String sql)
          Start.
static void stop(ProfileMonitor mon, String command)
          Stops the given 'mon' and logs the given command with the needed time if debug is enabled.
static void stop(ProfileMonitor mon, String command, Object returnValue)
          Stops the given 'mon' and logs the given command with the needed time if debug is enabled.
 
Methods inherited from class patterntesting.runtime.monitor.ProfileStatistic
addAsShutdownHook, dumpStatistic, dumpStatisticTo, getMaxAvg, getMaxAvgLabel, getMaxAvgStatistic, getMaxHits, getMaxHitsLabel, getMaxHitsStatistic, getMaxMax, getMaxMaxLabel, getMaxMaxStatistic, getMaxTotal, getMaxTotalLabel, getMaxTotalStatistic, getMBeanName, getProfileMonitor, getProfileMonitor, getProfileMonitor, getRootMonitor, getSortedMonitors, getStatistics, init, logStatistic, resetRootMonitor, run, start, startProfileMonitorFor, startProfileMonitorFor, toString
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface patterntesting.runtime.monitor.ProfileStatisticMBean
dumpStatistic, getMaxAvg, getMaxAvgLabel, getMaxAvgStatistic, getMaxHits, getMaxHitsLabel, getMaxHitsStatistic, getMaxMax, getMaxMaxLabel, getMaxMaxStatistic, getMaxTotal, getMaxTotalLabel, getMaxTotalStatistic, getStatistics, logStatistic
 

Method Detail

getInstance

public static SqlStatistic getInstance()
Gets the single instance of SqlStatistic.

Returns:
single instance of SqlStatistic

reset

public void reset()
To start a new statistic call this method. In contradiction to ProfileStatistic.reset() old ProfileMonitors will be not kept.

Specified by:
reset in interface ProfileStatisticMBean
Overrides:
reset in class ProfileStatistic

start

public static ProfileMonitor start(String sql)
Start.

Parameters:
sql - the sql
Returns:
the started profile monitor

stop

public static void stop(ProfileMonitor mon,
                        String command)
Stops the given 'mon' and logs the given command with the needed time if debug is enabled.

Parameters:
mon - the mon
command - the command

stop

public static void stop(ProfileMonitor mon,
                        String command,
                        Object returnValue)
Stops the given 'mon' and logs the given command with the needed time if debug is enabled.

Parameters:
mon - the mon
command - the command
returnValue - the return value

addAsShutdownHook

public static void addAsShutdownHook()
You can register the instance as shutdown hook. If the VM is terminated the profile values are logged and dumped to a CSV file in the tmp directory.

See Also:
ProfileStatistic.logStatistic(), ProfileStatistic.dumpStatistic()


Copyright © 2002–2014 PatternTesting Team. All rights reserved.