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
ConstructorsModifierConstructorDescriptionprotected
AbstractStatistic
(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.void
Dump statistic to the given file.double
Gets the max avg.Gets the max avg label.Gets the max avg statistic.int
Gets the max hits.Gets the max hits label.Gets the max hits statistic.double
Gets the max max.Gets the max max label.Gets the max max statistic.int
Gets the max size.double
Gets 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 ProfileMonitor
Gets the root monitor.protected final ProfileMonitor[]
Gets the sorted monitors.Gets the statistics.void
logMe()
Log statistic.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.protected void
Resets the root monitor.void
setMaxSize
(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, unregisterMeAsMBean
Methods inherited from class clazzfish.monitor.util.Shutdowner
addMeAsShutdownHook, isShutdownHook, removeMeAsShutdownHook
Methods 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, yield
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:
reset
in 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:
setMaxSize
in interfaceAbstractStatisticMBean
- Parameters:
size
- the new max size
-
getMaxSize
public int getMaxSize()Gets the max size.- Specified by:
getMaxSize
in 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 anIllegalArgumentException
will 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:
getMaxHits
in interfaceAbstractStatisticMBean
- Returns:
- the max hits
-
getMaxHitsLabel
Gets the max hits label.- Specified by:
getMaxHitsLabel
in interfaceAbstractStatisticMBean
- Returns:
- the max hits label
-
getMaxHitsStatistic
Gets the max hits statistic.- Specified by:
getMaxHitsStatistic
in interfaceAbstractStatisticMBean
- Returns:
- the max hits statistic
-
getMaxTotal
public double getMaxTotal()Gets the max total.- Specified by:
getMaxTotal
in interfaceAbstractStatisticMBean
- Returns:
- the max total
-
getMaxTotalLabel
Gets the max total label.- Specified by:
getMaxTotalLabel
in interfaceAbstractStatisticMBean
- Returns:
- the max total label
-
getMaxTotalStatistic
Gets the max total statistic.- Specified by:
getMaxTotalStatistic
in interfaceAbstractStatisticMBean
- Returns:
- the max total statistic
-
getRootMonitor
-
getMaxAvg
public double getMaxAvg()Gets the max avg.- Specified by:
getMaxAvg
in interfaceAbstractStatisticMBean
- Returns:
- the max avg
-
getMaxAvgLabel
Gets the max avg label.- Specified by:
getMaxAvgLabel
in interfaceAbstractStatisticMBean
- Returns:
- the max avg label
-
getMaxAvgStatistic
Gets the max avg statistic.- Specified by:
getMaxAvgStatistic
in interfaceAbstractStatisticMBean
- Returns:
- the max avg statistic
-
getMaxMax
public double getMaxMax()Gets the max max.- Specified by:
getMaxMax
in interfaceAbstractStatisticMBean
- Returns:
- the max max
-
getMaxMaxLabel
Gets the max max label.- Specified by:
getMaxMaxLabel
in interfaceAbstractStatisticMBean
- Returns:
- the max max label
-
getMaxMaxStatistic
Gets the max max statistic.- Specified by:
getMaxMaxStatistic
in interfaceAbstractStatisticMBean
- Returns:
- the max max statistic
-
getStatistics
Gets the statistics.- Specified by:
getStatistics
in interfaceAbstractStatisticMBean
- Returns:
- the statistics
-
logMe
public void logMe()Log statistic.- Specified by:
logMe
in interfaceAbstractMonitorMBean
- Specified by:
logMe
in 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:
dumpMe
in interfaceAbstractMonitorMBean
- Overrides:
dumpMe
in classAbstractMonitor
- Returns:
- the file
- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
-
dumpMe
Dump statistic to the given file.- Overrides:
dumpMe
in classAbstractMonitor
- Parameters:
dumpFile
- the dump file- Throws:
IOException
- Signals that an I/O exception has occurred.
-