Ignore:
Timestamp:
Jun 5, 2012 10:41:17 AM (10 years ago)
Author:
bennylp
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c

    r3999 r4154  
    607607 
    608608    /* Destroy timer heap */ 
     609#if PJ_TIMER_DEBUG 
     610    pj_timer_heap_dump(endpt->timer_heap); 
     611#endif 
    609612    pj_timer_heap_destroy(endpt->timer_heap); 
    610613 
     
    769772 * Schedule timer. 
    770773 */ 
     774#if PJ_TIMER_DEBUG 
     775PJ_DEF(pj_status_t) pjsip_endpt_schedule_timer_dbg(pjsip_endpoint *endpt, 
     776                                                    pj_timer_entry *entry, 
     777                                                    const pj_time_val *delay, 
     778                                                    const char *src_file, 
     779                                                    int src_line) 
     780{ 
     781    PJ_LOG(6, (THIS_FILE, "pjsip_endpt_schedule_timer(entry=%p, delay=%u.%u)", 
     782                         entry, delay->sec, delay->msec)); 
     783    return pj_timer_heap_schedule_dbg(endpt->timer_heap, entry, delay, 
     784                                      src_file, src_line); 
     785} 
     786#else 
    771787PJ_DEF(pj_status_t) pjsip_endpt_schedule_timer( pjsip_endpoint *endpt, 
    772788                                                pj_timer_entry *entry, 
     
    777793    return pj_timer_heap_schedule( endpt->timer_heap, entry, delay ); 
    778794} 
     795#endif 
    779796 
    780797/* 
     
    11941211 
    11951212    /* Timer. */ 
     1213#if PJ_TIMER_DEBUG 
     1214    pj_timer_heap_dump(endpt->timer_heap); 
     1215#else 
    11961216    PJ_LOG(3,(THIS_FILE, " Timer heap has %u entries",  
    11971217                        pj_timer_heap_count(endpt->timer_heap))); 
     1218#endif 
    11981219 
    11991220    /* Unlock mutex. */ 
Note: See TracChangeset for help on using the changeset viewer.