Added configuration parameter for excessive message dispatch time.
git-svn-id: http://yate.null.ro/svn/yate/trunk@739 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
87d33efa59
commit
d9ec2f62a3
|
@ -21,6 +21,13 @@
|
|||
; restart every 10 seconds
|
||||
;restarts=0
|
||||
|
||||
; warntime: int: Warn time limit for message dispatch in milliseconds, a value
|
||||
; of zero disables such warnings
|
||||
;warntime=0
|
||||
|
||||
; msgsniff: bool: Activate message sniffer module (if loaded) at engine init time
|
||||
;msgsniff=disable
|
||||
|
||||
|
||||
[modules]
|
||||
; This section should hold one line for each module whose loading behaviour
|
||||
|
|
|
@ -709,6 +709,7 @@ void Engine::loadPlugins()
|
|||
s_extramod = name;
|
||||
s_maxworkers = s_cfg.getIntValue("general","maxworkers",s_maxworkers);
|
||||
s_restarts = s_cfg.getIntValue("general","restarts");
|
||||
m_dispatcher.warnTime(1000*(u_int64_t)s_cfg.getIntValue("general","warntime"));
|
||||
NamedList *l = s_cfg.getSection("preload");
|
||||
if (l) {
|
||||
unsigned int len = l->length();
|
||||
|
|
|
@ -229,7 +229,7 @@ void MessageHandler::clearFilter()
|
|||
}
|
||||
|
||||
MessageDispatcher::MessageDispatcher()
|
||||
: m_changes(0)
|
||||
: m_changes(0), m_warnTime(0)
|
||||
{
|
||||
XDebug(DebugAll,"MessageDispatcher::MessageDispatcher() [%p]",this);
|
||||
}
|
||||
|
@ -318,8 +318,8 @@ bool MessageDispatcher::dispatch(Message& msg)
|
|||
retv = h->received(msg);
|
||||
#ifdef DEBUG
|
||||
tm = Time::now() - tm;
|
||||
if (tm > 200000)
|
||||
Debug(DebugInfo,"Message '%s' [%p] passed trough %p in " FMT64U " usec",
|
||||
if (m_warnTime && (tm > m_warnTime))
|
||||
Debug(DebugInfo,"Message '%s' [%p] passed through %p in " FMT64U " usec",
|
||||
msg.c_str(),&msg,h,tm);
|
||||
#endif
|
||||
if (retv)
|
||||
|
@ -352,7 +352,7 @@ bool MessageDispatcher::dispatch(Message& msg)
|
|||
msg.dispatched(retv);
|
||||
#ifndef NDEBUG
|
||||
t = Time::now() - t;
|
||||
if (t > 200000) {
|
||||
if (m_warnTime && (t > m_warnTime)) {
|
||||
unsigned n = msg.length();
|
||||
String p;
|
||||
for (unsigned i = 0; i < n; i++) {
|
||||
|
|
12
yatengine.h
12
yatengine.h
|
@ -292,14 +292,14 @@ public:
|
|||
|
||||
/**
|
||||
* Retrive a reference to the creation time of the message.
|
||||
* @return A reference to the Time when the message was created
|
||||
* @return A reference to the @ref Time when the message was created
|
||||
*/
|
||||
inline Time& msgTime()
|
||||
{ return m_time; }
|
||||
|
||||
/**
|
||||
* Retrive a const reference to the creation time of the message.
|
||||
* @return A reference to the Time when the message was created
|
||||
* @return A reference to the @ref Time when the message was created
|
||||
*/
|
||||
inline const Time& msgTime() const
|
||||
{ return m_time; }
|
||||
|
@ -570,6 +570,13 @@ public:
|
|||
*/
|
||||
bool dequeueOne();
|
||||
|
||||
/**
|
||||
* Set a limit to generate warning when a message took too long to dispatch
|
||||
* @param usec Warning time limit in microseconds, zero to disable
|
||||
*/
|
||||
inline void warnTime(u_int64_t usec)
|
||||
{ m_warnTime = usec; }
|
||||
|
||||
/**
|
||||
* Clear all the message handlers and post-dispatch hooks
|
||||
*/
|
||||
|
@ -601,6 +608,7 @@ private:
|
|||
ObjList m_hooks;
|
||||
Mutex m_mutex;
|
||||
unsigned int m_changes;
|
||||
u_int64_t m_warnTime;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue