Class AbstractStatistic
java.lang.Object
java.lang.Thread
clazzfish.monitor.util.Shutdowner
clazzfish.monitor.AbstractMonitor
clazzfish.jdbc.AbstractStatistic
- All Implemented Interfaces:
AbstractStatisticMBean,AbstractMonitorMBean,Shutdownable,Runnable
- Direct Known Subclasses:
SqlStatistic
This is constructed as a thin layer around com.jamonapi.MonitorFactory for
the needs of generating statistics. The reason for this layer is that sometimes you
want to minimize the use of other libraries. So this implementation provides
also an implementation if the JaMon library is missing.
- Since:
- 0.9
- Author:
- oliver
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStatistic(String rootLabel) Instantiates a new profile statistic. -
Method Summary
Modifier and TypeMethodDescriptiondumpMe()This operation dumps statistic into a (temporary) file with the classname as prefix.voidDump statistic to the given file.doubleGets the max avg.Gets the max avg label.Gets the max avg statistic.intGets the max hits.Gets the max hits label.Gets the max hits statistic.doubleGets the max max.Gets the max max label.Gets the max max statistic.intGets the max size.doubleGets the max total.Gets the max total label.Gets the max total statistic.getMonitor(String label) Returns the monitor for the given label.Gets the monitors (unsorted).protected ProfileMonitorGets the root monitor.protected final ProfileMonitor[]Gets the sorted monitors.Gets the statistics.voidlogMe()Log statistic.voidreset()We can't reset all ProfileMonitors - we must keep the empty monitors with 0 hits to see which methods or constructors are never called.protected voidResets the root monitor.voidsetMaxSize(int size) Here you can set the maximal size of the statistic entries.Start profile monitor for the given signature.Methods inherited from class clazzfish.monitor.AbstractMonitor
copyResource, dump, dump, dumpArray, dumpArray, dumpHeadline, dumpMe, getDumpDir, isMBean, registerMeAsMBean, registerMeAsMBean, registerMeAsMBean, run, toString, toStringArray, unregisterMeAsMBeanMethods inherited from class clazzfish.monitor.util.Shutdowner
addMeAsShutdownHook, isShutdownHook, removeMeAsShutdownHookMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, yieldMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface clazzfish.monitor.util.Shutdownable
addMeAsShutdownHook, isShutdownHook, removeMeAsShutdownHook
-
Constructor Details
-
AbstractStatistic
Instantiates a new profile statistic.- Parameters:
rootLabel- the root label
-
-
Method Details
-
reset
public void reset()We can't reset all ProfileMonitors - we must keep the empty monitors with 0 hits to see which methods or constructors are never called.- Specified by:
resetin interfaceAbstractStatisticMBean
-
resetRootMonitor
protected void resetRootMonitor()Resets the root monitor. -
setMaxSize
public void setMaxSize(int size) Here you can set the maximal size of the statistic entries.- Specified by:
setMaxSizein interfaceAbstractStatisticMBean- Parameters:
size- the new max size
-
getMaxSize
public int getMaxSize()Gets the max size.- Specified by:
getMaxSizein interfaceAbstractStatisticMBean- Returns:
- the max size
-
startProfileMonitorFor
Start profile monitor for the given signature.- Parameters:
sig- the signature- Returns:
- the profile monitor
-
getMonitors
-
getMonitor
Returns the monitor for the given label. It it does not exists anIllegalArgumentExceptionwill be thrown.- Parameters:
label- label of the monitor- Returns:
- monitor with the given label
-
getSortedMonitors
Gets the sorted monitors.- Returns:
- monitors sorted after total time (descending order)
-
getMaxHits
public int getMaxHits()Gets the max hits.- Specified by:
getMaxHitsin interfaceAbstractStatisticMBean- Returns:
- the max hits
-
getMaxHitsLabel
Gets the max hits label.- Specified by:
getMaxHitsLabelin interfaceAbstractStatisticMBean- Returns:
- the max hits label
-
getMaxHitsStatistic
Gets the max hits statistic.- Specified by:
getMaxHitsStatisticin interfaceAbstractStatisticMBean- Returns:
- the max hits statistic
-
getMaxTotal
public double getMaxTotal()Gets the max total.- Specified by:
getMaxTotalin interfaceAbstractStatisticMBean- Returns:
- the max total
-
getMaxTotalLabel
Gets the max total label.- Specified by:
getMaxTotalLabelin interfaceAbstractStatisticMBean- Returns:
- the max total label
-
getMaxTotalStatistic
Gets the max total statistic.- Specified by:
getMaxTotalStatisticin interfaceAbstractStatisticMBean- Returns:
- the max total statistic
-
getRootMonitor
-
getMaxAvg
public double getMaxAvg()Gets the max avg.- Specified by:
getMaxAvgin interfaceAbstractStatisticMBean- Returns:
- the max avg
-
getMaxAvgLabel
Gets the max avg label.- Specified by:
getMaxAvgLabelin interfaceAbstractStatisticMBean- Returns:
- the max avg label
-
getMaxAvgStatistic
Gets the max avg statistic.- Specified by:
getMaxAvgStatisticin interfaceAbstractStatisticMBean- Returns:
- the max avg statistic
-
getMaxMax
public double getMaxMax()Gets the max max.- Specified by:
getMaxMaxin interfaceAbstractStatisticMBean- Returns:
- the max max
-
getMaxMaxLabel
Gets the max max label.- Specified by:
getMaxMaxLabelin interfaceAbstractStatisticMBean- Returns:
- the max max label
-
getMaxMaxStatistic
Gets the max max statistic.- Specified by:
getMaxMaxStatisticin interfaceAbstractStatisticMBean- Returns:
- the max max statistic
-
getStatistics
Gets the statistics.- Specified by:
getStatisticsin interfaceAbstractStatisticMBean- Returns:
- the statistics
-
logMe
public void logMe()Log statistic.- Specified by:
logMein interfaceAbstractMonitorMBean- Specified by:
logMein classAbstractMonitor
-
dumpMe
This operation dumps statistic into a (temporary) file with the classname as prefix. The name of the created file is returned so that you can see it in the 'jconsole' (if you have triggered it from there).- Specified by:
dumpMein interfaceAbstractMonitorMBean- Overrides:
dumpMein classAbstractMonitor- Returns:
- the file
- Throws:
IOException- Signals that an I/O exception has occurred.- See Also:
-
dumpMe
Dump statistic to the given file.- Overrides:
dumpMein classAbstractMonitor- Parameters:
dumpFile- the dump file- Throws:
IOException- Signals that an I/O exception has occurred.
-