public class PerfStat extends Object
private PerfStat methodPerf = new PerfStat("business.domain.method")
...
public void myMethod() {
methodPerf.start();
...
methodPerf.stop();
}
}
start(),
stop(),
getPerfStat(),
StopWatch| Modifier and Type | Field and Description |
|---|---|
static long |
AGGREGATION_PERIOD_MS |
static String |
DOMAIN |
| Constructor and Description |
|---|
PerfStat(String domain) |
PerfStat(String domain,
long aggregationPeriodMs) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
finalize() |
static TreeMap<String,StatImpl> |
getPerfStat()
Performance statistic for all domains
|
static Stat |
getPerfStat(String domain)
Performance statistic for domain
|
Stat |
getStat() |
org.apache.commons.lang3.time.StopWatch |
getStopWatch() |
static void |
merge(Map<String,StatImpl> rhsStats)
You may want to merge performance statistic from other JVMs
|
void |
reset()
Reset statistic
|
static void |
resetAll()
Reset statistic for all domains
|
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 domain.
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 static final String DOMAIN
public static final long AGGREGATION_PERIOD_MS
public PerfStat(String domain)
public PerfStat(String domain, long aggregationPeriodMs)
public static Stat getPerfStat(String domain)
domain - public static TreeMap<String,StatImpl> getPerfStat()
public static void merge(Map<String,StatImpl> rhsStats)
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 © 2020. All rights reserved.