Changeset 4154 for pjproject/trunk/pjlib/src/pj/timer.c
- Timestamp:
- Jun 5, 2012 10:41:17 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/timer.c
r3456 r4154 35 35 #include <pj/errno.h> 36 36 #include <pj/lock.h> 37 #include <pj/log.h> 38 39 #define THIS_FILE "timer.c" 37 40 38 41 #define HEAP_PARENT(X) (X == 0 ? 0 : (((X) - 1) / 2)) … … 453 456 } 454 457 458 #if PJ_TIMER_DEBUG 459 PJ_DEF(pj_status_t) pj_timer_heap_schedule_dbg( pj_timer_heap_t *ht, 460 pj_timer_entry *entry, 461 const pj_time_val *delay, 462 const char *src_file, 463 int src_line) 464 #else 455 465 PJ_DEF(pj_status_t) pj_timer_heap_schedule( pj_timer_heap_t *ht, 456 466 pj_timer_entry *entry, 457 467 const pj_time_val *delay) 468 #endif 458 469 { 459 470 pj_status_t status; … … 466 477 PJ_ASSERT_RETURN(entry->_timer_id < 1, PJ_EINVALIDOP); 467 478 479 #if PJ_TIMER_DEBUG 480 entry->src_file = src_file; 481 entry->src_line = src_line; 482 #endif 468 483 pj_gettickcount(&expires); 469 484 PJ_TIME_VAL_ADD(expires, *delay); … … 553 568 } 554 569 570 #if PJ_TIMER_DEBUG 571 PJ_DEF(void) pj_timer_heap_dump(pj_timer_heap_t *ht) 572 { 573 lock_timer_heap(ht); 574 575 PJ_LOG(3,(THIS_FILE, "Dumping timer heap:")); 576 PJ_LOG(3,(THIS_FILE, " Cur size: %d entries, max: %d", 577 (int)ht->cur_size, (int)ht->max_size)); 578 579 if (ht->cur_size) { 580 unsigned i; 581 pj_time_val now; 582 583 PJ_LOG(3,(THIS_FILE, " Entries: ")); 584 PJ_LOG(3,(THIS_FILE, " _id\tId\tElapsed\tSource")); 585 PJ_LOG(3,(THIS_FILE, " ----------------------------------")); 586 587 pj_gettickcount(&now); 588 589 for (i=0; i<(unsigned)ht->cur_size; ++i) { 590 pj_timer_entry *e = ht->heap[i]; 591 pj_time_val delta; 592 593 if (PJ_TIME_VAL_LTE(e->_timer_value, now)) 594 delta.sec = delta.msec = 0; 595 else { 596 delta = e->_timer_value; 597 PJ_TIME_VAL_SUB(delta, now); 598 } 599 600 PJ_LOG(3,(THIS_FILE, " %d\t%d\t%d.%03d\t%s:%d", 601 e->_timer_id, e->id, 602 (int)delta.sec, (int)delta.msec, 603 e->src_file, e->src_line)); 604 } 605 } 606 607 unlock_timer_heap(ht); 608 } 609 #endif 610
Note: See TracChangeset
for help on using the changeset viewer.