|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.semanticweb.elk.util.logging.ElkTimer
public class ElkTimer
Class for keeping CPU and system times.
| Field Summary | |
|---|---|
protected long |
currentStartCpuTime
|
protected long |
currentStartWallTime
|
protected boolean |
isRunning
|
protected int |
measurements
|
protected String |
name
|
static int |
RECORD_ALL
Flag for indicating that all supported times should be taken. |
static int |
RECORD_CPUTIME
Flag for indicating that CPU time should be taken. |
static int |
RECORD_NONE
Flag for indicating that no times should be taken (just count runs). |
static int |
RECORD_WALLTIME
Flag for indicating that wall clock time should be taken. |
protected int |
threadCount
|
protected long |
threadId
|
protected int |
todoFlags
|
protected long |
totalCpuTime
|
protected long |
totalWallTime
|
| Constructor Summary | |
|---|---|
ElkTimer(String name,
int todoFlags,
long threadId)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
|
long |
getAvgCpuTime()
|
long |
getAvgWallTime()
|
String |
getName()
Get the string name of the timer. |
static ElkTimer |
getNamedTimer(String timerName)
Get a timer of the given string name that takes all possible times (todos) for the current thread. |
static ElkTimer |
getNamedTimer(String timerName,
int todoFlags)
Get a timer of the given string name and todos for the current thread. |
static ElkTimer |
getNamedTimer(String timerName,
int todoFlags,
long threadId)
Get a timer of the given string name for the given thread. |
static Iterable<ElkTimer> |
getNamedTimers()
Returns all registered timers |
static ElkTimer |
getNamedTotalTimer(String timerName)
Collect the total times measured by all known named timers of the given name. |
protected static long |
getThreadCpuTime(long threadId)
|
long |
getThreadId()
Get the ID of the thread for which this timer was created. |
static ElkTimer |
getTimerForCurrentThread(String name,
int todoFlags)
|
long |
getTotalCpuTime()
Get the total recorded CPU time in nanoseconds. |
long |
getTotalWallTime()
Get the total recorded wall clock time in nanoseconds. |
int |
hashCode()
|
boolean |
isRunning()
Return true if the timer is running. |
void |
log(org.apache.log4j.Logger logger)
Print logging information for the timer using debug priority. |
void |
log(org.apache.log4j.Logger logger,
org.apache.log4j.Priority priority)
Print logging information for the timer. |
static void |
logAllNamedTimers(String timerName,
org.apache.log4j.Logger logger)
|
static void |
logAllNamedTimers(String timerName,
org.apache.log4j.Logger logger,
org.apache.log4j.Priority priority)
|
void |
reset()
Stop the timer (if running) and reset all recorded values. |
static void |
resetNamedTimer(String timerName)
Reset a timer of the given string name for all todos and the current thread. |
static void |
resetNamedTimer(String timerName,
int todoFlags)
Reset a timer of the given string name for the current thread. |
static void |
resetNamedTimer(String timerName,
int todoFlags,
long threadId)
Reset a timer of the given string name for the given thread. |
void |
start()
Start the timer. |
static void |
startNamedTimer(String timerName)
Start a timer of the given string name for all todos and the current thread. |
static void |
startNamedTimer(String timerName,
int todoFlags)
Start a timer of the given string name for the current thread. |
static void |
startNamedTimer(String timerName,
int todoFlags,
long threadId)
Start a timer of the given string name for the current thread. |
long |
stop()
Stop the timer and return the CPU time that has passed since it had last been started. |
static long |
stopNamedTimer(String timerName)
Stop a timer of the given string name for all todos and the current thread. |
static long |
stopNamedTimer(String timerName,
int todoFlags)
Stop a timer of the given string name for the current thread. |
static long |
stopNamedTimer(String timerName,
int todoFlags,
long threadId)
Stop a timer of the given string name for the given thread. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int RECORD_NONE
public static final int RECORD_CPUTIME
public static final int RECORD_WALLTIME
public static final int RECORD_ALL
protected final String name
protected final long threadId
protected final int todoFlags
protected long currentStartCpuTime
protected long currentStartWallTime
protected boolean isRunning
protected long totalCpuTime
protected long totalWallTime
protected int measurements
protected int threadCount
| Constructor Detail |
|---|
public ElkTimer(String name,
int todoFlags,
long threadId)
name - todoFlags - threadId - | Method Detail |
|---|
public static ElkTimer getTimerForCurrentThread(String name,
int todoFlags)
name - todoFlags -
ElkTimer for the current threadpublic long getTotalCpuTime()
public long getAvgCpuTime()
public String getName()
public long getThreadId()
public long getTotalWallTime()
public long getAvgWallTime()
public boolean isRunning()
public void start()
public void reset()
public long stop()
public void log(org.apache.log4j.Logger logger)
logger - log()
public void log(org.apache.log4j.Logger logger,
org.apache.log4j.Priority priority)
logger - priority - public static void startNamedTimer(String timerName)
timerName - the name of the timer
public static void startNamedTimer(String timerName,
int todoFlags)
timerName - the name of the timertodoFlags -
public static void startNamedTimer(String timerName,
int todoFlags,
long threadId)
timerName - the name of the timertodoFlags - threadId - of the thread to track, or 0 if only system clock should be
trackedpublic static long stopNamedTimer(String timerName)
timerName - the name of the timer
public static long stopNamedTimer(String timerName,
int todoFlags)
timerName - the name of the timertodoFlags -
public static long stopNamedTimer(String timerName,
int todoFlags,
long threadId)
timerName - the name of the timertodoFlags - threadId - of the thread to track, or 0 if only system clock should be
tracked
public static void resetNamedTimer(String timerName)
timerName - the name of the timer
public static void resetNamedTimer(String timerName,
int todoFlags)
timerName - the name of the timertodoFlags -
public static void resetNamedTimer(String timerName,
int todoFlags,
long threadId)
timerName - the name of the timertodoFlags - threadId - of the thread to track, or 0 if only system clock should be
trackedpublic static ElkTimer getNamedTimer(String timerName)
timerName - the name of the timer
public static Iterable<ElkTimer> getNamedTimers()
public static ElkTimer getNamedTimer(String timerName,
int todoFlags)
timerName - the name of the timertodoFlags -
public static ElkTimer getNamedTimer(String timerName,
int todoFlags,
long threadId)
timerName - the name of the timertodoFlags - threadId - of the thread to track, or 0 if only system clock should be
tracked
public static ElkTimer getNamedTotalTimer(String timerName)
timerName -
public static void logAllNamedTimers(String timerName,
org.apache.log4j.Logger logger)
public static void logAllNamedTimers(String timerName,
org.apache.log4j.Logger logger,
org.apache.log4j.Priority priority)
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectprotected static long getThreadCpuTime(long threadId)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||