Package org.droolsassert.util
Class PerfStat
java.lang.Object
org.droolsassert.util.PerfStat
Performance statistic per type (optional) and name. Exposed via MBean server to monitor in real-time with default 4s aggregation time (jvisualvm mbean charts refresh interval).
Output statistic from this VM or deliver serializable and merge from several VMs.
private PerfStat methodPerf = new PerfStat("type", "name")
...
public void myMethod() {
methodPerf.start();
...
methodPerf.stop();
}
}
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinalize()static longstatic StringgetName()Performance statistic for all types and namesstatic StatgetPerfStat(String name) Performance statistic for name (if type was not used)static StatgetPerfStat(String type, String name) Performance statistic for type and namegetStat()org.apache.commons.lang3.time.StopWatchgetType()static voidYou may want to merge performance statistic from other JVMsvoidreset()Reset statisticstatic voidresetAll()Reset statistic for all types and namesstatic voidsetDefaultAggregationPeriodMs(long defaultAggregationPeriodMs) static voidsetJmxDomain(String jmxDomain) start()Start to measure execution time for current thread.
Reset sample (period) values if aggregation time threshold passed over.longstop()Stop to measure execution time for current thread, update performance statistic for the name.
If stop was not executed for some reason and then start will be called again by the same thread then current leap will be counted as failed.toString()
-
Constructor Details
-
PerfStat
-
PerfStat
-
PerfStat
-
PerfStat
-
-
Method Details
-
getJmxDomain
-
setJmxDomain
-
getDefaultAggregationPeriodMs
public static long getDefaultAggregationPeriodMs() -
setDefaultAggregationPeriodMs
public static void setDefaultAggregationPeriodMs(long defaultAggregationPeriodMs) -
getPerfStat
Performance statistic for name (if type was not used)- Parameters:
name-
-
getPerfStat
Performance statistic for type and name- Parameters:
name-
-
getPerfStat
Performance statistic for all types and names -
merge
You may want to merge performance statistic from other JVMs -
resetAll
public static void resetAll()Reset statistic for all types and names -
finalize
-
start
Start to measure execution time for current thread.
Reset sample (period) values if aggregation time threshold passed over. -
stop
public long stop()Stop to measure execution time for current thread, update performance statistic for the name.
If stop was not executed for some reason and then start will be called again by the same thread then current leap will be counted as failed. -
reset
public void reset()Reset statistic -
getStopWatch
public org.apache.commons.lang3.time.StopWatch getStopWatch() -
getStat
-
getType
-
getName
-
getFullName
-
toString
-