summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-06-05 10:41:17 +0000
committerBenny Prijono <bennylp@teluu.com>2012-06-05 10:41:17 +0000
commit2ffba2873e85bb5c7f9fcb025f9c28c4bb738b48 (patch)
tree58e68be64c103e4e60e52c18e6df477ca3375f72 /pjsip/include
parent1511db342e293b00656fcde74992d02b3c42046f (diff)
Re #1527: added debugging facility to the timer heap. By enabling PJ_TIMER_DEBUG, application can use pj_timer_heap_dump() or pjsip_endpt_dump() to dump the timer entries along with the source location where it is scheduled from. The macro will also enable dumping the timer heap entries when the SIP endpoint is being destroyed
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4154 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsip/sip_endpoint.h12
-rw-r--r--pjsip/include/pjsip/sip_event.h1
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h21
3 files changed, 34 insertions, 0 deletions
diff --git a/pjsip/include/pjsip/sip_endpoint.h b/pjsip/include/pjsip/sip_endpoint.h
index c6cf6d65..86dc9bef 100644
--- a/pjsip/include/pjsip/sip_endpoint.h
+++ b/pjsip/include/pjsip/sip_endpoint.h
@@ -150,9 +150,21 @@ PJ_DECL(pj_status_t) pjsip_endpt_handle_events2(pjsip_endpoint *endpt,
* @param delay The relative delay of the timer.
* @return PJ_OK (zero) if successfull.
*/
+#if PJ_TIMER_DEBUG
+#define pjsip_endpt_schedule_timer(ept,ent,d) \
+ pjsip_endpt_schedule_timer_dbg(ept, ent, d, \
+ __FILE__, __LINE__)
+
+PJ_DECL(pj_status_t) pjsip_endpt_schedule_timer_dbg(pjsip_endpoint *endpt,
+ pj_timer_entry *entry,
+ const pj_time_val *delay,
+ const char *src_file,
+ int src_line);
+#else
PJ_DECL(pj_status_t) pjsip_endpt_schedule_timer( pjsip_endpoint *endpt,
pj_timer_entry *entry,
const pj_time_val *delay );
+#endif
/**
* Cancel the previously registered timer.
diff --git a/pjsip/include/pjsip/sip_event.h b/pjsip/include/pjsip/sip_event.h
index cd8a76fc..4e002bc1 100644
--- a/pjsip/include/pjsip/sip_event.h
+++ b/pjsip/include/pjsip/sip_event.h
@@ -34,6 +34,7 @@ PJ_BEGIN_DECL
* @{
*/
#include <pj/types.h>
+#include <pj/timer.h>
/**
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 9de34cf3..02dc3f9b 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -2019,8 +2019,18 @@ PJ_DECL(pj_status_t) pjsua_verify_url(const char *url);
*
* @see pjsip_endpt_schedule_timer()
*/
+#if PJ_TIMER_DEBUG
+#define pjsua_schedule_timer(e,d) pjsua_schedule_timer_dbg(e,d,\
+ __FILE__,__LINE__)
+
+PJ_DECL(pj_status_t) pjsua_schedule_timer_dbg(pj_timer_entry *entry,
+ const pj_time_val *delay,
+ const char *src_file,
+ int src_line);
+#else
PJ_DECL(pj_status_t) pjsua_schedule_timer(pj_timer_entry *entry,
const pj_time_val *delay);
+#endif
/**
* Schedule a callback function to be called after a specified time interval.
@@ -2033,9 +2043,20 @@ PJ_DECL(pj_status_t) pjsua_schedule_timer(pj_timer_entry *entry,
*
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
+#if PJ_TIMER_DEBUG
+#define pjsua_schedule_timer2(cb,u,d) \
+ pjsua_schedule_timer2_dbg(cb,u,d,__FILE__,__LINE__)
+
+PJ_DECL(pj_status_t) pjsua_schedule_timer2_dbg(void (*cb)(void *user_data),
+ void *user_data,
+ unsigned msec_delay,
+ const char *src_file,
+ int src_line);
+#else
PJ_DECL(pj_status_t) pjsua_schedule_timer2(void (*cb)(void *user_data),
void *user_data,
unsigned msec_delay);
+#endif
/**
* Cancel the previously scheduled timer.