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/pjlib/include/pj/timer.h

    r3034 r4154  
    8686 * This structure represents an entry to the timer. 
    8787 */ 
    88 struct pj_timer_entry 
     88typedef struct pj_timer_entry 
    8989{ 
    9090    /**  
     
    118118     */ 
    119119    pj_time_val _timer_value; 
    120 }; 
     120 
     121#if PJ_TIMER_DEBUG 
     122    const char  *src_file; 
     123    int          src_line; 
     124#endif 
     125} pj_timer_entry; 
    121126 
    122127 
     
    209214 * @return          PJ_SUCCESS, or the appropriate error code. 
    210215 */ 
     216#if PJ_TIMER_DEBUG 
     217#  define pj_timer_heap_schedule(ht,e,d) \ 
     218                        pj_timer_heap_schedule_dbg(ht,e,d,__FILE__,__LINE__) 
     219 
     220  PJ_DECL(pj_status_t) pj_timer_heap_schedule_dbg( pj_timer_heap_t *ht, 
     221                                                   pj_timer_entry *entry, 
     222                                                   const pj_time_val *delay, 
     223                                                   const char *src_file, 
     224                                                   int src_line); 
     225#else 
    211226PJ_DECL(pj_status_t) pj_timer_heap_schedule( pj_timer_heap_t *ht, 
    212227                                             pj_timer_entry *entry,  
    213228                                             const pj_time_val *delay); 
     229#endif  /* PJ_TIMER_DEBUG */ 
    214230 
    215231/** 
     
    263279                                      pj_time_val *next_delay); 
    264280 
     281#if PJ_TIMER_DEBUG 
     282/** 
     283 * Dump timer heap entries. 
     284 * 
     285 * @param ht        The timer heap. 
     286 */ 
     287PJ_DECL(void) pj_timer_heap_dump(pj_timer_heap_t *ht); 
     288#endif 
     289 
    265290/** 
    266291 * @} 
Note: See TracChangeset for help on using the changeset viewer.