public class PerfStat extends Object
private PerfStat methodPerf = new PerfStat("type", "name")
...
public void myMethod() {
methodPerf.start();
...
methodPerf.stop();
}
}
start(),
stop(),
getPerfStat(),
StopWatch| Constructor and Description |
|---|
PerfStat(String name) |
PerfStat(String name,
long aggregationPeriodMs) |
PerfStat(String type,
String name) |
PerfStat(String type,
String name,
long aggregationPeriodMs) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
finalize() |
static long |
getDefaultAggregationPeriodMs() |
static String |
getJmxDomain() |
static TreeMap<String,TreeMap<String,StatImpl>> |
getPerfStat()
Performance statistic for all types and names
|
static Stat |
getPerfStat(String name)
Performance statistic for name (if type was not used)
|
static Stat |
getPerfStat(String type,
String name)
Performance statistic for type and name
|
Stat |
getStat() |
org.apache.commons.lang3.time.StopWatch |
getStopWatch() |
static void |
merge(Map<String,Map<String,StatImpl>> rhsStatsByType)
You may want to merge performance statistic from other JVMs
|
void |
reset()
Reset statistic
|
static void |
resetAll()
Reset statistic for all types and names
|
static void |
setDefaultAggregationPeriodMs(long defaultAggregationPeriodMs) |
static void |
setJmxDomain(String jmxDomain) |
PerfStat |
start()
Start to measure execution time for current thread.
Reset sample (period) values if aggregation time threshold passed over. |
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. |
String |
toString() |
public PerfStat(String name)
public PerfStat(String name, long aggregationPeriodMs)
public static String getJmxDomain()
public static void setJmxDomain(String jmxDomain)
public static long getDefaultAggregationPeriodMs()
public static void setDefaultAggregationPeriodMs(long defaultAggregationPeriodMs)
public static Stat getPerfStat(String name)
name - public static Stat getPerfStat(String type, String name)
name - public static TreeMap<String,TreeMap<String,StatImpl>> getPerfStat()
public static void merge(Map<String,Map<String,StatImpl>> rhsStatsByType)
public static void resetAll()
protected void finalize()
throws Throwable
public PerfStat start()
public long stop()
public void reset()
public org.apache.commons.lang3.time.StopWatch getStopWatch()
public Stat getStat()
Copyright © 2021. All rights reserved.