public abstract class Timer extends ADFPerfSensor
Modifier and Type | Field and Description |
---|---|
static Timer |
DUMMY_TIMER
An empty Timer object.
|
LAZY_NOUN_TYPE, mEnableDms, mEnablePerfLog, mIndex, mLevel, mSensorFullName, sIdxLogger, sLogger
Modifier | Constructor and Description |
---|---|
protected |
Timer()
creates an empty Timer object.
|
protected |
Timer(java.util.logging.Level level,
java.lang.String sensorFullName)
Used by TimerImpl.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Cleanup the timer.
|
void |
cleanupWithToken(TimerToken token)
Cleanup the timer using token.
|
static Timer |
createTimer(java.util.logging.Level level,
java.lang.String groupName,
java.lang.String name,
java.lang.String desc)
Deprecated.
see overloads with the type param
|
static Timer |
createTimer(java.util.logging.Level level,
java.lang.String groupName,
java.lang.String name,
java.lang.String type,
java.lang.String desc)
Create a Timer object identified by the groupName, the name, the type,
and the description.
|
static Timer |
createTimer(java.util.logging.Level level,
java.lang.String groupName,
java.lang.String name,
java.lang.String type,
java.lang.String desc,
oracle.dms.instrument.SegregationType sgType)
Deprecated.
|
static Timer |
createTimer(java.util.logging.Level level,
java.lang.String groupName,
java.lang.String name,
java.lang.String type,
java.lang.String desc,
TimerProvider provider)
Create a summerized Timer object identified by the groupName, the name,
the type, the description, and a bunch of sub timers provided by the provider.
|
static Timer |
createTimer(java.util.logging.Level level,
java.lang.String groupName,
java.lang.String name,
java.lang.String desc,
TimerProvider provider)
Deprecated.
see overloads with the type param
|
protected abstract long |
getElapsedTime()
Access how much elapese time in ms of DMS timer object.
|
void |
start()
Start the timer.
|
TimerToken |
startWithToken()
Start the timer using Token.
|
void |
stop()
Stop the timer.
|
void |
stop(int returnValue)
Stop the timer with specified returnValue
|
void |
stop(java.lang.Object returnValue)
Stop the timer with specified returnValue
|
void |
stopWithToken(TimerToken token)
Stop the timer using token.
|
void |
stopWithToken(TimerToken token,
int returnValue)
Stop the timer using token with specified returnValue
|
void |
stopWithToken(TimerToken token,
java.lang.Object returnValue)
Stop the timer using token with specified returnValue
|
public static final Timer DUMMY_TIMER
protected Timer()
protected Timer(java.util.logging.Level level, java.lang.String sensorFullName)
level
- sensorFullName
- @Deprecated public static Timer createTimer(java.util.logging.Level level, java.lang.String groupName, java.lang.String name, java.lang.String desc)
Developers should then call Timer's start(), stop() and cleanup() functions to track the time. Please note start()/stop() funtions should always be put in a try or catch block, and the cleanup() function should always be called in a finally block to make sure the Timer object is aborted cleanly in case stop() is not called.
Internally, this method creates a DMS PhaseEvent sensor.
A DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
When called inside the IDE, always returns DUMMY_TIMER.
level
- one of the message level identifiers, e.g. SEVEREgroupName
- the group name, which has the format of
/oracle/component_id/module/subModule/...
The component_id is also used as timer typename
- the timer namedesc
- the description for this timer.protected abstract long getElapsedTime()
@Deprecated public static Timer createTimer(java.util.logging.Level level, java.lang.String groupName, java.lang.String name, java.lang.String desc, TimerProvider provider)
Developers should then call Timer's start(), stop(returnValue) and cleanup() functions to track the time. Please note start()/stop(returnValue) funtions should always be put in a try or catch block, and the cleanup() function should always be called in a finally block to make sure the Timer object is aborted cleanly in case stop(returnValue) is not called.
Internally, this method creates one or more DMS PhaseEvent sensors depending on the implementation of TimerProvider.
A DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
When called inside the IDE, always returns DUMMY_TIMER.
level
- one of the message level identifiers, e.g. SEVEREgroupName
- the group name, which has the format of
/oracle/component_id/module/subModule/...
The component_id is also used as timer typename
- the timer namedesc
- the description for this timer.provider
- the timer provider implements TimerProviderpublic static Timer createTimer(java.util.logging.Level level, java.lang.String groupName, java.lang.String name, java.lang.String type, java.lang.String desc)
Developers should then call Timer's start(), stop() and cleanup() functions to track the time. Please note start()/stop() funtions should always be put in a try or catch block, and the cleanup() function should always be called in a finally block to make sure the Timer object is aborted cleanly in case stop() is not called.
Internally, this method creates a DMS PhaseEvent sensor.
A DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
When called inside the IDE, always returns DUMMY_TIMER.
level
- one of the message level identifiers, e.g. SEVEREgroupName
- the group name, which has the format of
/oracle/component_id/module/subModule/...name
- the timer nametype
- the timer type which collects all sensors
with same type and display them together in a table
in AggreSpydesc
- the description for this timer.@Deprecated public static Timer createTimer(java.util.logging.Level level, java.lang.String groupName, java.lang.String name, java.lang.String type, java.lang.String desc, oracle.dms.instrument.SegregationType sgType)
Developers should then call Timer's start(), stop() and cleanup() functions to track the time. Please note start()/stop() funtions should always be put in a try or catch block, and the cleanup() function should always be called in a finally block to make sure the Timer object is aborted cleanly in case stop() is not called.
Internally, this method creates a DMS PhaseEvent sensor.
A DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
When called inside the IDE, always returns DUMMY_TIMER.
level
- one of the message level identifiers, e.g. SEVEREgroupName
- the group name, which has the format of
/oracle/component_id/module/subModule/...name
- the timer nametype
- the timer type which collects all sensors
with same type and display them together in a table
in AggreSpydesc
- the description for this timer.sgType
- SegregationType type value used for multitenant partition typepublic static Timer createTimer(java.util.logging.Level level, java.lang.String groupName, java.lang.String name, java.lang.String type, java.lang.String desc, TimerProvider provider)
Developers should then call Timer's start(), stop(returnValue) and cleanup() functions to track the time. Please note start()/stop(returnValue) funtions should always be put in a try or catch block, and the cleanup() function should always be called in a finally block to make sure the Timer object is aborted cleanly in case stop(returnValue) is not called.
Internally, this method creates one or more DMS PhaseEvent sensors depending on the implementation of TimerProvider.
A DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
When called inside the IDE, always returns DUMMY_TIMER.
level
- one of the message level identifiers, e.g. SEVEREgroupName
- the group name, which has the format of
/oracle/component_id/module/subModule/...name
- the timer nametype
- the timer type which collects all sensors
with same type and display them together in a table
in AggreSpydesc
- the description for this timer.provider
- the timer provider implements TimerProviderpublic void start()
After a timer is started, developers should call stop() function to stop the timer. start()/stop() funtions should be put in a try block, and the cleanup() function should be called in a finally block.
Internally, this method starts the DMS PhaseEvent sensor. The DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
public TimerToken startWithToken()
After a timer is started, developer should call stopWithToken(token) and cleanupWithToken(token) function to stop and cleanup the timer.
Internally, this method starts the DMS PhaseEvent sensor. The DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
public void stop()
Developer should call start() function to start the timer. start()/stop() functions should be put in a try block, and the cleanup() function should be called in a finally block.
Internally, this method stops the DMS PhaseEvent sensor. The DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
public void stopWithToken(TimerToken token)
Developer should call startWithToken() function to start the timer, and then call this method to stop the timer
Internally, this method stops the DMS PhaseEvent sensor. The DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
token
- the TimerToken returned from startWithToken()public void stop(int returnValue)
Developer should call start() function to start the timer with TimerProvider, and stop(returnValue) to stop the timer. The returnValue decides which children timers to be updated.
Internally, this method stops the DMS PhaseEvent sensor for the parent sensor, and then update each children's PhaseEvent based on the result from TimerProvider.getTimers().
The DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
returnValue
- the return code from a piece of code being monitored.public void stopWithToken(TimerToken token, int returnValue)
Developer should call startWithToken() function to start the timer with TimerProvider, and stopWithToken(token, returnValue) to stop the timer. The returnValue decides which children timers to be updated.
Internally, this method stops the DMS PhaseEvent sensor for the parent sensor, and then update each children's PhaseEvent based on the result from TimerProvider.getTimers().
The DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
token
- the TimerToken returned from startWithToken()returnValue
- the return code from a piece of code being monitored.public void stop(java.lang.Object returnValue)
Developer should call start() function to start the timer with TimerProvider, and stop(returnValue) to stop the timer. The returnValue decides which children timers to be updated.
Internally, this method stops the DMS PhaseEvent sensor for the parent sensor, and then update each children's PhaseEvent based on the result from TimerProvider.getTimers().
The DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
returnValue
- the return code from a piece of code being monitored.public void stopWithToken(TimerToken token, java.lang.Object returnValue)
Developer should call startWithToken() function to start the timer with TimerProvider, and stopWithToken(token, returnValue) to stop the timer. The returnValue decides which children timers to be updated.
Internally, this method stops the DMS PhaseEvent sensor for the parent sensor, and then update each children's PhaseEvent based on the result from TimerProvider.getTimers().
The DMS PhaseEvent sensor has following metrics: active, avg, completed, maxActive, maxTime, minTime and time.
token
- the TimerToken returned from startWithToken()returnValue
- the return code from a piece of code being monitored.public void cleanup()
This function should be called within a finally block. It either stops the timer if everything goes fine, or aborts the timer if an exception occurred.
public void cleanupWithToken(TimerToken token)
This function should be called within a finally block. It either stops the timer if everything goes fine, or aborts the timer if an exception occurred.
token
- the TimerToken returned from startWithToken()