|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectjava.lang.Thread
patterntesting.runtime.monitor.ProfileStatistic
public class ProfileStatistic
This is constructed as a thin layer around com.jamonapi.MonitorFactory for the needs of patterntesting. 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.
MonitorFactory| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected static boolean |
jamonAvailable
Is JaMon library available?. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
protected |
ProfileStatistic(String rootLabel)
Instantiates a new profile statistic. |
| Method Summary | |
|---|---|
static void |
addAsShutdownHook()
You can register the instance as shutdown hook. |
protected static void |
addAsShutdownHook(ProfileStatistic hook)
Adds the given instance (hook) as shutdown hook. |
void |
dumpStatistic()
Dump statistic to a file in the temporary directory. |
void |
dumpStatisticTo(File dumpFile)
Dump statistic to the given file |
static ProfileStatistic |
getInstance()
Gets the single instance of ProfileStatistic. |
double |
getMaxAvg()
Gets the max avg. |
String |
getMaxAvgLabel()
Gets the max avg label. |
String |
getMaxAvgStatistic()
Gets the max avg statistic. |
int |
getMaxHits()
Gets the max hits. |
String |
getMaxHitsLabel()
Gets the max hits label. |
String |
getMaxHitsStatistic()
Gets the max hits statistic. |
double |
getMaxMax()
Gets the max max. |
String |
getMaxMaxLabel()
Gets the max max label. |
String |
getMaxMaxStatistic()
Gets the max max statistic. |
double |
getMaxTotal()
Gets the max total. |
String |
getMaxTotalLabel()
Gets the max total label. |
String |
getMaxTotalStatistic()
Gets the max total statistic. |
ObjectName |
getMBeanName()
Gets the MBean name of the registered ProfileStatistic bean. |
ProfileMonitor |
getProfileMonitor(Class<?> clazz,
String method)
Do you want to look for the monitor of a given method? |
ProfileMonitor |
getProfileMonitor(Signature signature)
Do you want to look for the monitor of a given method? |
ProfileMonitor |
getProfileMonitor(String signature)
Do you want to look for the monitor of a given method? |
protected ProfileMonitor |
getRootMonitor()
Gets the root monitor. |
protected ProfileMonitor[] |
getSortedMonitors()
Gets the sorted monitors. |
TabularData |
getStatistics()
Gets the statistics. |
void |
init(Class<?> cl)
For each constructor and for each method of the given class a ProfileMonitor is initialized. |
void |
logStatistic()
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 |
resetRootMonitor()
Resets the root monitor. |
void |
run()
This method is called when the PerformanceMonitor is registered as shutdown hook. |
static ProfileMonitor |
start(Signature sig)
Start. |
ProfileMonitor |
startProfileMonitorFor(Signature sig)
Start profile monitor for the given signature. |
ProfileMonitor |
startProfileMonitorFor(String sig)
Start profile monitor for the given signature. |
String |
toString()
To string. |
| 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 |
| Field Detail |
|---|
protected static final boolean jamonAvailable
| Constructor Detail |
|---|
protected ProfileStatistic(String rootLabel)
rootLabel - the root label| Method Detail |
|---|
public static ProfileStatistic getInstance()
public static void addAsShutdownHook()
logStatistic(),
dumpStatistic()protected static void addAsShutdownHook(ProfileStatistic hook)
hook - the hookpublic void reset()
reset in interface ProfileStatisticMBeanprotected void resetRootMonitor()
public void init(Class<?> cl)
cl - the given classpublic ObjectName getMBeanName()
ProfileStatistic bean.
public void run()
run in interface Runnablerun in class ThreadThread.run()public static ProfileMonitor start(Signature sig)
sig - the sig
public ProfileMonitor startProfileMonitorFor(Signature sig)
sig - the signature
public ProfileMonitor startProfileMonitorFor(String sig)
sig - the signature
protected final ProfileMonitor[] getSortedMonitors()
public int getMaxHits()
getMaxHits in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxHits()public String getMaxHitsLabel()
getMaxHitsLabel in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxHitsLabel()public String getMaxHitsStatistic()
getMaxHitsStatistic in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxHitsStatistic()public double getMaxTotal()
getMaxTotal in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxTotal()public String getMaxTotalLabel()
getMaxTotalLabel in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxTotalLabel()public String getMaxTotalStatistic()
getMaxTotalStatistic in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxTotalStatistic()protected ProfileMonitor getRootMonitor()
public double getMaxAvg()
getMaxAvg in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxAvg()public String getMaxAvgLabel()
getMaxAvgLabel in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxAvgLabel()public String getMaxAvgStatistic()
getMaxAvgStatistic in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxAvgStatistic()public double getMaxMax()
getMaxMax in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxMax()public String getMaxMaxLabel()
getMaxMaxLabel in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxMaxLabel()public String getMaxMaxStatistic()
getMaxMaxStatistic in interface ProfileStatisticMBeanProfileStatisticMBean.getMaxMaxStatistic()public TabularData getStatistics()
getStatistics in interface ProfileStatisticMBeanProfileStatisticMBean.getStatistics()public void logStatistic()
logStatistic in interface ProfileStatisticMBeanProfileStatisticMBean.logStatistic()public void dumpStatistic()
dumpStatistic in interface ProfileStatisticMBeanProfileStatisticMBean.dumpStatistic()
public void dumpStatisticTo(File dumpFile)
throws IOException
dumpFile - the dump file
IOException - Signals that an I/O exception has occurred.
@MayReturnNull
public ProfileMonitor getProfileMonitor(Class<?> clazz,
String method)
clazz - the clazzmethod - the method name, including parameter
e.g. "getProfileMonitor(Class,String)"
@MayReturnNull public ProfileMonitor getProfileMonitor(Signature signature)
signature - e.g. "hello.World(String[])"
@MayReturnNull public ProfileMonitor getProfileMonitor(String signature)
signature - e.g. "hello.World(String[])"
public String toString()
toString in class ThreadThread.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||