From patchwork Wed Aug 29 21:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 145474 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp44386ljw; Wed, 29 Aug 2018 14:00:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY35PY/l8zOcJkMggSfGhqpeGWLpBUObt/Flw72JFCPCaRAyMwjNAFnFly7qYSztF9W0WkU X-Received: by 2002:ac8:234f:: with SMTP id b15-v6mr8804257qtb.336.1535576447376; Wed, 29 Aug 2018 14:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535576447; cv=none; d=google.com; s=arc-20160816; b=i37btp63xemnudnQvBp5KejQADCBkmAQHLmzeq62sU54d6bu5Pv2QlPytjyBupoRqz w+zKkSffMughS6ntSGy+GUVwKRygLunhMIxkn47RbOD/8ip2zvYk5ga6ouUwLmOUm+d+ D6wsxctSID2HK/r2a5Q1I4EWAqf3Hfx9RC1KDQInqBJd5Kvazwu0cJTvUldzNfqWEzJK +1tIl1wdZ7L0eq1FQAh1zLBFTke842fgNpu97rUnYtkvZ37+e/yvpm6GxJjMPOelckU9 tK5XQCG0qhQoNU3sAzzPVuHfJcuFOUn6lqwDPfkBwDBKsJSaxFSY2w+WuQErN2REGJn4 X2og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=+HGSqfS5g8yTyrmyKvOtg1tFOL1EkTTAaZj2lMZwNtc=; b=Ed5zNpXl8Qg1+LgtgueYIfBIjnmDR2IuhjpAI+UEQScOtWkAHdWIZtOatIsy9T4gxb BtAgIRdv04TCYwqeKK+eu6vFZkjRJ9hn80SohO+mL5oDWXuw890LUPaEpMDfka7tOZnr S78TGs1sa8eBUDwUve/Ne5/qHIhDlNqSQOpcG+1qftt8HACmML101NDWLlyvXXMLzruZ S/5lFDFzOhU2rvletl48E6rq5I8GOy9whn0dH2v2gz11L4lcLFWGNR/o6qcHCKyfIxtU nk+v2gMkaHzHhr6XsdhUV0SEK24jlvjKEfIdkb1q65MJfe7ccN96snyOxYZA11K5DR/K hcOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id e9-v6si2154557qvh.199.2018.08.29.14.00.46; Wed, 29 Aug 2018 14:00:47 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id BB94960D3D; Wed, 29 Aug 2018 21:00:46 +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=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW 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 2B457609A4; Wed, 29 Aug 2018 21:00:26 +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 6CF2D60F0D; Wed, 29 Aug 2018 21:00:20 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 6A3F360B53 for ; Wed, 29 Aug 2018 21:00:18 +0000 (UTC) Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward101j.mail.yandex.net (Yandex) with ESMTP id EF8C31244304 for ; Thu, 30 Aug 2018 00:00:16 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback9g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id u4ChokP3Kw-0GxSBmBj; Thu, 30 Aug 2018 00:00:16 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id WAQf5TNbUy-0GpO2OX5; Thu, 30 Aug 2018 00:00:16 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 29 Aug 2018 21:00:07 +0000 Message-Id: <1535576407-32067-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535576407-32067-1-git-send-email-odpbot@yandex.ru> References: <1535576407-32067-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 686 Subject: [lng-odp] [PATCH v1 2/2] linux-gen: shm: odp_shm_print_all add total counters 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Maxim Uvarov Add total allocated and total lost counters. That also requires a little bit cleanup format string so output spreadshet looks more nicely. Signed-off-by: Maxim Uvarov --- /** Email created from pull request 686 (muvarov:devel/master_shm_print_all) ** https://github.com/Linaro/odp/pull/686 ** Patch: https://github.com/Linaro/odp/pull/686.patch ** Base sha: 97fc51b1e5b3fcea9db99ba63c10bda47f79341a ** Merge commit sha: f69e295240994a3f642957c1a78d208242d066dd **/ platform/linux-generic/odp_ishm.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c index 131dd7057..effac7d6d 100644 --- a/platform/linux-generic/odp_ishm.c +++ b/platform/linux-generic/odp_ishm.c @@ -1730,6 +1730,8 @@ int _odp_ishm_status(const char *title) int nb_blocks = 0; int single_va_blocks = 0; int max_name_len = 0; + uint64_t lost_total = 0; /* statistics for total unused memory */ + uint64_t len_total = 0; /* statistics for total allocated memory */ odp_spinlock_lock(&ishm_tbl->lock); procsync(); @@ -1747,10 +1749,10 @@ int _odp_ishm_status(const char *title) max_name_len = str_len; } - ODP_PRINT("ishm blocks allocated at: %s\n", title); - - ODP_PRINT(" %-*s flag len user_len seq ref start fd" - " file\n", max_name_len, "name"); + ODP_PRINT("%s\n", title); + ODP_PRINT(" %-*s flag %-08s %-08s %-08s %-3s %-3s %-08s %-3s file\n", + max_name_len, "name", "len", "user_len", "lost", + "seq", "ref", "start", "fd"); /* display block table: 1 line per entry +1 extra line if mapped here */ for (i = 0; i < ISHM_MAX_NB_BLOCKS; i++) { @@ -1780,23 +1782,30 @@ int _odp_ishm_status(const char *title) huge = '?'; } proc_index = procfind_block(i); - ODP_PRINT("%2i %-*s %s%c 0x%-08lx 0x%-08lx %-3lu %-3lu", + lost_total += ishm_tbl->block[i].len - + ishm_tbl->block[i].user_len; + len_total += ishm_tbl->block[i].len; + ODP_PRINT("%2i %-*s %s%c 0x%-08lx 0x%-08lx 0x%-08lx %-3lu %-3lu", i, max_name_len, ishm_tbl->block[i].name, flags, huge, ishm_tbl->block[i].len, ishm_tbl->block[i].user_len, + ishm_tbl->block[i].len - ishm_tbl->block[i].user_len, ishm_tbl->block[i].seq, ishm_tbl->block[i].refcnt); if (proc_index < 0) continue; - ODP_PRINT("%-08lx %-3d", + ODP_PRINT(" 0x%-08lx %-3d", ishm_proctable->entry[proc_index].start, ishm_proctable->entry[proc_index].fd); - ODP_PRINT("%s\n", ishm_tbl->block[i].filename); + ODP_PRINT("%s\n", ishm_tbl->block[i].filename[0] ? + ishm_tbl->block[i].filename : "(none)"); } + ODP_PRINT("TOTAL: %41s%-08lx 0x%-08lx\n", + "0x", len_total, lost_total); /* display the virtual space allocations... : */ ODP_PRINT("\nishm virtual space:\n");