From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D21C942642;
	Tue, 26 Sep 2023 12:59:07 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 6A5C840E13;
	Tue, 26 Sep 2023 12:58:18 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173])
 by mails.dpdk.org (Postfix) with ESMTP id F10C040E78
 for <dev@dpdk.org>; Tue, 26 Sep 2023 12:58:11 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 38QATmf2010403 for <dev@dpdk.org>; Tue, 26 Sep 2023 03:58:11 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=QDGmc50n2AJ87muUB+3Ci3Pu3xt+PMwkJZl287PJsTo=;
 b=gH6+YvxMbdPLE6gTScB+EBfO3d+S8ESp3+3NGaiorqXGWMMZ+TPy7dTGCQIAVa5duhSM
 n/IxjBfqlsss6g1HiSGQpgZATrnBSeYVpcbQ+KYqSS8Q/qJT6LaDOhq5uL3SbDe1vWVc
 QWtOkIXHiX43imZ7qj2Wa1RjFpIxYaNTOBv9Cbf2t2ZotV0JDiYl/oATsSnGVSl8yh91
 Is7k4I4Le/zDgM6ZN+zAAry4WNBUTqOZrs3VvXCIVshDEcIeSmAOH4j+9r9FLASZKJeL
 dddjpt1HrZVRleDHhCEzKCkTxf9ngFrz4q+x0WlzDwz6pYYqc9bR7E7ja2h+YVigm7Uk JQ== 
Received: from dc5-exch01.marvell.com ([199.233.59.181])
 by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3t9yhm0kgw-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)
 for <dev@dpdk.org>; Tue, 26 Sep 2023 03:58:11 -0700
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48;
 Tue, 26 Sep 2023 03:58:08 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend
 Transport; Tue, 26 Sep 2023 03:58:09 -0700
Received: from localhost.localdomain (unknown [10.28.34.25])
 by maili.marvell.com (Postfix) with ESMTP id D46193F70AB;
 Tue, 26 Sep 2023 03:58:07 -0700 (PDT)
From: <skori@marvell.com>
To: Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla
 <rkudurumalla@marvell.com>
CC: <dev@dpdk.org>
Subject: [PATCH v6 11/12] app/graph: add CLI option to enable graph stats
Date: Tue, 26 Sep 2023 16:27:41 +0530
Message-ID: <20230926105742.2638594-12-skori@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20230926105742.2638594-1-skori@marvell.com>
References: <20230921100832.2036256-13-skori@marvell.com>
 <20230926105742.2638594-1-skori@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-GUID: fqg2e8lR_Wslu3L0j3TKR43YqexfaCBT
X-Proofpoint-ORIG-GUID: fqg2e8lR_Wslu3L0j3TKR43YqexfaCBT
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26
 definitions=2023-09-26_07,2023-09-25_01,2023-05-22_02
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Sunil Kumar Kori <skori@marvell.com>

It adds application's command line parameter "--enable-graph-stats"
to enable dumping graph stats on console.

By default, no graph stats will be printed on console but same can
be dumped via telnet session using "graph stats show" command.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---
 app/graph/main.c           | 17 ++++++++++++++++-
 app/graph/module_api.h     |  2 ++
 doc/guides/tools/graph.rst |  4 ++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/app/graph/main.c b/app/graph/main.c
index c1cb435588..465376425c 100644
--- a/app/graph/main.c
+++ b/app/graph/main.c
@@ -21,12 +21,13 @@
 volatile bool force_quit;
 struct conn *conn;
 
-static const char usage[] = "%s EAL_ARGS -- -s SCRIPT [-h HOST] [-p PORT] "
+static const char usage[] = "%s EAL_ARGS -- -s SCRIPT [-h HOST] [-p PORT] [--enable-graph-stats] "
 			    "[--help]\n";
 
 static struct app_params {
 	struct conn_params conn;
 	char *script_name;
+	bool enable_graph_stats;
 } app = {
 	.conn = {
 		.welcome = "\nWelcome!\n\n",
@@ -40,6 +41,7 @@ static struct app_params {
 		.msg_handle_arg = NULL, /* set later. */
 	},
 	.script_name = NULL,
+	.enable_graph_stats = false,
 };
 
 static void
@@ -56,6 +58,7 @@ app_args_parse(int argc, char **argv)
 {
 	struct option lgopts[] = {
 		{"help", 0, 0, 'H'},
+		{"enable-graph-stats", 0, 0, 'g'},
 	};
 	int h_present, p_present, s_present, n_args, i;
 	char *app_name = argv[0];
@@ -133,6 +136,12 @@ app_args_parse(int argc, char **argv)
 			}
 			break;
 
+		case 'g':
+			app.enable_graph_stats = true;
+			printf("WARNING! Telnet session can not be accessed with"
+			       "--enable-graph-stats");
+			break;
+
 		case 'H':
 		default:
 			printf(usage, app_name);
@@ -144,6 +153,12 @@ app_args_parse(int argc, char **argv)
 	return 0;
 }
 
+bool
+app_graph_stats_enabled(void)
+{
+	return app.enable_graph_stats;
+}
+
 bool
 app_graph_exit(void)
 {
diff --git a/app/graph/module_api.h b/app/graph/module_api.h
index 392dcfb222..a7d287f5c8 100644
--- a/app/graph/module_api.h
+++ b/app/graph/module_api.h
@@ -24,5 +24,7 @@
 extern volatile bool force_quit;
 extern struct conn *conn;
 
+bool app_graph_stats_enabled(void);
 bool app_graph_exit(void);
+
 #endif
diff --git a/doc/guides/tools/graph.rst b/doc/guides/tools/graph.rst
index 2c06f8e958..649e802d73 100644
--- a/doc/guides/tools/graph.rst
+++ b/doc/guides/tools/graph.rst
@@ -57,6 +57,10 @@ Following are the application command-line options:
         a mandatory parameter which will be used to create desired graph
         for a given use case.
 
+* ``--enable-graph-stats``
+
+       Enable graph statistics printing on console. By default graph statistics are disabled.
+
 * ``--help``
 
        Dumps application usage
-- 
2.25.1