Message ID | 1464859717-17866-1-git-send-email-matias.elo@nokia.com |
---|---|
State | New |
Headers | show |
The use of ODP_DBG() is intentional in all of these cases. These are diagnostic output which should be optional unless compiled with debug enabled. For normal operation these should not be seen. On Thu, Jun 2, 2016 at 4:28 AM, Matias Elo <matias.elo@nokia.com> wrote: > ODP_DBG() macro should not be used inside *_print() > functions. Since debug messages are disabled by default, the > print functions won't output anything with ODP_DBG. > > The patch also removes the extra space previously added to > the beginning of ODP_PRINT messages. > > Signed-off-by: Matias Elo <matias.elo@nokia.com> > --- > .../linux-generic/include/odp_debug_internal.h | 2 +- > platform/linux-generic/odp_name_table.c | 82 ++++++------ > platform/linux-generic/odp_pkt_queue.c | 34 +++-- > platform/linux-generic/odp_pool.c | 139 > ++++++++++++++------- > platform/linux-generic/odp_sorted_list.c | 21 +++- > platform/linux-generic/odp_timer_wheel.c | 44 +++---- > platform/linux-generic/odp_traffic_mngr.c | 41 +++--- > 7 files changed, 215 insertions(+), 148 deletions(-) > > diff --git a/platform/linux-generic/include/odp_debug_internal.h > b/platform/linux-generic/include/odp_debug_internal.h > index 02ae87a..4c44beb 100644 > --- a/platform/linux-generic/include/odp_debug_internal.h > +++ b/platform/linux-generic/include/odp_debug_internal.h > @@ -81,7 +81,7 @@ extern "C" { > * specifically for dumping internal data. > */ > #define ODP_PRINT(fmt, ...) \ > - odp_global_data.log_fn(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) > + odp_global_data.log_fn(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) > This is a reasonable cosmetic change. > > #ifdef __cplusplus > } > diff --git a/platform/linux-generic/odp_name_table.c > b/platform/linux-generic/odp_name_table.c > index 801c456..ee6c809 100644 > --- a/platform/linux-generic/odp_name_table.c > +++ b/platform/linux-generic/odp_name_table.c > @@ -220,20 +220,20 @@ static void secondary_hash_dump(secondary_hash_tbl_t > *secondary_hash_tbl) > entry_cnt = hash_tbl_entry & 0x3F; > list_cnt = > linked_list_len(name_tbl_entry); > if (entry_cnt != list_cnt) > - ODP_DBG("%s idx=%u entry_cnt=%u " > - "list_cnt=%u\n", > - __func__, > - idx, entry_cnt, list_cnt); > + ODP_PRINT("%s idx=%u entry_cnt=%u " > + "list_cnt=%u\n", > + __func__, > + idx, entry_cnt, > list_cnt); > > count += entry_cnt; > } else { > - ODP_DBG("%s inner secondary tbl\n", > - __func__); > + ODP_PRINT("%s inner secondary tbl\n", > + __func__); > } > } > } > > - ODP_DBG("%s count=%u\n", __func__, count); > + ODP_PRINT("%s count=%u\n", __func__, count); > } > #endif > > @@ -1069,7 +1069,7 @@ static void secondary_hash_histo_print(void) > if (name_hash_tbl.num_secondary_tbls[0] == 0) > return; > > - ODP_DBG(" level1 secondary hash histogram:\n"); > + ODP_PRINT(" level1 secondary hash histogram:\n"); > total_count = 0; > for (idx = 0; idx < 256; idx++) { > count = level1_histo[idx]; > @@ -1077,24 +1077,24 @@ static void secondary_hash_histo_print(void) > total_count += count * idx; > > if (count != 0) > - ODP_DBG(" num collisions=%02u count=%u\n", > - idx, count); > + ODP_PRINT(" num collisions=%02u count=%u\n", > + idx, count); > } > > count = level1_histo[256]; > total_count += count; > if (count != 0) > - ODP_DBG(" num collisions >=256 count=%u\n", count); > + ODP_PRINT(" num collisions >=256 count=%u\n", count); > > avg = (100 * total_count) / name_hash_tbl.num_secondary_tbls[0]; > avg = avg / SECONDARY_HASH_TBL_SIZE; > - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", > - avg / 100, avg % 100, total_count); > + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", > + avg / 100, avg % 100, total_count); > > if (name_hash_tbl.num_secondary_tbls[1] == 0) > return; > > - ODP_DBG(" level2 secondary hash histogram:\n"); > + ODP_PRINT(" level2 secondary hash histogram:\n"); > total_count = 0; > for (idx = 0; idx < 256; idx++) { > count = level2_histo[idx]; > @@ -1102,19 +1102,19 @@ static void secondary_hash_histo_print(void) > total_count += count * idx; > > if (count != 0) > - ODP_DBG(" num collisions=%02u count=%u\n", > - idx, count); > + ODP_PRINT(" num collisions=%02u count=%u\n", > + idx, count); > } > > count = level2_histo[256]; > total_count += count; > if (count != 0) > - ODP_DBG(" num collisions >=256 count=%u\n", count); > + ODP_PRINT(" num collisions >=256 count=%u\n", count); > > avg = (100 * total_count) / name_hash_tbl.num_secondary_tbls[1]; > avg = avg / SECONDARY_HASH_TBL_SIZE; > - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", > - avg / 100, avg % 100, total_count); > + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", > + avg / 100, avg % 100, total_count); > } > > #endif > @@ -1126,21 +1126,21 @@ void _odp_int_name_tbl_stats_print(void) > count, total_count; > uint32_t avg; > > - ODP_DBG("\nname table stats:\n"); > - ODP_DBG(" num_names=%u num_adds=%lu " > - "num_deletes=%lu num_name_tbls=%u\n", > - name_tbls.current_num_names, name_tbls.num_adds, > - name_tbls.num_deletes, name_tbls.num_name_tbls); > + ODP_PRINT("\nname table stats:\n"); > + ODP_PRINT(" num_names=%u num_adds=%lu " > + "num_deletes=%lu num_name_tbls=%u\n", > + name_tbls.current_num_names, name_tbls.num_adds, > + name_tbls.num_deletes, name_tbls.num_name_tbls); > for (idx = 0; idx < NUM_NAME_TBLS; idx++) { > name_tbl = name_tbls.tbls[idx]; > if ((name_tbl) && (name_tbl->num_used != 0)) > - ODP_DBG(" name_tbl %u num_allocd=%7u " > - "num_added_to_free_list=%7u " > - "num_used=%7u num_avail_to_add=%7u\n", idx, > - name_tbl->num_allocd, > - name_tbl->num_added_to_free_list, > - name_tbl->num_used, > - name_tbl->num_avail_to_add); > + ODP_PRINT(" name_tbl %u num_allocd=%7u " > + "num_added_to_free_list=%7u " > + "num_used=%7u num_avail_to_add=%7u\n", > idx, > + name_tbl->num_allocd, > + name_tbl->num_added_to_free_list, > + name_tbl->num_used, > + name_tbl->num_avail_to_add); > } > > memset(primary_hash_histo, 0, sizeof(primary_hash_histo)); > @@ -1149,7 +1149,7 @@ void _odp_int_name_tbl_stats_print(void) > primary_hash_histo[collisions]++; > } > > - ODP_DBG(" name_tbl primary hash histogram:\n"); > + ODP_PRINT(" name_tbl primary hash histogram:\n"); > total_count = 0; > for (idx = 0; idx < 256; idx++) { > count = primary_hash_histo[idx]; > @@ -1157,23 +1157,23 @@ void _odp_int_name_tbl_stats_print(void) > total_count += count * idx; > > if (count != 0) > - ODP_DBG(" num collisions=%02u count=%u\n", > - idx, count); > + ODP_PRINT(" num collisions=%02u count=%u\n", > + idx, count); > } > > count = primary_hash_histo[256]; > total_count += count; > if (count != 0) > - ODP_DBG(" num collisions >=256 count=%u\n", count); > + ODP_PRINT(" num collisions >=256 count=%u\n", count); > > avg = (100 * total_count) / PRIMARY_HASH_TBL_SIZE; > - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", > - avg / 100, avg % 100, total_count); > + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", > + avg / 100, avg % 100, total_count); > > - ODP_DBG(" num of first level secondary hash tbls=%u " > - "second level tbls=%u\n", > - name_hash_tbl.num_secondary_tbls[0], > - name_hash_tbl.num_secondary_tbls[1]); > + ODP_PRINT(" num of first level secondary hash tbls=%u " > + "second level tbls=%u\n", > + name_hash_tbl.num_secondary_tbls[0], > + name_hash_tbl.num_secondary_tbls[1]); > > #ifdef SECONDARY_HASH_HISTO_PRINT > if (name_hash_tbl.num_secondary_tbls[0] != 0) > diff --git a/platform/linux-generic/odp_pkt_queue.c > b/platform/linux-generic/odp_pkt_queue.c > index 949cf74..f43ceeb 100644 > --- a/platform/linux-generic/odp_pkt_queue.c > +++ b/platform/linux-generic/odp_pkt_queue.c > @@ -346,19 +346,31 @@ int _odp_pkt_queue_remove(_odp_int_queue_pool_t > queue_pool, > void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t queue_pool) > { > queue_pool_t *pool; > + int max_len = 512; > + char str[max_len]; > + int len = 0; > + int n = max_len - 1; > > pool = (queue_pool_t *)(uintptr_t)queue_pool; > - ODP_DBG("pkt_queue_stats - queue_pool=0x%" PRIX64 "\n", > queue_pool); > - ODP_DBG(" max_queue_num=%u max_queued_pkts=%u > next_queue_num=%u\n", > - pool->max_queue_num, pool->max_queued_pkts, > - pool->next_queue_num); > - ODP_DBG(" total pkt appends=%" PRIu64 " total pkt removes=%" > PRIu64 > - " bad removes=%" PRIu64 "\n", > - pool->total_pkt_appends, pool->total_pkt_removes, > - pool->total_bad_removes); > - ODP_DBG(" free_list size=%u min size=%u peak size=%u\n", > - pool->free_list_size, pool->min_free_list_size, > - pool->peak_free_list_size); > + > + len += snprintf(&str[len], n - len, > + "pkt_queue_stats - queue_pool=0x%" PRIX64 "\n", > + queue_pool); > + len += snprintf(&str[len], n - len, > + " max_queue_num=%u max_queued_pkts=%u > next_queue_num=%u\n", > + pool->max_queue_num, pool->max_queued_pkts, > + pool->next_queue_num); > + len += snprintf(&str[len], n - len, > + " total pkt appends=%" PRIu64 " total pkt > removes=" > + "%" PRIu64 " bad removes=%" PRIu64 "\n", > + pool->total_pkt_appends, pool->total_pkt_removes, > + pool->total_bad_removes); > + len += snprintf(&str[len], n - len, > + " free_list size=%u min size=%u peak size=%u\n", > + pool->free_list_size, pool->min_free_list_size, > + pool->peak_free_list_size); > + str[len] = '\0'; > + ODP_PRINT("\n%s\n", str); > } > > void _odp_queue_pool_destroy(_odp_int_queue_pool_t queue_pool) > diff --git a/platform/linux-generic/odp_pool.c > b/platform/linux-generic/odp_pool.c > index 5ed7080..c1ffaaa 100644 > --- a/platform/linux-generic/odp_pool.c > +++ b/platform/linux-generic/odp_pool.c > @@ -735,6 +735,10 @@ void odp_pool_print(odp_pool_t pool_hdl) > { > pool_entry_t *pool; > uint32_t pool_id; > + int max_len = 1536; > + char str[max_len]; > + int len = 0; > + int n = max_len - 1; > > pool_id = pool_handle_to_index(pool_hdl); > pool = get_pool_entry(pool_id); > @@ -756,64 +760,105 @@ void odp_pool_print(odp_pool_t pool_hdl) > uint64_t blklowmct = > odp_atomic_load_u64(&pool->s.poolstats.blk_low_wm_count); > > - ODP_DBG("Pool info\n"); > - ODP_DBG("---------\n"); > - ODP_DBG(" pool %" PRIu64 "\n", > + len += snprintf(&str[len], n - len, "Pool info\n"); > + len += snprintf(&str[len], n - len, "---------\n"); > + len += snprintf(&str[len], n - len, " pool %" PRIu64 > "\n", > odp_pool_to_u64(pool->s.pool_hdl)); > - ODP_DBG(" name %s\n", > + len += snprintf(&str[len], n - len, " name %s\n", > pool->s.flags.has_name ? pool->s.name : "Unnamed Pool"); > - ODP_DBG(" pool type %s\n", > + len += snprintf(&str[len], n - len, " pool type %s\n", > pool->s.params.type == ODP_POOL_BUFFER ? "buffer" : > (pool->s.params.type == ODP_POOL_PACKET ? "packet" : > (pool->s.params.type == ODP_POOL_TIMEOUT ? "timeout" : > "unknown"))); > - ODP_DBG(" pool storage ODP managed shm handle %" PRIu64 "\n", > - odp_shm_to_u64(pool->s.pool_shm)); > - ODP_DBG(" pool status %s\n", > - pool->s.quiesced ? "quiesced" : "active"); > - ODP_DBG(" pool opts %s, %s, %s\n", > - pool->s.flags.unsegmented ? "unsegmented" : "segmented", > - pool->s.flags.zeroized ? "zeroized" : "non-zeroized", > - pool->s.flags.predefined ? "predefined" : "created"); > - ODP_DBG(" pool base %p\n", pool->s.pool_base_addr); > - ODP_DBG(" pool size %zu (%zu pages)\n", > + len += snprintf(&str[len], n - len, > + " pool storage ODP managed shm handle %" PRIu64 > "\n", > + odp_shm_to_u64(pool->s.pool_shm)); > + len += snprintf(&str[len], n - len, " pool status %s\n", > + pool->s.quiesced ? "quiesced" : "active"); > + len += snprintf(&str[len], n - len, " pool opts %s, %s, > %s\n", > + pool->s.flags.unsegmented ? "unsegmented" : > "segmented", > + pool->s.flags.zeroized ? "zeroized" : > "non-zeroized", > + pool->s.flags.predefined ? "predefined" : > "created"); > + len += snprintf(&str[len], n - len, " pool base %p\n", > + pool->s.pool_base_addr); > + len += snprintf(&str[len], n - len, > + " pool size %zu (%zu pages)\n", > pool->s.pool_size, pool->s.pool_size / ODP_PAGE_SIZE); > - ODP_DBG(" pool mdata base %p\n", pool->s.pool_mdata_addr); > - ODP_DBG(" udata size %zu\n", pool->s.udata_size); > - ODP_DBG(" headroom %u\n", pool->s.headroom); > - ODP_DBG(" tailroom %u\n", pool->s.tailroom); > + len += snprintf(&str[len], n - len, " pool mdata base %p\n", > + pool->s.pool_mdata_addr); > + len += snprintf(&str[len], n - len, " udata size %" PRIu32 > "\n", > + pool->s.udata_size); > + len += snprintf(&str[len], n - len, " headroom %" PRIu32 > "\n", > + pool->s.headroom); > + len += snprintf(&str[len], n - len, " tailroom %" PRIu32 > "\n", > + pool->s.tailroom); > if (pool->s.params.type == ODP_POOL_BUFFER) { > - ODP_DBG(" buf size %zu\n", pool->s.params.buf.size); > - ODP_DBG(" buf align %u requested, %u used\n", > - pool->s.params.buf.align, pool->s.buf_align); > + len += snprintf(&str[len], n - len, > + " buf size %" PRIu32 "\n", > + pool->s.params.buf.size); > + len += snprintf(&str[len], n - len, > + " buf align %" PRIu32 " requested, " > + "%" PRIu32 " used\n", > pool->s.params.buf.align, > + pool->s.buf_align); > } else if (pool->s.params.type == ODP_POOL_PACKET) { > - ODP_DBG(" seg length %u requested, %u used\n", > - pool->s.params.pkt.seg_len, pool->s.seg_size); > - ODP_DBG(" pkt length %u requested, %u used\n", > - pool->s.params.pkt.len, pool->s.blk_size); > + len += snprintf(&str[len], n - len, > + " seg length %" PRIu32 " requested, " > + "%" PRIu32 " used\n", > + pool->s.params.pkt.seg_len, > pool->s.seg_size); > + len += snprintf(&str[len], n - len, > + " pkt length %" PRIu32 " requested, " > + "%" PRIu32 " used\n", > pool->s.params.pkt.len, > + pool->s.blk_size); > } > - ODP_DBG(" num bufs %u\n", pool->s.buf_num); > - ODP_DBG(" bufs available %u %s\n", bufcount, > - pool->s.buf_low_wm_assert ? " **buf low wm asserted**" : > ""); > - ODP_DBG(" bufs in use %u\n", pool->s.buf_num - bufcount); > - ODP_DBG(" buf allocs %lu\n", bufallocs); > - ODP_DBG(" buf frees %lu\n", buffrees); > - ODP_DBG(" buf empty %lu\n", bufempty); > - ODP_DBG(" blk size %zu\n", > + len += snprintf(&str[len], n - len, > + " num bufs %" PRIu32 "\n", > pool->s.buf_num); > + len += snprintf(&str[len], n - len, " bufs available %" PRIu32 " > %s\n", > + bufcount, pool->s.buf_low_wm_assert ? > + " **buf low wm asserted**" : ""); > + len += snprintf(&str[len], n - len, > + " bufs in use %" PRIu32 "\n", > + pool->s.buf_num - bufcount); > + len += snprintf(&str[len], n - len, > + " buf allocs %" PRIu64 "\n", bufallocs); > + len += snprintf(&str[len], n - len, > + " buf frees %" PRIu64 "\n", buffrees); > + len += snprintf(&str[len], n - len, > + " buf empty %" PRIu64 "\n", bufempty); > + len += snprintf(&str[len], n - len, > + " blk size %" PRIu32 "\n", > pool->s.seg_size > ODP_MAX_INLINE_BUF ? pool->s.seg_size : > 0); > - ODP_DBG(" blks available %u %s\n", blkcount, > - pool->s.blk_low_wm_assert ? " **blk low wm asserted**" : > ""); > - ODP_DBG(" blk allocs %lu\n", blkallocs); > - ODP_DBG(" blk frees %lu\n", blkfrees); > - ODP_DBG(" blk empty %lu\n", blkempty); > - ODP_DBG(" buf high wm value %lu\n", pool->s.buf_high_wm); > - ODP_DBG(" buf high wm count %lu\n", bufhiwmct); > - ODP_DBG(" buf low wm value %lu\n", pool->s.buf_low_wm); > - ODP_DBG(" buf low wm count %lu\n", buflowmct); > - ODP_DBG(" blk high wm value %lu\n", pool->s.blk_high_wm); > - ODP_DBG(" blk high wm count %lu\n", blkhiwmct); > - ODP_DBG(" blk low wm value %lu\n", pool->s.blk_low_wm); > - ODP_DBG(" blk low wm count %lu\n", blklowmct); > + len += snprintf(&str[len], n - len, " blks available %" PRIu32 " > %s\n", > + blkcount, pool->s.blk_low_wm_assert ? > + " **blk low wm asserted**" : ""); > + len += snprintf(&str[len], n - len, > + " blk allocs %" PRIu64 "\n", blkallocs); > + len += snprintf(&str[len], n - len, > + " blk frees %" PRIu64 "\n", blkfrees); > + len += snprintf(&str[len], n - len, > + " blk empty %" PRIu64 "\n", blkempty); > + len += snprintf(&str[len], n - len, > + " buf high wm value %" PRIu32 "\n", > + pool->s.buf_high_wm); > + len += snprintf(&str[len], n - len, > + " buf high wm count %" PRIu64 "\n", bufhiwmct); > + len += snprintf(&str[len], n - len, > + " buf low wm value %" PRIu32 "\n", > + pool->s.buf_low_wm); > + len += snprintf(&str[len], n - len, > + " buf low wm count %" PRIu64 "\n", buflowmct); > + len += snprintf(&str[len], n - len, > + " blk high wm value %" PRIu32 "\n", > + pool->s.blk_high_wm); > + len += snprintf(&str[len], n - len, > + " blk high wm count %" PRIu64 "\n", blkhiwmct); > + len += snprintf(&str[len], n - len, > + " blk low wm value %" PRIu32 "\n", > + pool->s.blk_low_wm); > + len += snprintf(&str[len], n - len, > + " blk low wm count %" PRIu64 "\n", blklowmct); > + str[len] = '\0'; > + ODP_PRINT("\n%s\n", str); > } > > > diff --git a/platform/linux-generic/odp_sorted_list.c > b/platform/linux-generic/odp_sorted_list.c > index 554494b..0dc08a8 100644 > --- a/platform/linux-generic/odp_sorted_list.c > +++ b/platform/linux-generic/odp_sorted_list.c > @@ -256,14 +256,23 @@ int _odp_sorted_list_destroy(_odp_int_sorted_pool_t > sorted_pool, > void _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool) > { > sorted_pool_t *pool; > + int max_len = 512; > + char str[max_len]; > + int len = 0; > + int n = max_len - 1; > > pool = (sorted_pool_t *)(uintptr_t)sorted_pool; > - ODP_DBG("sorted_pool=0x%" PRIX64 "\n", sorted_pool); > - ODP_DBG(" max_sorted_lists=%u next_list_idx=%u\n", > - pool->max_sorted_lists, pool->next_list_idx); > - ODP_DBG(" total_inserts=%" PRIu64 " total_deletes=%" PRIu64 > - " total_removes=%" PRIu64 "\n", pool->total_inserts, > - pool->total_deletes, pool->total_removes); > + len += snprintf(&str[len], n - len, > + "sorted_pool=0x%" PRIX64 "\n", sorted_pool); > + len += snprintf(&str[len], n - len, > + " max_sorted_lists=%u next_list_idx=%u\n", > + pool->max_sorted_lists, pool->next_list_idx); > + len += snprintf(&str[len], n - len, > + " total_inserts=%" PRIu64 " total_deletes=%" > PRIu64 > + " total_removes=%" PRIu64 "\n", > pool->total_inserts, > + pool->total_deletes, pool->total_removes); > + str[len] = '\0'; > + ODP_PRINT("\n%s\n", str); > } > > void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t sorted_pool) > diff --git a/platform/linux-generic/odp_timer_wheel.c > b/platform/linux-generic/odp_timer_wheel.c > index 66600b7..70a19d0 100644 > --- a/platform/linux-generic/odp_timer_wheel.c > +++ b/platform/linux-generic/odp_timer_wheel.c > @@ -914,10 +914,10 @@ uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t > timer_wheel) > static void _odp_int_timer_wheel_desc_print(wheel_desc_t *wheel_desc, > uint32_t wheel_idx) > { > - ODP_DBG(" wheel=%u num_slots=%u ticks_shift=%u ticks_per_slot=%u" > - " ticks_per_rev=%" PRIu64 "\n", > - wheel_idx, wheel_desc->num_slots, wheel_desc->ticks_shift, > - wheel_desc->ticks_per_slot, wheel_desc->ticks_per_rev); > + ODP_PRINT(" wheel=%u num_slots=%u ticks_shift=%u > ticks_per_slot=%u" > + " ticks_per_rev=%" PRIu64 "\n", > + wheel_idx, wheel_desc->num_slots, > wheel_desc->ticks_shift, > + wheel_desc->ticks_per_slot, wheel_desc->ticks_per_rev); > } > > void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel) > @@ -929,28 +929,30 @@ void _odp_timer_wheel_stats_print(_odp_timer_wheel_t > timer_wheel) > timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; > expired_ring = timer_wheels->expired_timers_ring; > > - ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%" PRIu64 "\n", > - timer_wheels->current_ticks); > + ODP_PRINT("_odp_int_timer_wheel_stats current_ticks=%" PRIu64 "\n", > + timer_wheels->current_ticks); > for (wheel_idx = 0; wheel_idx < 4; wheel_idx++) > _odp_int_timer_wheel_desc_print( > &timer_wheels->wheel_descs[wheel_idx], > wheel_idx); > > - ODP_DBG(" total timer_inserts=%" PRIu64 " timer_removes=%" PRIu64 > - " insert_fails=%" PRIu64 "\n", > - timer_wheels->total_timer_inserts, > - timer_wheels->total_timer_removes, > - timer_wheels->insert_fail_cnt); > - ODP_DBG(" total_promote_cnt=%" PRIu64 " promote_fail_cnt=%" > - PRIu64 "\n", timer_wheels->total_promote_cnt, > - timer_wheels->promote_fail_cnt); > - ODP_DBG(" free_list_size=%u min_size=%u peak_size=%u\n", > - timer_wheels->free_list_size, > timer_wheels->min_free_list_size, > - timer_wheels->peak_free_list_size); > - ODP_DBG(" expired_timers_ring size=%u count=%u " > - "peak_count=%u full_cnt=%u\n", > - expired_ring->max_idx + 1, expired_ring->count, > - expired_ring->peak_count, > expired_ring->expired_ring_full_cnt); > + ODP_PRINT(" total timer_inserts=%" PRIu64 " timer_removes=%" > PRIu64 > + " insert_fails=%" PRIu64 "\n", > + timer_wheels->total_timer_inserts, > + timer_wheels->total_timer_removes, > + timer_wheels->insert_fail_cnt); > + ODP_PRINT(" total_promote_cnt=%" PRIu64 " promote_fail_cnt=%" > + PRIu64 "\n", timer_wheels->total_promote_cnt, > + timer_wheels->promote_fail_cnt); > + ODP_PRINT(" free_list_size=%u min_size=%u peak_size=%u\n", > + timer_wheels->free_list_size, > + timer_wheels->min_free_list_size, > + timer_wheels->peak_free_list_size); > + ODP_PRINT(" expired_timers_ring size=%u count=%u " > + "peak_count=%u full_cnt=%u\n", > + expired_ring->max_idx + 1, expired_ring->count, > + expired_ring->peak_count, > + expired_ring->expired_ring_full_cnt); > } > > void _odp_timer_wheel_destroy(_odp_timer_wheel_t timer_wheel) > diff --git a/platform/linux-generic/odp_traffic_mngr.c > b/platform/linux-generic/odp_traffic_mngr.c > index fb18ab3..b4f525b 100644 > --- a/platform/linux-generic/odp_traffic_mngr.c > +++ b/platform/linux-generic/odp_traffic_mngr.c > @@ -4373,19 +4373,19 @@ void odp_tm_stats_print(odp_tm_t odp_tm) > tm_system = GET_TM_SYSTEM(odp_tm); > input_work_queue = tm_system->input_work_queue; > > - ODP_DBG("odp_tm_stats_print - tm_system=0x%" PRIX64 " tm_idx=%u\n", > - odp_tm, tm_system->tm_idx); > - ODP_DBG(" input_work_queue size=%u current cnt=%u peak cnt=%u\n", > - INPUT_WORK_RING_SIZE, input_work_queue->queue_cnt, > - input_work_queue->peak_cnt); > - ODP_DBG(" input_work_queue enqueues=%" PRIu64 " dequeues=% " > PRIu64 > - " fail_cnt=%" PRIu64 "\n", > input_work_queue->total_enqueues, > - input_work_queue->total_dequeues, > - input_work_queue->enqueue_fail_cnt); > - ODP_DBG(" green_cnt=%" PRIu64 " yellow_cnt=%" PRIu64 " red_cnt=%" > - PRIu64 "\n", tm_system->shaper_green_cnt, > - tm_system->shaper_yellow_cnt, > - tm_system->shaper_red_cnt); > + ODP_PRINT("odp_tm_stats_print - tm_system=0x%" PRIX64 " > tm_idx=%u\n", > + odp_tm, tm_system->tm_idx); > + ODP_PRINT(" input_work_queue size=%u current cnt=%u peak > cnt=%u\n", > + INPUT_WORK_RING_SIZE, input_work_queue->queue_cnt, > + input_work_queue->peak_cnt); > + ODP_PRINT(" input_work_queue enqueues=%" PRIu64 " dequeues=% " > PRIu64 > + " fail_cnt=%" PRIu64 "\n", > input_work_queue->total_enqueues, > + input_work_queue->total_dequeues, > + input_work_queue->enqueue_fail_cnt); > + ODP_PRINT(" green_cnt=%" PRIu64 " yellow_cnt=%" PRIu64 " > red_cnt=%" > + PRIu64 "\n", tm_system->shaper_green_cnt, > + tm_system->shaper_yellow_cnt, > + tm_system->shaper_red_cnt); > > _odp_pkt_queue_stats_print(tm_system->_odp_int_queue_pool); > _odp_timer_wheel_stats_print(tm_system->_odp_int_timer_wheel); > @@ -4395,14 +4395,13 @@ void odp_tm_stats_print(odp_tm_t odp_tm) > for (queue_num = 1; queue_num < max_queue_num; queue_num++) { > tm_queue_obj = tm_system->queue_num_tbl[queue_num]; > if (tm_queue_obj->pkts_rcvd_cnt != 0) > - ODP_DBG("queue_num=%u priority=%u rcvd=%u > enqueued=%u " > - "dequeued=%u consumed=%u\n", > - queue_num, > - tm_queue_obj->priority, > - tm_queue_obj->pkts_rcvd_cnt, > - tm_queue_obj->pkts_enqueued_cnt, > - tm_queue_obj->pkts_dequeued_cnt, > - tm_queue_obj->pkts_consumed_cnt); > + ODP_PRINT("queue_num=%u priority=%u rcvd=%u " > + "enqueued=%u dequeued=%u consumed=%u\n", > + queue_num, tm_queue_obj->priority, > + tm_queue_obj->pkts_rcvd_cnt, > + tm_queue_obj->pkts_enqueued_cnt, > + tm_queue_obj->pkts_dequeued_cnt, > + tm_queue_obj->pkts_consumed_cnt); > } > } > > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
I've added this to the agenda for Monday's ARCH call. On Fri, Jun 3, 2016 at 2:41 AM, Elo, Matias (Nokia - FI/Espoo) < matias.elo@nokia.com> wrote: > > > *From:* Bill Fischofer [mailto:bill.fischofer@linaro.org] > *Sent:* Friday, June 03, 2016 3:34 AM > *To:* Elo, Matias (Nokia - FI/Espoo) <matias.elo@nokia.com> > *Cc:* LNG ODP Mailman List <lng-odp@lists.linaro.org> > *Subject:* Re: [lng-odp] [PATCH] linux-gen: fix debug info print functions > > > > The use of ODP_DBG() is intentional in all of these cases. These are > diagnostic output which should be optional unless compiled with debug > enabled. For normal operation these should not be seen. > > > > > > HTML mail ... '>' indentation missing on this reply... > > > > The modified functions are either API print function or called only by the > API print functions and should always print when called. ODP_DBG() is meant > for internal debug messages. > > > > The only exceptions are secondary_hash_dump() and > secondary_hash_histo_print() functions which are only called if a define > (SECONDARY_HASH_HISTO_PRINT, SECONDARY_HASH_DUMP) has been set. In my > opinion it makes more sense to always print also in this case. > > > > -Matias > > > > > > On Thu, Jun 2, 2016 at 4:28 AM, Matias Elo <matias.elo@nokia.com> wrote: > > ODP_DBG() macro should not be used inside *_print() > functions. Since debug messages are disabled by default, the > print functions won't output anything with ODP_DBG. > > The patch also removes the extra space previously added to > the beginning of ODP_PRINT messages. > > Signed-off-by: Matias Elo <matias.elo@nokia.com> > --- > .../linux-generic/include/odp_debug_internal.h | 2 +- > platform/linux-generic/odp_name_table.c | 82 ++++++------ > platform/linux-generic/odp_pkt_queue.c | 34 +++-- > platform/linux-generic/odp_pool.c | 139 > ++++++++++++++------- > platform/linux-generic/odp_sorted_list.c | 21 +++- > platform/linux-generic/odp_timer_wheel.c | 44 +++---- > platform/linux-generic/odp_traffic_mngr.c | 41 +++--- > 7 files changed, 215 insertions(+), 148 deletions(-) > > diff --git a/platform/linux-generic/include/odp_debug_internal.h > b/platform/linux-generic/include/odp_debug_internal.h > index 02ae87a..4c44beb 100644 > --- a/platform/linux-generic/include/odp_debug_internal.h > +++ b/platform/linux-generic/include/odp_debug_internal.h > @@ -81,7 +81,7 @@ extern "C" { > * specifically for dumping internal data. > */ > #define ODP_PRINT(fmt, ...) \ > - odp_global_data.log_fn(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) > + odp_global_data.log_fn(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) > > > > This is a reasonable cosmetic change. > > > > > > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp > > >
This patch needs a rebase: bill@Ubuntu15:~/linaro/matiasprint$ git am --reject ~/Mail/Incoming/Matias/1 Applying: linux-gen: fix debug info print functions Checking patch platform/linux-generic/include/odp_debug_internal.h... Checking patch platform/linux-generic/odp_name_table.c... error: while searching for: entry_cnt = hash_tbl_entry & 0x3F; list_cnt = linked_list_len(name_tbl_entry); if (entry_cnt != list_cnt) ODP_DBG("%s idx=%u entry_cnt=%u " "list_cnt=%u\n", __func__, idx, entry_cnt, list_cnt); count += entry_cnt; } else { ODP_DBG("%s inner secondary tbl\n", __func__); } } } ODP_DBG("%s count=%u\n", __func__, count); } #endif error: patch failed: platform/linux-generic/odp_name_table.c:220 Checking patch platform/linux-generic/odp_pkt_queue.c... Checking patch platform/linux-generic/odp_pool.c... Checking patch platform/linux-generic/odp_sorted_list.c... Checking patch platform/linux-generic/odp_timer_wheel.c... Hunk #1 succeeded at 934 (offset 20 lines). Hunk #2 succeeded at 949 (offset 20 lines). Checking patch platform/linux-generic/odp_traffic_mngr.c... Hunk #1 succeeded at 4406 (offset 33 lines). error: while searching for: for (queue_num = 1; queue_num < max_queue_num; queue_num++) { tm_queue_obj = tm_system->queue_num_tbl[queue_num]; if (tm_queue_obj->pkts_rcvd_cnt != 0) ODP_DBG("queue_num=%u priority=%u rcvd=%u enqueued=%u " "dequeued=%u consumed=%u\n", queue_num, tm_queue_obj->priority, tm_queue_obj->pkts_rcvd_cnt, tm_queue_obj->pkts_enqueued_cnt, tm_queue_obj->pkts_dequeued_cnt, tm_queue_obj->pkts_consumed_cnt); } } error: patch failed: platform/linux-generic/odp_traffic_mngr.c:4395 Applied patch platform/linux-generic/include/odp_debug_internal.h cleanly. Applying patch platform/linux-generic/odp_name_table.c with 1 reject... Rejected hunk #1. Hunk #2 applied cleanly. Hunk #3 applied cleanly. Hunk #4 applied cleanly. Hunk #5 applied cleanly. Hunk #6 applied cleanly. Hunk #7 applied cleanly. Applied patch platform/linux-generic/odp_pkt_queue.c cleanly. Applied patch platform/linux-generic/odp_pool.c cleanly. Applied patch platform/linux-generic/odp_sorted_list.c cleanly. Applied patch platform/linux-generic/odp_timer_wheel.c cleanly. Applying patch platform/linux-generic/odp_traffic_mngr.c with 1 reject... Hunk #1 applied cleanly. Rejected hunk #2. Patch failed at 0001 linux-gen: fix debug info print functions The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === Upon review and based on prior discussions that ODP_PRINT() should be used for ODP APIs that print output, I believe that these changes should be made for the following modules/routines: odp_pool.c => odp_pool_print() should use ODP_PRINT() odp_traffic_mngr.c => odp_tm_stats_print() should use ODP_PRINT() These are the only changes in this patch that change the behavior of ODP APIs. All other changes are to internal debugging routines used mainly in the implementation of the traffic manager, and as such I believe they should remain ODP_DBG() calls since their only intended use is for debugging of the odp-linux implementation of various internal routines that are not exposed by any ODP APIs. That sort of optional output is exactly what ODP_DBG() is intended to provide, so I don't think we want to make this output unconditional. On Thu, Jun 2, 2016 at 4:28 AM, Matias Elo <matias.elo@nokia.com> wrote: > ODP_DBG() macro should not be used inside *_print() > functions. Since debug messages are disabled by default, the > print functions won't output anything with ODP_DBG. > > The patch also removes the extra space previously added to > the beginning of ODP_PRINT messages. > > Signed-off-by: Matias Elo <matias.elo@nokia.com> > --- > .../linux-generic/include/odp_debug_internal.h | 2 +- > platform/linux-generic/odp_name_table.c | 82 ++++++------ > platform/linux-generic/odp_pkt_queue.c | 34 +++-- > platform/linux-generic/odp_pool.c | 139 > ++++++++++++++------- > platform/linux-generic/odp_sorted_list.c | 21 +++- > platform/linux-generic/odp_timer_wheel.c | 44 +++---- > platform/linux-generic/odp_traffic_mngr.c | 41 +++--- > 7 files changed, 215 insertions(+), 148 deletions(-) > > diff --git a/platform/linux-generic/include/odp_debug_internal.h > b/platform/linux-generic/include/odp_debug_internal.h > index 02ae87a..4c44beb 100644 > --- a/platform/linux-generic/include/odp_debug_internal.h > +++ b/platform/linux-generic/include/odp_debug_internal.h > @@ -81,7 +81,7 @@ extern "C" { > * specifically for dumping internal data. > */ > #define ODP_PRINT(fmt, ...) \ > - odp_global_data.log_fn(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) > + odp_global_data.log_fn(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) > > #ifdef __cplusplus > } > diff --git a/platform/linux-generic/odp_name_table.c > b/platform/linux-generic/odp_name_table.c > index 801c456..ee6c809 100644 > --- a/platform/linux-generic/odp_name_table.c > +++ b/platform/linux-generic/odp_name_table.c > @@ -220,20 +220,20 @@ static void secondary_hash_dump(secondary_hash_tbl_t > *secondary_hash_tbl) > entry_cnt = hash_tbl_entry & 0x3F; > list_cnt = > linked_list_len(name_tbl_entry); > if (entry_cnt != list_cnt) > - ODP_DBG("%s idx=%u entry_cnt=%u " > - "list_cnt=%u\n", > - __func__, > - idx, entry_cnt, list_cnt); > + ODP_PRINT("%s idx=%u entry_cnt=%u " > + "list_cnt=%u\n", > + __func__, > + idx, entry_cnt, > list_cnt); > > count += entry_cnt; > } else { > - ODP_DBG("%s inner secondary tbl\n", > - __func__); > + ODP_PRINT("%s inner secondary tbl\n", > + __func__); > } > } > } > > - ODP_DBG("%s count=%u\n", __func__, count); > + ODP_PRINT("%s count=%u\n", __func__, count); > } > #endif > > @@ -1069,7 +1069,7 @@ static void secondary_hash_histo_print(void) > if (name_hash_tbl.num_secondary_tbls[0] == 0) > return; > > - ODP_DBG(" level1 secondary hash histogram:\n"); > + ODP_PRINT(" level1 secondary hash histogram:\n"); > total_count = 0; > for (idx = 0; idx < 256; idx++) { > count = level1_histo[idx]; > @@ -1077,24 +1077,24 @@ static void secondary_hash_histo_print(void) > total_count += count * idx; > > if (count != 0) > - ODP_DBG(" num collisions=%02u count=%u\n", > - idx, count); > + ODP_PRINT(" num collisions=%02u count=%u\n", > + idx, count); > } > > count = level1_histo[256]; > total_count += count; > if (count != 0) > - ODP_DBG(" num collisions >=256 count=%u\n", count); > + ODP_PRINT(" num collisions >=256 count=%u\n", count); > > avg = (100 * total_count) / name_hash_tbl.num_secondary_tbls[0]; > avg = avg / SECONDARY_HASH_TBL_SIZE; > - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", > - avg / 100, avg % 100, total_count); > + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", > + avg / 100, avg % 100, total_count); > > if (name_hash_tbl.num_secondary_tbls[1] == 0) > return; > > - ODP_DBG(" level2 secondary hash histogram:\n"); > + ODP_PRINT(" level2 secondary hash histogram:\n"); > total_count = 0; > for (idx = 0; idx < 256; idx++) { > count = level2_histo[idx]; > @@ -1102,19 +1102,19 @@ static void secondary_hash_histo_print(void) > total_count += count * idx; > > if (count != 0) > - ODP_DBG(" num collisions=%02u count=%u\n", > - idx, count); > + ODP_PRINT(" num collisions=%02u count=%u\n", > + idx, count); > } > > count = level2_histo[256]; > total_count += count; > if (count != 0) > - ODP_DBG(" num collisions >=256 count=%u\n", count); > + ODP_PRINT(" num collisions >=256 count=%u\n", count); > > avg = (100 * total_count) / name_hash_tbl.num_secondary_tbls[1]; > avg = avg / SECONDARY_HASH_TBL_SIZE; > - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", > - avg / 100, avg % 100, total_count); > + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", > + avg / 100, avg % 100, total_count); > } > > #endif > @@ -1126,21 +1126,21 @@ void _odp_int_name_tbl_stats_print(void) > count, total_count; > uint32_t avg; > > - ODP_DBG("\nname table stats:\n"); > - ODP_DBG(" num_names=%u num_adds=%lu " > - "num_deletes=%lu num_name_tbls=%u\n", > - name_tbls.current_num_names, name_tbls.num_adds, > - name_tbls.num_deletes, name_tbls.num_name_tbls); > + ODP_PRINT("\nname table stats:\n"); > + ODP_PRINT(" num_names=%u num_adds=%lu " > + "num_deletes=%lu num_name_tbls=%u\n", > + name_tbls.current_num_names, name_tbls.num_adds, > + name_tbls.num_deletes, name_tbls.num_name_tbls); > for (idx = 0; idx < NUM_NAME_TBLS; idx++) { > name_tbl = name_tbls.tbls[idx]; > if ((name_tbl) && (name_tbl->num_used != 0)) > - ODP_DBG(" name_tbl %u num_allocd=%7u " > - "num_added_to_free_list=%7u " > - "num_used=%7u num_avail_to_add=%7u\n", idx, > - name_tbl->num_allocd, > - name_tbl->num_added_to_free_list, > - name_tbl->num_used, > - name_tbl->num_avail_to_add); > + ODP_PRINT(" name_tbl %u num_allocd=%7u " > + "num_added_to_free_list=%7u " > + "num_used=%7u num_avail_to_add=%7u\n", > idx, > + name_tbl->num_allocd, > + name_tbl->num_added_to_free_list, > + name_tbl->num_used, > + name_tbl->num_avail_to_add); > } > > memset(primary_hash_histo, 0, sizeof(primary_hash_histo)); > @@ -1149,7 +1149,7 @@ void _odp_int_name_tbl_stats_print(void) > primary_hash_histo[collisions]++; > } > > - ODP_DBG(" name_tbl primary hash histogram:\n"); > + ODP_PRINT(" name_tbl primary hash histogram:\n"); > total_count = 0; > for (idx = 0; idx < 256; idx++) { > count = primary_hash_histo[idx]; > @@ -1157,23 +1157,23 @@ void _odp_int_name_tbl_stats_print(void) > total_count += count * idx; > > if (count != 0) > - ODP_DBG(" num collisions=%02u count=%u\n", > - idx, count); > + ODP_PRINT(" num collisions=%02u count=%u\n", > + idx, count); > } > > count = primary_hash_histo[256]; > total_count += count; > if (count != 0) > - ODP_DBG(" num collisions >=256 count=%u\n", count); > + ODP_PRINT(" num collisions >=256 count=%u\n", count); > > avg = (100 * total_count) / PRIMARY_HASH_TBL_SIZE; > - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", > - avg / 100, avg % 100, total_count); > + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", > + avg / 100, avg % 100, total_count); > > - ODP_DBG(" num of first level secondary hash tbls=%u " > - "second level tbls=%u\n", > - name_hash_tbl.num_secondary_tbls[0], > - name_hash_tbl.num_secondary_tbls[1]); > + ODP_PRINT(" num of first level secondary hash tbls=%u " > + "second level tbls=%u\n", > + name_hash_tbl.num_secondary_tbls[0], > + name_hash_tbl.num_secondary_tbls[1]); > > #ifdef SECONDARY_HASH_HISTO_PRINT > if (name_hash_tbl.num_secondary_tbls[0] != 0) > diff --git a/platform/linux-generic/odp_pkt_queue.c > b/platform/linux-generic/odp_pkt_queue.c > index 949cf74..f43ceeb 100644 > --- a/platform/linux-generic/odp_pkt_queue.c > +++ b/platform/linux-generic/odp_pkt_queue.c > @@ -346,19 +346,31 @@ int _odp_pkt_queue_remove(_odp_int_queue_pool_t > queue_pool, > void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t queue_pool) > { > queue_pool_t *pool; > + int max_len = 512; > + char str[max_len]; > + int len = 0; > + int n = max_len - 1; > > pool = (queue_pool_t *)(uintptr_t)queue_pool; > - ODP_DBG("pkt_queue_stats - queue_pool=0x%" PRIX64 "\n", > queue_pool); > - ODP_DBG(" max_queue_num=%u max_queued_pkts=%u > next_queue_num=%u\n", > - pool->max_queue_num, pool->max_queued_pkts, > - pool->next_queue_num); > - ODP_DBG(" total pkt appends=%" PRIu64 " total pkt removes=%" > PRIu64 > - " bad removes=%" PRIu64 "\n", > - pool->total_pkt_appends, pool->total_pkt_removes, > - pool->total_bad_removes); > - ODP_DBG(" free_list size=%u min size=%u peak size=%u\n", > - pool->free_list_size, pool->min_free_list_size, > - pool->peak_free_list_size); > + > + len += snprintf(&str[len], n - len, > + "pkt_queue_stats - queue_pool=0x%" PRIX64 "\n", > + queue_pool); > + len += snprintf(&str[len], n - len, > + " max_queue_num=%u max_queued_pkts=%u > next_queue_num=%u\n", > + pool->max_queue_num, pool->max_queued_pkts, > + pool->next_queue_num); > + len += snprintf(&str[len], n - len, > + " total pkt appends=%" PRIu64 " total pkt > removes=" > + "%" PRIu64 " bad removes=%" PRIu64 "\n", > + pool->total_pkt_appends, pool->total_pkt_removes, > + pool->total_bad_removes); > + len += snprintf(&str[len], n - len, > + " free_list size=%u min size=%u peak size=%u\n", > + pool->free_list_size, pool->min_free_list_size, > + pool->peak_free_list_size); > + str[len] = '\0'; > + ODP_PRINT("\n%s\n", str); > } > > void _odp_queue_pool_destroy(_odp_int_queue_pool_t queue_pool) > diff --git a/platform/linux-generic/odp_pool.c > b/platform/linux-generic/odp_pool.c > index 5ed7080..c1ffaaa 100644 > --- a/platform/linux-generic/odp_pool.c > +++ b/platform/linux-generic/odp_pool.c > @@ -735,6 +735,10 @@ void odp_pool_print(odp_pool_t pool_hdl) > { > pool_entry_t *pool; > uint32_t pool_id; > + int max_len = 1536; > + char str[max_len]; > + int len = 0; > + int n = max_len - 1; > > pool_id = pool_handle_to_index(pool_hdl); > pool = get_pool_entry(pool_id); > @@ -756,64 +760,105 @@ void odp_pool_print(odp_pool_t pool_hdl) > uint64_t blklowmct = > odp_atomic_load_u64(&pool->s.poolstats.blk_low_wm_count); > > - ODP_DBG("Pool info\n"); > - ODP_DBG("---------\n"); > - ODP_DBG(" pool %" PRIu64 "\n", > + len += snprintf(&str[len], n - len, "Pool info\n"); > + len += snprintf(&str[len], n - len, "---------\n"); > + len += snprintf(&str[len], n - len, " pool %" PRIu64 > "\n", > odp_pool_to_u64(pool->s.pool_hdl)); > - ODP_DBG(" name %s\n", > + len += snprintf(&str[len], n - len, " name %s\n", > pool->s.flags.has_name ? pool->s.name : "Unnamed Pool"); > - ODP_DBG(" pool type %s\n", > + len += snprintf(&str[len], n - len, " pool type %s\n", > pool->s.params.type == ODP_POOL_BUFFER ? "buffer" : > (pool->s.params.type == ODP_POOL_PACKET ? "packet" : > (pool->s.params.type == ODP_POOL_TIMEOUT ? "timeout" : > "unknown"))); > - ODP_DBG(" pool storage ODP managed shm handle %" PRIu64 "\n", > - odp_shm_to_u64(pool->s.pool_shm)); > - ODP_DBG(" pool status %s\n", > - pool->s.quiesced ? "quiesced" : "active"); > - ODP_DBG(" pool opts %s, %s, %s\n", > - pool->s.flags.unsegmented ? "unsegmented" : "segmented", > - pool->s.flags.zeroized ? "zeroized" : "non-zeroized", > - pool->s.flags.predefined ? "predefined" : "created"); > - ODP_DBG(" pool base %p\n", pool->s.pool_base_addr); > - ODP_DBG(" pool size %zu (%zu pages)\n", > + len += snprintf(&str[len], n - len, > + " pool storage ODP managed shm handle %" PRIu64 > "\n", > + odp_shm_to_u64(pool->s.pool_shm)); > + len += snprintf(&str[len], n - len, " pool status %s\n", > + pool->s.quiesced ? "quiesced" : "active"); > + len += snprintf(&str[len], n - len, " pool opts %s, %s, > %s\n", > + pool->s.flags.unsegmented ? "unsegmented" : > "segmented", > + pool->s.flags.zeroized ? "zeroized" : > "non-zeroized", > + pool->s.flags.predefined ? "predefined" : > "created"); > + len += snprintf(&str[len], n - len, " pool base %p\n", > + pool->s.pool_base_addr); > + len += snprintf(&str[len], n - len, > + " pool size %zu (%zu pages)\n", > pool->s.pool_size, pool->s.pool_size / ODP_PAGE_SIZE); > - ODP_DBG(" pool mdata base %p\n", pool->s.pool_mdata_addr); > - ODP_DBG(" udata size %zu\n", pool->s.udata_size); > - ODP_DBG(" headroom %u\n", pool->s.headroom); > - ODP_DBG(" tailroom %u\n", pool->s.tailroom); > + len += snprintf(&str[len], n - len, " pool mdata base %p\n", > + pool->s.pool_mdata_addr); > + len += snprintf(&str[len], n - len, " udata size %" PRIu32 > "\n", > + pool->s.udata_size); > + len += snprintf(&str[len], n - len, " headroom %" PRIu32 > "\n", > + pool->s.headroom); > + len += snprintf(&str[len], n - len, " tailroom %" PRIu32 > "\n", > + pool->s.tailroom); > if (pool->s.params.type == ODP_POOL_BUFFER) { > - ODP_DBG(" buf size %zu\n", pool->s.params.buf.size); > - ODP_DBG(" buf align %u requested, %u used\n", > - pool->s.params.buf.align, pool->s.buf_align); > + len += snprintf(&str[len], n - len, > + " buf size %" PRIu32 "\n", > + pool->s.params.buf.size); > + len += snprintf(&str[len], n - len, > + " buf align %" PRIu32 " requested, " > + "%" PRIu32 " used\n", > pool->s.params.buf.align, > + pool->s.buf_align); > } else if (pool->s.params.type == ODP_POOL_PACKET) { > - ODP_DBG(" seg length %u requested, %u used\n", > - pool->s.params.pkt.seg_len, pool->s.seg_size); > - ODP_DBG(" pkt length %u requested, %u used\n", > - pool->s.params.pkt.len, pool->s.blk_size); > + len += snprintf(&str[len], n - len, > + " seg length %" PRIu32 " requested, " > + "%" PRIu32 " used\n", > + pool->s.params.pkt.seg_len, > pool->s.seg_size); > + len += snprintf(&str[len], n - len, > + " pkt length %" PRIu32 " requested, " > + "%" PRIu32 " used\n", > pool->s.params.pkt.len, > + pool->s.blk_size); > } > - ODP_DBG(" num bufs %u\n", pool->s.buf_num); > - ODP_DBG(" bufs available %u %s\n", bufcount, > - pool->s.buf_low_wm_assert ? " **buf low wm asserted**" : > ""); > - ODP_DBG(" bufs in use %u\n", pool->s.buf_num - bufcount); > - ODP_DBG(" buf allocs %lu\n", bufallocs); > - ODP_DBG(" buf frees %lu\n", buffrees); > - ODP_DBG(" buf empty %lu\n", bufempty); > - ODP_DBG(" blk size %zu\n", > + len += snprintf(&str[len], n - len, > + " num bufs %" PRIu32 "\n", > pool->s.buf_num); > + len += snprintf(&str[len], n - len, " bufs available %" PRIu32 " > %s\n", > + bufcount, pool->s.buf_low_wm_assert ? > + " **buf low wm asserted**" : ""); > + len += snprintf(&str[len], n - len, > + " bufs in use %" PRIu32 "\n", > + pool->s.buf_num - bufcount); > + len += snprintf(&str[len], n - len, > + " buf allocs %" PRIu64 "\n", bufallocs); > + len += snprintf(&str[len], n - len, > + " buf frees %" PRIu64 "\n", buffrees); > + len += snprintf(&str[len], n - len, > + " buf empty %" PRIu64 "\n", bufempty); > + len += snprintf(&str[len], n - len, > + " blk size %" PRIu32 "\n", > pool->s.seg_size > ODP_MAX_INLINE_BUF ? pool->s.seg_size : > 0); > - ODP_DBG(" blks available %u %s\n", blkcount, > - pool->s.blk_low_wm_assert ? " **blk low wm asserted**" : > ""); > - ODP_DBG(" blk allocs %lu\n", blkallocs); > - ODP_DBG(" blk frees %lu\n", blkfrees); > - ODP_DBG(" blk empty %lu\n", blkempty); > - ODP_DBG(" buf high wm value %lu\n", pool->s.buf_high_wm); > - ODP_DBG(" buf high wm count %lu\n", bufhiwmct); > - ODP_DBG(" buf low wm value %lu\n", pool->s.buf_low_wm); > - ODP_DBG(" buf low wm count %lu\n", buflowmct); > - ODP_DBG(" blk high wm value %lu\n", pool->s.blk_high_wm); > - ODP_DBG(" blk high wm count %lu\n", blkhiwmct); > - ODP_DBG(" blk low wm value %lu\n", pool->s.blk_low_wm); > - ODP_DBG(" blk low wm count %lu\n", blklowmct); > + len += snprintf(&str[len], n - len, " blks available %" PRIu32 " > %s\n", > + blkcount, pool->s.blk_low_wm_assert ? > + " **blk low wm asserted**" : ""); > + len += snprintf(&str[len], n - len, > + " blk allocs %" PRIu64 "\n", blkallocs); > + len += snprintf(&str[len], n - len, > + " blk frees %" PRIu64 "\n", blkfrees); > + len += snprintf(&str[len], n - len, > + " blk empty %" PRIu64 "\n", blkempty); > + len += snprintf(&str[len], n - len, > + " buf high wm value %" PRIu32 "\n", > + pool->s.buf_high_wm); > + len += snprintf(&str[len], n - len, > + " buf high wm count %" PRIu64 "\n", bufhiwmct); > + len += snprintf(&str[len], n - len, > + " buf low wm value %" PRIu32 "\n", > + pool->s.buf_low_wm); > + len += snprintf(&str[len], n - len, > + " buf low wm count %" PRIu64 "\n", buflowmct); > + len += snprintf(&str[len], n - len, > + " blk high wm value %" PRIu32 "\n", > + pool->s.blk_high_wm); > + len += snprintf(&str[len], n - len, > + " blk high wm count %" PRIu64 "\n", blkhiwmct); > + len += snprintf(&str[len], n - len, > + " blk low wm value %" PRIu32 "\n", > + pool->s.blk_low_wm); > + len += snprintf(&str[len], n - len, > + " blk low wm count %" PRIu64 "\n", blklowmct); > + str[len] = '\0'; > + ODP_PRINT("\n%s\n", str); > } > > > diff --git a/platform/linux-generic/odp_sorted_list.c > b/platform/linux-generic/odp_sorted_list.c > index 554494b..0dc08a8 100644 > --- a/platform/linux-generic/odp_sorted_list.c > +++ b/platform/linux-generic/odp_sorted_list.c > @@ -256,14 +256,23 @@ int _odp_sorted_list_destroy(_odp_int_sorted_pool_t > sorted_pool, > void _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool) > { > sorted_pool_t *pool; > + int max_len = 512; > + char str[max_len]; > + int len = 0; > + int n = max_len - 1; > > pool = (sorted_pool_t *)(uintptr_t)sorted_pool; > - ODP_DBG("sorted_pool=0x%" PRIX64 "\n", sorted_pool); > - ODP_DBG(" max_sorted_lists=%u next_list_idx=%u\n", > - pool->max_sorted_lists, pool->next_list_idx); > - ODP_DBG(" total_inserts=%" PRIu64 " total_deletes=%" PRIu64 > - " total_removes=%" PRIu64 "\n", pool->total_inserts, > - pool->total_deletes, pool->total_removes); > + len += snprintf(&str[len], n - len, > + "sorted_pool=0x%" PRIX64 "\n", sorted_pool); > + len += snprintf(&str[len], n - len, > + " max_sorted_lists=%u next_list_idx=%u\n", > + pool->max_sorted_lists, pool->next_list_idx); > + len += snprintf(&str[len], n - len, > + " total_inserts=%" PRIu64 " total_deletes=%" > PRIu64 > + " total_removes=%" PRIu64 "\n", > pool->total_inserts, > + pool->total_deletes, pool->total_removes); > + str[len] = '\0'; > + ODP_PRINT("\n%s\n", str); > } > > void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t sorted_pool) > diff --git a/platform/linux-generic/odp_timer_wheel.c > b/platform/linux-generic/odp_timer_wheel.c > index 66600b7..70a19d0 100644 > --- a/platform/linux-generic/odp_timer_wheel.c > +++ b/platform/linux-generic/odp_timer_wheel.c > @@ -914,10 +914,10 @@ uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t > timer_wheel) > static void _odp_int_timer_wheel_desc_print(wheel_desc_t *wheel_desc, > uint32_t wheel_idx) > { > - ODP_DBG(" wheel=%u num_slots=%u ticks_shift=%u ticks_per_slot=%u" > - " ticks_per_rev=%" PRIu64 "\n", > - wheel_idx, wheel_desc->num_slots, wheel_desc->ticks_shift, > - wheel_desc->ticks_per_slot, wheel_desc->ticks_per_rev); > + ODP_PRINT(" wheel=%u num_slots=%u ticks_shift=%u > ticks_per_slot=%u" > + " ticks_per_rev=%" PRIu64 "\n", > + wheel_idx, wheel_desc->num_slots, > wheel_desc->ticks_shift, > + wheel_desc->ticks_per_slot, wheel_desc->ticks_per_rev); > } > > void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel) > @@ -929,28 +929,30 @@ void _odp_timer_wheel_stats_print(_odp_timer_wheel_t > timer_wheel) > timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; > expired_ring = timer_wheels->expired_timers_ring; > > - ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%" PRIu64 "\n", > - timer_wheels->current_ticks); > + ODP_PRINT("_odp_int_timer_wheel_stats current_ticks=%" PRIu64 "\n", > + timer_wheels->current_ticks); > for (wheel_idx = 0; wheel_idx < 4; wheel_idx++) > _odp_int_timer_wheel_desc_print( > &timer_wheels->wheel_descs[wheel_idx], > wheel_idx); > > - ODP_DBG(" total timer_inserts=%" PRIu64 " timer_removes=%" PRIu64 > - " insert_fails=%" PRIu64 "\n", > - timer_wheels->total_timer_inserts, > - timer_wheels->total_timer_removes, > - timer_wheels->insert_fail_cnt); > - ODP_DBG(" total_promote_cnt=%" PRIu64 " promote_fail_cnt=%" > - PRIu64 "\n", timer_wheels->total_promote_cnt, > - timer_wheels->promote_fail_cnt); > - ODP_DBG(" free_list_size=%u min_size=%u peak_size=%u\n", > - timer_wheels->free_list_size, > timer_wheels->min_free_list_size, > - timer_wheels->peak_free_list_size); > - ODP_DBG(" expired_timers_ring size=%u count=%u " > - "peak_count=%u full_cnt=%u\n", > - expired_ring->max_idx + 1, expired_ring->count, > - expired_ring->peak_count, > expired_ring->expired_ring_full_cnt); > + ODP_PRINT(" total timer_inserts=%" PRIu64 " timer_removes=%" > PRIu64 > + " insert_fails=%" PRIu64 "\n", > + timer_wheels->total_timer_inserts, > + timer_wheels->total_timer_removes, > + timer_wheels->insert_fail_cnt); > + ODP_PRINT(" total_promote_cnt=%" PRIu64 " promote_fail_cnt=%" > + PRIu64 "\n", timer_wheels->total_promote_cnt, > + timer_wheels->promote_fail_cnt); > + ODP_PRINT(" free_list_size=%u min_size=%u peak_size=%u\n", > + timer_wheels->free_list_size, > + timer_wheels->min_free_list_size, > + timer_wheels->peak_free_list_size); > + ODP_PRINT(" expired_timers_ring size=%u count=%u " > + "peak_count=%u full_cnt=%u\n", > + expired_ring->max_idx + 1, expired_ring->count, > + expired_ring->peak_count, > + expired_ring->expired_ring_full_cnt); > } > > void _odp_timer_wheel_destroy(_odp_timer_wheel_t timer_wheel) > diff --git a/platform/linux-generic/odp_traffic_mngr.c > b/platform/linux-generic/odp_traffic_mngr.c > index fb18ab3..b4f525b 100644 > --- a/platform/linux-generic/odp_traffic_mngr.c > +++ b/platform/linux-generic/odp_traffic_mngr.c > @@ -4373,19 +4373,19 @@ void odp_tm_stats_print(odp_tm_t odp_tm) > tm_system = GET_TM_SYSTEM(odp_tm); > input_work_queue = tm_system->input_work_queue; > > - ODP_DBG("odp_tm_stats_print - tm_system=0x%" PRIX64 " tm_idx=%u\n", > - odp_tm, tm_system->tm_idx); > - ODP_DBG(" input_work_queue size=%u current cnt=%u peak cnt=%u\n", > - INPUT_WORK_RING_SIZE, input_work_queue->queue_cnt, > - input_work_queue->peak_cnt); > - ODP_DBG(" input_work_queue enqueues=%" PRIu64 " dequeues=% " > PRIu64 > - " fail_cnt=%" PRIu64 "\n", > input_work_queue->total_enqueues, > - input_work_queue->total_dequeues, > - input_work_queue->enqueue_fail_cnt); > - ODP_DBG(" green_cnt=%" PRIu64 " yellow_cnt=%" PRIu64 " red_cnt=%" > - PRIu64 "\n", tm_system->shaper_green_cnt, > - tm_system->shaper_yellow_cnt, > - tm_system->shaper_red_cnt); > + ODP_PRINT("odp_tm_stats_print - tm_system=0x%" PRIX64 " > tm_idx=%u\n", > + odp_tm, tm_system->tm_idx); > + ODP_PRINT(" input_work_queue size=%u current cnt=%u peak > cnt=%u\n", > + INPUT_WORK_RING_SIZE, input_work_queue->queue_cnt, > + input_work_queue->peak_cnt); > + ODP_PRINT(" input_work_queue enqueues=%" PRIu64 " dequeues=% " > PRIu64 > + " fail_cnt=%" PRIu64 "\n", > input_work_queue->total_enqueues, > + input_work_queue->total_dequeues, > + input_work_queue->enqueue_fail_cnt); > + ODP_PRINT(" green_cnt=%" PRIu64 " yellow_cnt=%" PRIu64 " > red_cnt=%" > + PRIu64 "\n", tm_system->shaper_green_cnt, > + tm_system->shaper_yellow_cnt, > + tm_system->shaper_red_cnt); > > _odp_pkt_queue_stats_print(tm_system->_odp_int_queue_pool); > _odp_timer_wheel_stats_print(tm_system->_odp_int_timer_wheel); > @@ -4395,14 +4395,13 @@ void odp_tm_stats_print(odp_tm_t odp_tm) > for (queue_num = 1; queue_num < max_queue_num; queue_num++) { > tm_queue_obj = tm_system->queue_num_tbl[queue_num]; > if (tm_queue_obj->pkts_rcvd_cnt != 0) > - ODP_DBG("queue_num=%u priority=%u rcvd=%u > enqueued=%u " > - "dequeued=%u consumed=%u\n", > - queue_num, > - tm_queue_obj->priority, > - tm_queue_obj->pkts_rcvd_cnt, > - tm_queue_obj->pkts_enqueued_cnt, > - tm_queue_obj->pkts_dequeued_cnt, > - tm_queue_obj->pkts_consumed_cnt); > + ODP_PRINT("queue_num=%u priority=%u rcvd=%u " > + "enqueued=%u dequeued=%u consumed=%u\n", > + queue_num, tm_queue_obj->priority, > + tm_queue_obj->pkts_rcvd_cnt, > + tm_queue_obj->pkts_enqueued_cnt, > + tm_queue_obj->pkts_dequeued_cnt, > + tm_queue_obj->pkts_consumed_cnt); > } > } > > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index 02ae87a..4c44beb 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -81,7 +81,7 @@ extern "C" { * specifically for dumping internal data. */ #define ODP_PRINT(fmt, ...) \ - odp_global_data.log_fn(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) + odp_global_data.log_fn(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) #ifdef __cplusplus } diff --git a/platform/linux-generic/odp_name_table.c b/platform/linux-generic/odp_name_table.c index 801c456..ee6c809 100644 --- a/platform/linux-generic/odp_name_table.c +++ b/platform/linux-generic/odp_name_table.c @@ -220,20 +220,20 @@ static void secondary_hash_dump(secondary_hash_tbl_t *secondary_hash_tbl) entry_cnt = hash_tbl_entry & 0x3F; list_cnt = linked_list_len(name_tbl_entry); if (entry_cnt != list_cnt) - ODP_DBG("%s idx=%u entry_cnt=%u " - "list_cnt=%u\n", - __func__, - idx, entry_cnt, list_cnt); + ODP_PRINT("%s idx=%u entry_cnt=%u " + "list_cnt=%u\n", + __func__, + idx, entry_cnt, list_cnt); count += entry_cnt; } else { - ODP_DBG("%s inner secondary tbl\n", - __func__); + ODP_PRINT("%s inner secondary tbl\n", + __func__); } } } - ODP_DBG("%s count=%u\n", __func__, count); + ODP_PRINT("%s count=%u\n", __func__, count); } #endif @@ -1069,7 +1069,7 @@ static void secondary_hash_histo_print(void) if (name_hash_tbl.num_secondary_tbls[0] == 0) return; - ODP_DBG(" level1 secondary hash histogram:\n"); + ODP_PRINT(" level1 secondary hash histogram:\n"); total_count = 0; for (idx = 0; idx < 256; idx++) { count = level1_histo[idx]; @@ -1077,24 +1077,24 @@ static void secondary_hash_histo_print(void) total_count += count * idx; if (count != 0) - ODP_DBG(" num collisions=%02u count=%u\n", - idx, count); + ODP_PRINT(" num collisions=%02u count=%u\n", + idx, count); } count = level1_histo[256]; total_count += count; if (count != 0) - ODP_DBG(" num collisions >=256 count=%u\n", count); + ODP_PRINT(" num collisions >=256 count=%u\n", count); avg = (100 * total_count) / name_hash_tbl.num_secondary_tbls[0]; avg = avg / SECONDARY_HASH_TBL_SIZE; - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", - avg / 100, avg % 100, total_count); + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", + avg / 100, avg % 100, total_count); if (name_hash_tbl.num_secondary_tbls[1] == 0) return; - ODP_DBG(" level2 secondary hash histogram:\n"); + ODP_PRINT(" level2 secondary hash histogram:\n"); total_count = 0; for (idx = 0; idx < 256; idx++) { count = level2_histo[idx]; @@ -1102,19 +1102,19 @@ static void secondary_hash_histo_print(void) total_count += count * idx; if (count != 0) - ODP_DBG(" num collisions=%02u count=%u\n", - idx, count); + ODP_PRINT(" num collisions=%02u count=%u\n", + idx, count); } count = level2_histo[256]; total_count += count; if (count != 0) - ODP_DBG(" num collisions >=256 count=%u\n", count); + ODP_PRINT(" num collisions >=256 count=%u\n", count); avg = (100 * total_count) / name_hash_tbl.num_secondary_tbls[1]; avg = avg / SECONDARY_HASH_TBL_SIZE; - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", - avg / 100, avg % 100, total_count); + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", + avg / 100, avg % 100, total_count); } #endif @@ -1126,21 +1126,21 @@ void _odp_int_name_tbl_stats_print(void) count, total_count; uint32_t avg; - ODP_DBG("\nname table stats:\n"); - ODP_DBG(" num_names=%u num_adds=%lu " - "num_deletes=%lu num_name_tbls=%u\n", - name_tbls.current_num_names, name_tbls.num_adds, - name_tbls.num_deletes, name_tbls.num_name_tbls); + ODP_PRINT("\nname table stats:\n"); + ODP_PRINT(" num_names=%u num_adds=%lu " + "num_deletes=%lu num_name_tbls=%u\n", + name_tbls.current_num_names, name_tbls.num_adds, + name_tbls.num_deletes, name_tbls.num_name_tbls); for (idx = 0; idx < NUM_NAME_TBLS; idx++) { name_tbl = name_tbls.tbls[idx]; if ((name_tbl) && (name_tbl->num_used != 0)) - ODP_DBG(" name_tbl %u num_allocd=%7u " - "num_added_to_free_list=%7u " - "num_used=%7u num_avail_to_add=%7u\n", idx, - name_tbl->num_allocd, - name_tbl->num_added_to_free_list, - name_tbl->num_used, - name_tbl->num_avail_to_add); + ODP_PRINT(" name_tbl %u num_allocd=%7u " + "num_added_to_free_list=%7u " + "num_used=%7u num_avail_to_add=%7u\n", idx, + name_tbl->num_allocd, + name_tbl->num_added_to_free_list, + name_tbl->num_used, + name_tbl->num_avail_to_add); } memset(primary_hash_histo, 0, sizeof(primary_hash_histo)); @@ -1149,7 +1149,7 @@ void _odp_int_name_tbl_stats_print(void) primary_hash_histo[collisions]++; } - ODP_DBG(" name_tbl primary hash histogram:\n"); + ODP_PRINT(" name_tbl primary hash histogram:\n"); total_count = 0; for (idx = 0; idx < 256; idx++) { count = primary_hash_histo[idx]; @@ -1157,23 +1157,23 @@ void _odp_int_name_tbl_stats_print(void) total_count += count * idx; if (count != 0) - ODP_DBG(" num collisions=%02u count=%u\n", - idx, count); + ODP_PRINT(" num collisions=%02u count=%u\n", + idx, count); } count = primary_hash_histo[256]; total_count += count; if (count != 0) - ODP_DBG(" num collisions >=256 count=%u\n", count); + ODP_PRINT(" num collisions >=256 count=%u\n", count); avg = (100 * total_count) / PRIMARY_HASH_TBL_SIZE; - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", - avg / 100, avg % 100, total_count); + ODP_PRINT(" avg collisions=%02u.%02u total=%u\n\n", + avg / 100, avg % 100, total_count); - ODP_DBG(" num of first level secondary hash tbls=%u " - "second level tbls=%u\n", - name_hash_tbl.num_secondary_tbls[0], - name_hash_tbl.num_secondary_tbls[1]); + ODP_PRINT(" num of first level secondary hash tbls=%u " + "second level tbls=%u\n", + name_hash_tbl.num_secondary_tbls[0], + name_hash_tbl.num_secondary_tbls[1]); #ifdef SECONDARY_HASH_HISTO_PRINT if (name_hash_tbl.num_secondary_tbls[0] != 0) diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c index 949cf74..f43ceeb 100644 --- a/platform/linux-generic/odp_pkt_queue.c +++ b/platform/linux-generic/odp_pkt_queue.c @@ -346,19 +346,31 @@ int _odp_pkt_queue_remove(_odp_int_queue_pool_t queue_pool, void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t queue_pool) { queue_pool_t *pool; + int max_len = 512; + char str[max_len]; + int len = 0; + int n = max_len - 1; pool = (queue_pool_t *)(uintptr_t)queue_pool; - ODP_DBG("pkt_queue_stats - queue_pool=0x%" PRIX64 "\n", queue_pool); - ODP_DBG(" max_queue_num=%u max_queued_pkts=%u next_queue_num=%u\n", - pool->max_queue_num, pool->max_queued_pkts, - pool->next_queue_num); - ODP_DBG(" total pkt appends=%" PRIu64 " total pkt removes=%" PRIu64 - " bad removes=%" PRIu64 "\n", - pool->total_pkt_appends, pool->total_pkt_removes, - pool->total_bad_removes); - ODP_DBG(" free_list size=%u min size=%u peak size=%u\n", - pool->free_list_size, pool->min_free_list_size, - pool->peak_free_list_size); + + len += snprintf(&str[len], n - len, + "pkt_queue_stats - queue_pool=0x%" PRIX64 "\n", + queue_pool); + len += snprintf(&str[len], n - len, + " max_queue_num=%u max_queued_pkts=%u next_queue_num=%u\n", + pool->max_queue_num, pool->max_queued_pkts, + pool->next_queue_num); + len += snprintf(&str[len], n - len, + " total pkt appends=%" PRIu64 " total pkt removes=" + "%" PRIu64 " bad removes=%" PRIu64 "\n", + pool->total_pkt_appends, pool->total_pkt_removes, + pool->total_bad_removes); + len += snprintf(&str[len], n - len, + " free_list size=%u min size=%u peak size=%u\n", + pool->free_list_size, pool->min_free_list_size, + pool->peak_free_list_size); + str[len] = '\0'; + ODP_PRINT("\n%s\n", str); } void _odp_queue_pool_destroy(_odp_int_queue_pool_t queue_pool) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 5ed7080..c1ffaaa 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -735,6 +735,10 @@ void odp_pool_print(odp_pool_t pool_hdl) { pool_entry_t *pool; uint32_t pool_id; + int max_len = 1536; + char str[max_len]; + int len = 0; + int n = max_len - 1; pool_id = pool_handle_to_index(pool_hdl); pool = get_pool_entry(pool_id); @@ -756,64 +760,105 @@ void odp_pool_print(odp_pool_t pool_hdl) uint64_t blklowmct = odp_atomic_load_u64(&pool->s.poolstats.blk_low_wm_count); - ODP_DBG("Pool info\n"); - ODP_DBG("---------\n"); - ODP_DBG(" pool %" PRIu64 "\n", + len += snprintf(&str[len], n - len, "Pool info\n"); + len += snprintf(&str[len], n - len, "---------\n"); + len += snprintf(&str[len], n - len, " pool %" PRIu64 "\n", odp_pool_to_u64(pool->s.pool_hdl)); - ODP_DBG(" name %s\n", + len += snprintf(&str[len], n - len, " name %s\n", pool->s.flags.has_name ? pool->s.name : "Unnamed Pool"); - ODP_DBG(" pool type %s\n", + len += snprintf(&str[len], n - len, " pool type %s\n", pool->s.params.type == ODP_POOL_BUFFER ? "buffer" : (pool->s.params.type == ODP_POOL_PACKET ? "packet" : (pool->s.params.type == ODP_POOL_TIMEOUT ? "timeout" : "unknown"))); - ODP_DBG(" pool storage ODP managed shm handle %" PRIu64 "\n", - odp_shm_to_u64(pool->s.pool_shm)); - ODP_DBG(" pool status %s\n", - pool->s.quiesced ? "quiesced" : "active"); - ODP_DBG(" pool opts %s, %s, %s\n", - pool->s.flags.unsegmented ? "unsegmented" : "segmented", - pool->s.flags.zeroized ? "zeroized" : "non-zeroized", - pool->s.flags.predefined ? "predefined" : "created"); - ODP_DBG(" pool base %p\n", pool->s.pool_base_addr); - ODP_DBG(" pool size %zu (%zu pages)\n", + len += snprintf(&str[len], n - len, + " pool storage ODP managed shm handle %" PRIu64 "\n", + odp_shm_to_u64(pool->s.pool_shm)); + len += snprintf(&str[len], n - len, " pool status %s\n", + pool->s.quiesced ? "quiesced" : "active"); + len += snprintf(&str[len], n - len, " pool opts %s, %s, %s\n", + pool->s.flags.unsegmented ? "unsegmented" : "segmented", + pool->s.flags.zeroized ? "zeroized" : "non-zeroized", + pool->s.flags.predefined ? "predefined" : "created"); + len += snprintf(&str[len], n - len, " pool base %p\n", + pool->s.pool_base_addr); + len += snprintf(&str[len], n - len, + " pool size %zu (%zu pages)\n", pool->s.pool_size, pool->s.pool_size / ODP_PAGE_SIZE); - ODP_DBG(" pool mdata base %p\n", pool->s.pool_mdata_addr); - ODP_DBG(" udata size %zu\n", pool->s.udata_size); - ODP_DBG(" headroom %u\n", pool->s.headroom); - ODP_DBG(" tailroom %u\n", pool->s.tailroom); + len += snprintf(&str[len], n - len, " pool mdata base %p\n", + pool->s.pool_mdata_addr); + len += snprintf(&str[len], n - len, " udata size %" PRIu32 "\n", + pool->s.udata_size); + len += snprintf(&str[len], n - len, " headroom %" PRIu32 "\n", + pool->s.headroom); + len += snprintf(&str[len], n - len, " tailroom %" PRIu32 "\n", + pool->s.tailroom); if (pool->s.params.type == ODP_POOL_BUFFER) { - ODP_DBG(" buf size %zu\n", pool->s.params.buf.size); - ODP_DBG(" buf align %u requested, %u used\n", - pool->s.params.buf.align, pool->s.buf_align); + len += snprintf(&str[len], n - len, + " buf size %" PRIu32 "\n", + pool->s.params.buf.size); + len += snprintf(&str[len], n - len, + " buf align %" PRIu32 " requested, " + "%" PRIu32 " used\n", pool->s.params.buf.align, + pool->s.buf_align); } else if (pool->s.params.type == ODP_POOL_PACKET) { - ODP_DBG(" seg length %u requested, %u used\n", - pool->s.params.pkt.seg_len, pool->s.seg_size); - ODP_DBG(" pkt length %u requested, %u used\n", - pool->s.params.pkt.len, pool->s.blk_size); + len += snprintf(&str[len], n - len, + " seg length %" PRIu32 " requested, " + "%" PRIu32 " used\n", + pool->s.params.pkt.seg_len, pool->s.seg_size); + len += snprintf(&str[len], n - len, + " pkt length %" PRIu32 " requested, " + "%" PRIu32 " used\n", pool->s.params.pkt.len, + pool->s.blk_size); } - ODP_DBG(" num bufs %u\n", pool->s.buf_num); - ODP_DBG(" bufs available %u %s\n", bufcount, - pool->s.buf_low_wm_assert ? " **buf low wm asserted**" : ""); - ODP_DBG(" bufs in use %u\n", pool->s.buf_num - bufcount); - ODP_DBG(" buf allocs %lu\n", bufallocs); - ODP_DBG(" buf frees %lu\n", buffrees); - ODP_DBG(" buf empty %lu\n", bufempty); - ODP_DBG(" blk size %zu\n", + len += snprintf(&str[len], n - len, + " num bufs %" PRIu32 "\n", pool->s.buf_num); + len += snprintf(&str[len], n - len, " bufs available %" PRIu32 " %s\n", + bufcount, pool->s.buf_low_wm_assert ? + " **buf low wm asserted**" : ""); + len += snprintf(&str[len], n - len, + " bufs in use %" PRIu32 "\n", + pool->s.buf_num - bufcount); + len += snprintf(&str[len], n - len, + " buf allocs %" PRIu64 "\n", bufallocs); + len += snprintf(&str[len], n - len, + " buf frees %" PRIu64 "\n", buffrees); + len += snprintf(&str[len], n - len, + " buf empty %" PRIu64 "\n", bufempty); + len += snprintf(&str[len], n - len, + " blk size %" PRIu32 "\n", pool->s.seg_size > ODP_MAX_INLINE_BUF ? pool->s.seg_size : 0); - ODP_DBG(" blks available %u %s\n", blkcount, - pool->s.blk_low_wm_assert ? " **blk low wm asserted**" : ""); - ODP_DBG(" blk allocs %lu\n", blkallocs); - ODP_DBG(" blk frees %lu\n", blkfrees); - ODP_DBG(" blk empty %lu\n", blkempty); - ODP_DBG(" buf high wm value %lu\n", pool->s.buf_high_wm); - ODP_DBG(" buf high wm count %lu\n", bufhiwmct); - ODP_DBG(" buf low wm value %lu\n", pool->s.buf_low_wm); - ODP_DBG(" buf low wm count %lu\n", buflowmct); - ODP_DBG(" blk high wm value %lu\n", pool->s.blk_high_wm); - ODP_DBG(" blk high wm count %lu\n", blkhiwmct); - ODP_DBG(" blk low wm value %lu\n", pool->s.blk_low_wm); - ODP_DBG(" blk low wm count %lu\n", blklowmct); + len += snprintf(&str[len], n - len, " blks available %" PRIu32 " %s\n", + blkcount, pool->s.blk_low_wm_assert ? + " **blk low wm asserted**" : ""); + len += snprintf(&str[len], n - len, + " blk allocs %" PRIu64 "\n", blkallocs); + len += snprintf(&str[len], n - len, + " blk frees %" PRIu64 "\n", blkfrees); + len += snprintf(&str[len], n - len, + " blk empty %" PRIu64 "\n", blkempty); + len += snprintf(&str[len], n - len, + " buf high wm value %" PRIu32 "\n", + pool->s.buf_high_wm); + len += snprintf(&str[len], n - len, + " buf high wm count %" PRIu64 "\n", bufhiwmct); + len += snprintf(&str[len], n - len, + " buf low wm value %" PRIu32 "\n", + pool->s.buf_low_wm); + len += snprintf(&str[len], n - len, + " buf low wm count %" PRIu64 "\n", buflowmct); + len += snprintf(&str[len], n - len, + " blk high wm value %" PRIu32 "\n", + pool->s.blk_high_wm); + len += snprintf(&str[len], n - len, + " blk high wm count %" PRIu64 "\n", blkhiwmct); + len += snprintf(&str[len], n - len, + " blk low wm value %" PRIu32 "\n", + pool->s.blk_low_wm); + len += snprintf(&str[len], n - len, + " blk low wm count %" PRIu64 "\n", blklowmct); + str[len] = '\0'; + ODP_PRINT("\n%s\n", str); } diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c index 554494b..0dc08a8 100644 --- a/platform/linux-generic/odp_sorted_list.c +++ b/platform/linux-generic/odp_sorted_list.c @@ -256,14 +256,23 @@ int _odp_sorted_list_destroy(_odp_int_sorted_pool_t sorted_pool, void _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool) { sorted_pool_t *pool; + int max_len = 512; + char str[max_len]; + int len = 0; + int n = max_len - 1; pool = (sorted_pool_t *)(uintptr_t)sorted_pool; - ODP_DBG("sorted_pool=0x%" PRIX64 "\n", sorted_pool); - ODP_DBG(" max_sorted_lists=%u next_list_idx=%u\n", - pool->max_sorted_lists, pool->next_list_idx); - ODP_DBG(" total_inserts=%" PRIu64 " total_deletes=%" PRIu64 - " total_removes=%" PRIu64 "\n", pool->total_inserts, - pool->total_deletes, pool->total_removes); + len += snprintf(&str[len], n - len, + "sorted_pool=0x%" PRIX64 "\n", sorted_pool); + len += snprintf(&str[len], n - len, + " max_sorted_lists=%u next_list_idx=%u\n", + pool->max_sorted_lists, pool->next_list_idx); + len += snprintf(&str[len], n - len, + " total_inserts=%" PRIu64 " total_deletes=%" PRIu64 + " total_removes=%" PRIu64 "\n", pool->total_inserts, + pool->total_deletes, pool->total_removes); + str[len] = '\0'; + ODP_PRINT("\n%s\n", str); } void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t sorted_pool) diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c index 66600b7..70a19d0 100644 --- a/platform/linux-generic/odp_timer_wheel.c +++ b/platform/linux-generic/odp_timer_wheel.c @@ -914,10 +914,10 @@ uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t timer_wheel) static void _odp_int_timer_wheel_desc_print(wheel_desc_t *wheel_desc, uint32_t wheel_idx) { - ODP_DBG(" wheel=%u num_slots=%u ticks_shift=%u ticks_per_slot=%u" - " ticks_per_rev=%" PRIu64 "\n", - wheel_idx, wheel_desc->num_slots, wheel_desc->ticks_shift, - wheel_desc->ticks_per_slot, wheel_desc->ticks_per_rev); + ODP_PRINT(" wheel=%u num_slots=%u ticks_shift=%u ticks_per_slot=%u" + " ticks_per_rev=%" PRIu64 "\n", + wheel_idx, wheel_desc->num_slots, wheel_desc->ticks_shift, + wheel_desc->ticks_per_slot, wheel_desc->ticks_per_rev); } void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel) @@ -929,28 +929,30 @@ void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel) timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; expired_ring = timer_wheels->expired_timers_ring; - ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%" PRIu64 "\n", - timer_wheels->current_ticks); + ODP_PRINT("_odp_int_timer_wheel_stats current_ticks=%" PRIu64 "\n", + timer_wheels->current_ticks); for (wheel_idx = 0; wheel_idx < 4; wheel_idx++) _odp_int_timer_wheel_desc_print( &timer_wheels->wheel_descs[wheel_idx], wheel_idx); - ODP_DBG(" total timer_inserts=%" PRIu64 " timer_removes=%" PRIu64 - " insert_fails=%" PRIu64 "\n", - timer_wheels->total_timer_inserts, - timer_wheels->total_timer_removes, - timer_wheels->insert_fail_cnt); - ODP_DBG(" total_promote_cnt=%" PRIu64 " promote_fail_cnt=%" - PRIu64 "\n", timer_wheels->total_promote_cnt, - timer_wheels->promote_fail_cnt); - ODP_DBG(" free_list_size=%u min_size=%u peak_size=%u\n", - timer_wheels->free_list_size, timer_wheels->min_free_list_size, - timer_wheels->peak_free_list_size); - ODP_DBG(" expired_timers_ring size=%u count=%u " - "peak_count=%u full_cnt=%u\n", - expired_ring->max_idx + 1, expired_ring->count, - expired_ring->peak_count, expired_ring->expired_ring_full_cnt); + ODP_PRINT(" total timer_inserts=%" PRIu64 " timer_removes=%" PRIu64 + " insert_fails=%" PRIu64 "\n", + timer_wheels->total_timer_inserts, + timer_wheels->total_timer_removes, + timer_wheels->insert_fail_cnt); + ODP_PRINT(" total_promote_cnt=%" PRIu64 " promote_fail_cnt=%" + PRIu64 "\n", timer_wheels->total_promote_cnt, + timer_wheels->promote_fail_cnt); + ODP_PRINT(" free_list_size=%u min_size=%u peak_size=%u\n", + timer_wheels->free_list_size, + timer_wheels->min_free_list_size, + timer_wheels->peak_free_list_size); + ODP_PRINT(" expired_timers_ring size=%u count=%u " + "peak_count=%u full_cnt=%u\n", + expired_ring->max_idx + 1, expired_ring->count, + expired_ring->peak_count, + expired_ring->expired_ring_full_cnt); } void _odp_timer_wheel_destroy(_odp_timer_wheel_t timer_wheel) diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index fb18ab3..b4f525b 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -4373,19 +4373,19 @@ void odp_tm_stats_print(odp_tm_t odp_tm) tm_system = GET_TM_SYSTEM(odp_tm); input_work_queue = tm_system->input_work_queue; - ODP_DBG("odp_tm_stats_print - tm_system=0x%" PRIX64 " tm_idx=%u\n", - odp_tm, tm_system->tm_idx); - ODP_DBG(" input_work_queue size=%u current cnt=%u peak cnt=%u\n", - INPUT_WORK_RING_SIZE, input_work_queue->queue_cnt, - input_work_queue->peak_cnt); - ODP_DBG(" input_work_queue enqueues=%" PRIu64 " dequeues=% " PRIu64 - " fail_cnt=%" PRIu64 "\n", input_work_queue->total_enqueues, - input_work_queue->total_dequeues, - input_work_queue->enqueue_fail_cnt); - ODP_DBG(" green_cnt=%" PRIu64 " yellow_cnt=%" PRIu64 " red_cnt=%" - PRIu64 "\n", tm_system->shaper_green_cnt, - tm_system->shaper_yellow_cnt, - tm_system->shaper_red_cnt); + ODP_PRINT("odp_tm_stats_print - tm_system=0x%" PRIX64 " tm_idx=%u\n", + odp_tm, tm_system->tm_idx); + ODP_PRINT(" input_work_queue size=%u current cnt=%u peak cnt=%u\n", + INPUT_WORK_RING_SIZE, input_work_queue->queue_cnt, + input_work_queue->peak_cnt); + ODP_PRINT(" input_work_queue enqueues=%" PRIu64 " dequeues=% " PRIu64 + " fail_cnt=%" PRIu64 "\n", input_work_queue->total_enqueues, + input_work_queue->total_dequeues, + input_work_queue->enqueue_fail_cnt); + ODP_PRINT(" green_cnt=%" PRIu64 " yellow_cnt=%" PRIu64 " red_cnt=%" + PRIu64 "\n", tm_system->shaper_green_cnt, + tm_system->shaper_yellow_cnt, + tm_system->shaper_red_cnt); _odp_pkt_queue_stats_print(tm_system->_odp_int_queue_pool); _odp_timer_wheel_stats_print(tm_system->_odp_int_timer_wheel); @@ -4395,14 +4395,13 @@ void odp_tm_stats_print(odp_tm_t odp_tm) for (queue_num = 1; queue_num < max_queue_num; queue_num++) { tm_queue_obj = tm_system->queue_num_tbl[queue_num]; if (tm_queue_obj->pkts_rcvd_cnt != 0) - ODP_DBG("queue_num=%u priority=%u rcvd=%u enqueued=%u " - "dequeued=%u consumed=%u\n", - queue_num, - tm_queue_obj->priority, - tm_queue_obj->pkts_rcvd_cnt, - tm_queue_obj->pkts_enqueued_cnt, - tm_queue_obj->pkts_dequeued_cnt, - tm_queue_obj->pkts_consumed_cnt); + ODP_PRINT("queue_num=%u priority=%u rcvd=%u " + "enqueued=%u dequeued=%u consumed=%u\n", + queue_num, tm_queue_obj->priority, + tm_queue_obj->pkts_rcvd_cnt, + tm_queue_obj->pkts_enqueued_cnt, + tm_queue_obj->pkts_dequeued_cnt, + tm_queue_obj->pkts_consumed_cnt); } }
ODP_DBG() macro should not be used inside *_print() functions. Since debug messages are disabled by default, the print functions won't output anything with ODP_DBG. The patch also removes the extra space previously added to the beginning of ODP_PRINT messages. Signed-off-by: Matias Elo <matias.elo@nokia.com> --- .../linux-generic/include/odp_debug_internal.h | 2 +- platform/linux-generic/odp_name_table.c | 82 ++++++------ platform/linux-generic/odp_pkt_queue.c | 34 +++-- platform/linux-generic/odp_pool.c | 139 ++++++++++++++------- platform/linux-generic/odp_sorted_list.c | 21 +++- platform/linux-generic/odp_timer_wheel.c | 44 +++---- platform/linux-generic/odp_traffic_mngr.c | 41 +++--- 7 files changed, 215 insertions(+), 148 deletions(-)