public abstract class PerfTimer extends Object
Usage:
final PerfTimer actionTimer = PerfTimer.createDebugTimer(getClass());
doAction();
System.out.println("Executing action took " + actionTimer.measure() + " ms");
PerfTimer provides an InApplicationMonitor (createMonitor()) connection as well as debug-only measurement facilities.| Modifier and Type | Class and Description |
|---|---|
private static class |
PerfTimer.DefaultPerfTimer
A timer implementing the default measurement behaviour based on system time.
|
private static class |
PerfTimer.NoPerfTimer
A timer that always returns 0 on measurements for performance reasons (null object).
|
static class |
PerfTimer.PerfMonitor
A timer providing an interface for submitting measurements to InApplicationMonitor.
|
| Constructor and Description |
|---|
PerfTimer() |
| Modifier and Type | Method and Description |
|---|---|
private static PerfTimer |
create(boolean active) |
static PerfTimer |
create(Class<?> type,
org.apache.log4j.Level level) |
static PerfTimer |
createDebugTimer(Class<?> type) |
static PerfTimer |
createInfoTimer(Class<?> type) |
static PerfTimer.PerfMonitor |
createMonitor() |
static PerfTimer |
createTimer() |
private static boolean |
isActive(Class<?> type,
org.apache.log4j.Level level) |
abstract long |
measure() |
public static PerfTimer createTimer()
public static PerfTimer.PerfMonitor createMonitor()
PerfTimer.PerfMonitor. Use PerfMonitor.monitor(String)
to perform a measurement and submit it to the InApplicationMonitor.public static PerfTimer createDebugTimer(Class<?> type)
type - the logger category used for debugging. A null argument performs equally to createTimer().public static PerfTimer createInfoTimer(Class<?> type)
type - the logger category used for info-level debugging. A null argument performs equally to createTimer().public static PerfTimer create(Class<?> type, org.apache.log4j.Level level)
type - the logger category used for custom level debugging. A null argument performs equally to createTimer().level - the level at which to logprivate static boolean isActive(Class<?> type, org.apache.log4j.Level level)
type - the logger category used for custom level debugging. A null argument performs equally to createTimer().level - the level at which to logprivate static PerfTimer create(boolean active)
active - determining whether to measure or not to measure.public abstract long measure()
Copyright © 2013 Immobilien Scout GmbH. All Rights Reserved.