From patchwork Thu Jun 2 09:28:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 69136 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp18397qgf; Thu, 2 Jun 2016 02:28:56 -0700 (PDT) X-Received: by 10.140.255.85 with SMTP id a82mr15184881qhd.52.1464859736358; Thu, 02 Jun 2016 02:28:56 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id s53si37565228qtb.79.2016.06.02.02.28.55; Thu, 02 Jun 2016 02:28:56 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id B43E961762; Thu, 2 Jun 2016 09:28:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id A089E616BE; Thu, 2 Jun 2016 09:28:44 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C50C56170A; Thu, 2 Jun 2016 09:28:41 +0000 (UTC) Received: from demumfd001.nsn-inter.net (demumfd001.nsn-inter.net [93.183.12.32]) by lists.linaro.org (Postfix) with ESMTPS id D902B610A9 for ; Thu, 2 Jun 2016 09:28:39 +0000 (UTC) Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd001.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id u529ScRY011755 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Jun 2016 09:28:38 GMT Received: from 10.144.19.15 ([10.144.104.109]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id u529Sbu3018167 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 2 Jun 2016 11:28:38 +0200 From: Matias Elo To: lng-odp@lists.linaro.org Date: Thu, 2 Jun 2016 12:28:37 +0300 Message-Id: <1464859717-17866-1-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 1.9.1 X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 24191 X-purgate-ID: 151667::1464859718-00004C87-5D6CBA1B/0/0 X-Topics: patch Subject: [lng-odp] [PATCH] linux-gen: fix debug info print functions X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" 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 --- .../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); } }