|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.iplanet.jato.util.ProfileTimer
Provides an easy-to-use and accurate timing mechanism for a variety of profiling uses. The timer can time individual events, or accumulate several discreet timing intervals and then provide a total or average.
The instance implmentation of this class is synchronized, allowing mutiple threads to share a timer. This behavior is useful for profiling code running in a shared server environment. The static implementation of this class is geared toward use on a single thread, and thus avoids synchronization since the thread's timer instance will not be shared.
Constructor Summary | |
ProfileTimer()
Default constructor |
Method Summary | |
double |
getAverageTime(boolean reset)
Returns the total time recorded by this timer between starts and stops averaged over the number of starts and stops since the last reset |
long |
getLastTime()
Returns the time interval recorded by the timer when it was last stopped, restarted, or updated |
static double |
getThreadAverageTime(boolean reset)
Gets the average time recorded by the current thread timer |
static long |
getThreadLastTime()
Gets the last time recorded by the current thread timer |
static ProfileTimer |
getThreadTimer()
Returns a timer instance that is shared across the current thread |
static long |
getThreadTotalTime()
Gets the total time recorded by the current thread timer |
long |
getTotalTime()
Returns the total time recorded by this timer since the last reset |
void |
reset()
Resets all recorded time, intervals, and number of stops and starts |
long |
restart()
Stops the timer, recording the elapsed time, and then starts it again, all in one (threadsafe) operation |
static void |
setThreadTimer(ProfileTimer timer)
Sets a timer instance to be shared across the current thread |
void |
start()
Starts the timer |
long |
stop()
Stops the timer and adds the elapsed time to the total time recorded since this timer was reset. |
static void |
threadReset()
Resets the current thread timer |
static long |
threadRestart()
Restarts the current thread timer |
static void |
threadStart()
Starts the current thread timer |
static long |
threadStop()
Stops the current thread timer |
static void |
threadUpdate(long interval)
Updates the current thread timer |
void |
update(long interval)
Updates the total timer time with the specified interval, and increments the recorded number of times the timer has been started and stopped. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ProfileTimer()
Method Detail |
public void start()
public long stop()
public long restart()
public void update(long interval)
interval
- The time interval to be added to the total time
recorded by the timerpublic long getLastTime()
public long getTotalTime()
public double getAverageTime(boolean reset)
reset
- If true, resets the timer after calculating the averagepublic void reset()
public static ProfileTimer getThreadTimer()
public static void setThreadTimer(ProfileTimer timer)
public static void threadStart()
start()
public static long threadStop()
stop()
public static long threadRestart()
restart()
public static void threadUpdate(long interval)
#update()
public static long getThreadLastTime()
getLastTime()
public static long getThreadTotalTime()
getTotalTime()
public static double getThreadAverageTime(boolean reset)
getAverageTime(boolean)
public static void threadReset()
reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |