public IoFilterEvent(INextFilter nextFilter, IoEventType eventType, IoSession session, Object parameter) : base(eventType, session, parameter) { if (nextFilter == null) throw new ArgumentNullException("nextFilter"); _nextFilter = nextFilter; }
private void SetProfilers(IoEventType eventTypes) { if ((eventTypes & IoEventType.MessageReceived) == IoEventType.MessageReceived) { _messageReceivedTimerWorker = new TimerWorker(); _profileMessageReceived = true; } if ((eventTypes & IoEventType.MessageSent) == IoEventType.MessageSent) { _messageSentTimerWorker = new TimerWorker(); _profileMessageSent = true; } if ((eventTypes & IoEventType.SessionCreated) == IoEventType.SessionCreated) { _sessionCreatedTimerWorker = new TimerWorker(); _profileSessionCreated = true; } if ((eventTypes & IoEventType.SessionOpened) == IoEventType.SessionOpened) { _sessionOpenedTimerWorker = new TimerWorker(); _profileSessionOpened = true; } if ((eventTypes & IoEventType.SessionIdle) == IoEventType.SessionIdle) { _sessionIdleTimerWorker = new TimerWorker(); _profileSessionIdle = true; } if ((eventTypes & IoEventType.SessionClosed) == IoEventType.SessionClosed) { _sessionClosedTimerWorker = new TimerWorker(); _profileSessionClosed = true; } }
/// <summary> /// </summary> public IoEvent(IoEventType eventType, IoSession session, Object parameter) { if (session == null) throw new ArgumentNullException("session"); _eventType = eventType; _session = session; _parameter = parameter; }
/// <summary> /// Creates an executor filter. /// </summary> /// <param name="executor">the <see cref="IoEventExecutor"/> to run events</param> /// <param name="eventTypes">the event types interested</param> public ExecutorFilter(IoEventExecutor executor, IoEventType eventTypes) { _eventTypes = eventTypes; if (executor == null) _executor = new OrderedThreadPoolExecutor(); else _executor = executor; }
/// <summary> /// </summary> public IoFilterEvent(INextFilter nextFilter, IoEventType eventType, IoSession session, Object parameter) : base(eventType, session, parameter) { if (nextFilter == null) { throw new ArgumentNullException("nextFilter"); } _nextFilter = nextFilter; }
/// <summary> /// </summary> public IoEvent(IoEventType eventType, IoSession session, Object parameter) { if (session == null) { throw new ArgumentNullException("session"); } _eventType = eventType; _session = session; _parameter = parameter; }
public ExecutorFilter(IoEventExecutor executor, IoEventType eventTypes) { _eventTypes = eventTypes; if (executor == null) { _executor = new OrderedThreadPoolExecutor(); } else { _executor = executor; } }
private TimerWorker GetTimerWorker(IoEventType type) { switch (type) { case IoEventType.MessageReceived: if (_profileMessageReceived) { return(_messageReceivedTimerWorker); } break; case IoEventType.MessageSent: if (_profileMessageSent) { return(_messageSentTimerWorker); } break; case IoEventType.SessionCreated: if (_profileSessionCreated) { return(_sessionCreatedTimerWorker); } break; case IoEventType.SessionOpened: if (_profileSessionOpened) { return(_sessionOpenedTimerWorker); } break; case IoEventType.SessionIdle: if (_profileSessionIdle) { return(_sessionIdleTimerWorker); } break; case IoEventType.SessionClosed: if (_profileSessionClosed) { return(_sessionClosedTimerWorker); } break; default: break; } throw new ArgumentException("You are not monitoring this event. Please add this event first."); }
/// <summary> /// Get the average time for the specified method represented by the <see cref="IoEventType"/>. /// </summary> public Double GetAverageTime(IoEventType type) { return(GetTimerWorker(type).Average); }
/// <summary> /// Get the average time for the specified method represented by the <see cref="IoEventType"/>. /// </summary> public Double GetAverageTime(IoEventType type) { return GetTimerWorker(type).Average; }
/// <summary> /// Creates a profiler. /// </summary> /// <param name="timeUnit">the time unit being used</param> /// <param name="eventTypes">the event types to profile</param> public ProfilerTimerFilter(TimeUnit timeUnit, IoEventType eventTypes) { _timeUnit = timeUnit; SetProfilers(eventTypes); }
/// <summary> /// Gets maximum time the method represented by <see cref="IoEventType"/> has executed. /// </summary> public Int64 GetMaximumTime(IoEventType type) { return(GetTimerWorker(type).maximum); }
/// <summary> /// Gets the total time this method has been executing. /// </summary> public Int64 GetTotalTime(IoEventType type) { return GetTimerWorker(type).total; }
/// <summary> /// Gets the total number of times the method has been called that is represented /// by the <see cref="IoEventType"/>. /// </summary> public Int64 GetTotalCalls(IoEventType type) { return GetTimerWorker(type).callsNumber; }
/// <summary> /// Creates an executor filter with default <see cref="IoEventExecutor"/>. /// </summary> /// <param name="eventTypes">the event types interested</param> public ExecutorFilter(IoEventType eventTypes) : this(null, eventTypes) { }
/// <summary> /// Gets the total number of times the method has been called that is represented /// by the <see cref="IoEventType"/>. /// </summary> public Int64 GetTotalCalls(IoEventType type) { return(GetTimerWorker(type).callsNumber); }
/// <summary> /// Gets the total time this method has been executing. /// </summary> public Int64 GetTotalTime(IoEventType type) { return(GetTimerWorker(type).total); }
/// <summary> /// Gets maximum time the method represented by <see cref="IoEventType"/> has executed. /// </summary> public Int64 GetMaximumTime(IoEventType type) { return GetTimerWorker(type).maximum; }
private TimerWorker GetTimerWorker(IoEventType type) { switch (type) { case IoEventType.MessageReceived: if (_profileMessageReceived) return _messageReceivedTimerWorker; break; case IoEventType.MessageSent: if (_profileMessageSent) return _messageSentTimerWorker; break; case IoEventType.SessionCreated: if (_profileSessionCreated) return _sessionCreatedTimerWorker; break; case IoEventType.SessionOpened: if (_profileSessionOpened) return _sessionOpenedTimerWorker; break; case IoEventType.SessionIdle: if (_profileSessionIdle) return _sessionIdleTimerWorker; break; case IoEventType.SessionClosed: if (_profileSessionClosed) return _sessionClosedTimerWorker; break; default: break; } throw new ArgumentException("You are not monitoring this event. Please add this event first."); }
private void SetProfilers(IoEventType eventTypes) { if ((eventTypes & IoEventType.MessageReceived) == IoEventType.MessageReceived) { _messageReceivedTimerWorker = new TimerWorker(); _profileMessageReceived = true; } if ((eventTypes & IoEventType.MessageSent) == IoEventType.MessageSent) { _messageSentTimerWorker = new TimerWorker(); _profileMessageSent = true; } if ((eventTypes & IoEventType.SessionCreated) == IoEventType.SessionCreated) { _sessionCreatedTimerWorker = new TimerWorker(); _profileSessionCreated = true; } if ((eventTypes & IoEventType.SessionOpened) == IoEventType.SessionOpened) { _sessionOpenedTimerWorker = new TimerWorker(); _profileSessionOpened = true; } if ((eventTypes & IoEventType.SessionIdle) == IoEventType.SessionIdle) { _sessionIdleTimerWorker = new TimerWorker(); _profileSessionIdle = true; } if ((eventTypes & IoEventType.SessionClosed) == IoEventType.SessionClosed) { _sessionClosedTimerWorker = new TimerWorker(); _profileSessionClosed = true; } }
/// <summary> /// Creates a profiler. /// </summary> /// <param name="timeUnit">the time unit being used</param> /// <param name="eventTypes">the event types to profile</param> public ProfilerTimerFilter(TimeUnit timeUnit, IoEventType eventTypes) { _timeUnit = timeUnit; SetProfilers(eventTypes); }
public ExecutorFilter(IoEventType eventTypes) : this(null, eventTypes) { }