|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.common.IoFilterAdapter
org.apache.mina.filter.statistic.ProfilerTimerFilter
public class ProfilerTimerFilter
This class will measure, the time it takes for a
method in the IoFilterAdapter
class to execute. The basic
premise of the logic in this class is to get the current time
at the beginning of the method, call method on nextFilter, and
then get the current time again. An example of how to use
the filter is:
ProfilerTimerFilter profiler = new ProfilerTimerFilter( TimeUnit.MILLISECOND, IoEventType.MESSAGE_RECEIVED); chain.addFirst("Profiler", profiler);
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.mina.common.IoFilter |
---|
IoFilter.NextFilter |
Constructor Summary | |
---|---|
ProfilerTimerFilter()
Creates a new instance of ProfilerFilter. |
|
ProfilerTimerFilter(TimeUnit unit)
Creates a new instance of ProfilerFilter. |
|
ProfilerTimerFilter(TimeUnit unit,
EnumSet<IoEventType> eventTypes)
Creates a new instance of ProfilerFilter. |
|
ProfilerTimerFilter(TimeUnit unit,
IoEventType firstEventType,
IoEventType... otherEventTypes)
Creates a new instance of ProfilerFilter. |
Method Summary | |
---|---|
void |
addEventToProfile(IoEventType type)
Add an IoEventType to profile |
double |
getAverageTime(IoEventType type)
Get the average time for the specified method represented by the IoEventType |
Set<IoEventType> |
getEventsToProfile()
Return the bitmask that is being used to display timing information for this filter. |
long |
getMaximumTime(IoEventType type)
The maximum time the method represented by IoEventType has executed |
long |
getMinimumTime(IoEventType type)
The minimum time the method represented by IoEventType has executed |
long |
getTotalCalls(IoEventType type)
Gets the total number of times the method has been called that is represented by the IoEventType |
long |
getTotalTime(IoEventType type)
The total time this method has been executing |
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoSession session,
Object message)
Filters IoHandler.messageReceived(IoSession,Object)
event. |
void |
messageSent(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters IoHandler.messageSent(IoSession,Object)
event. |
void |
removeEventToProfile(IoEventType type)
Remove an IoEventType to profile |
void |
sessionClosed(IoFilter.NextFilter nextFilter,
IoSession session)
Filters IoHandler.sessionClosed(IoSession) event. |
void |
sessionCreated(IoFilter.NextFilter nextFilter,
IoSession session)
Filters IoHandler.sessionCreated(IoSession) event. |
void |
sessionIdle(IoFilter.NextFilter nextFilter,
IoSession session,
IdleStatus status)
Filters IoHandler.sessionIdle(IoSession,IdleStatus)
event. |
void |
sessionOpened(IoFilter.NextFilter nextFilter,
IoSession session)
Filters IoHandler.sessionOpened(IoSession) event. |
void |
setEventsToProfile(IoEventType firstEventType,
IoEventType... otherEventTypes)
Set the bitmask in order to tell this filter which methods to print out timing information |
void |
setEventsToProfile(Set<IoEventType> eventTypes)
Set the bitmask in order to tell this filter which methods to print out timing information |
void |
setTimeUnit(TimeUnit unit)
Sets the TimeUnit being used. |
Methods inherited from class org.apache.mina.common.IoFilterAdapter |
---|
destroy, exceptionCaught, filterClose, filterSetTrafficMask, filterWrite, init, onPostAdd, onPostRemove, onPreAdd, onPreRemove |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProfilerTimerFilter()
public ProfilerTimerFilter(TimeUnit unit)
public ProfilerTimerFilter(TimeUnit unit, IoEventType firstEventType, IoEventType... otherEventTypes)
new ProfilerTimerFilter( TimeUnit.MILLISECONDS, IoEventType.MESSAGE_RECEIVED, IoEventType.MESSAGE_SENT);
unit
- Used to determine the level of precision you need in your timing.firstEventType
- an event type to profileotherEventTypes
- event types to profilepublic ProfilerTimerFilter(TimeUnit unit, EnumSet<IoEventType> eventTypes)
new ProfilerTimerFilter( TimeUnit.MILLISECONDS, EnumSet.of(IoEventType.MESSAGE_RECEIVED, IoEventType.MESSAGE_SENT));
unit
- Used to determine the level of precision you need in your timing.eventTypes
- A set of IoEventType
representation of the methods to profileMethod Detail |
---|
public void setTimeUnit(TimeUnit unit)
TimeUnit
being used.
unit
- the new TimeUnit
to be used.public void addEventToProfile(IoEventType type)
IoEventType
to profile
type
- The IoEventType
to profilepublic void removeEventToProfile(IoEventType type)
IoEventType
to profile
type
- The IoEventType
to profilepublic Set<IoEventType> getEventsToProfile()
public void setEventsToProfile(IoEventType firstEventType, IoEventType... otherEventTypes)
public void setEventsToProfile(Set<IoEventType> eventTypes)
eventTypes
- An int representing the new methods that should be loggedpublic void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception
IoFilter
IoHandler.messageReceived(IoSession,Object)
event.
messageReceived
in interface IoFilter
messageReceived
in class IoFilterAdapter
Exception
public void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
IoFilter
IoHandler.messageSent(IoSession,Object)
event.
messageSent
in interface IoFilter
messageSent
in class IoFilterAdapter
Exception
public void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoFilter
IoHandler.sessionClosed(IoSession)
event.
sessionClosed
in interface IoFilter
sessionClosed
in class IoFilterAdapter
Exception
public void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoFilter
IoHandler.sessionCreated(IoSession)
event.
sessionCreated
in interface IoFilter
sessionCreated
in class IoFilterAdapter
Exception
public void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception
IoFilter
IoHandler.sessionIdle(IoSession,IdleStatus)
event.
sessionIdle
in interface IoFilter
sessionIdle
in class IoFilterAdapter
Exception
public void sessionOpened(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoFilter
IoHandler.sessionOpened(IoSession)
event.
sessionOpened
in interface IoFilter
sessionOpened
in class IoFilterAdapter
Exception
public double getAverageTime(IoEventType type)
IoEventType
type
- The IoEventType
that the user wants to get the average method call time
IoEventType
public long getTotalCalls(IoEventType type)
IoEventType
type
- The IoEventType
that the user wants to get the total number of method calls
IoEventType
public long getTotalTime(IoEventType type)
type
- The IoEventType
that the user wants to get the total time this method has
been executing
IoEventType
public long getMinimumTime(IoEventType type)
IoEventType
has executed
type
- The IoEventType
that the user wants to get the minimum time this method has
executed
IoEventType
public long getMaximumTime(IoEventType type)
IoEventType
has executed
type
- The IoEventType
that the user wants to get the maximum time this method has
executed
IoEventType
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |