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 ++
2 files changed, 18 insertions(+), 1 deletion(-)
@@ -18,12 +18,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",
@@ -37,6 +38,7 @@ static struct app_params {
.msg_handle_arg = NULL, /* set later. */
},
.script_name = NULL,
+ .enable_graph_stats = false,
};
static void
@@ -53,6 +55,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];
@@ -130,6 +133,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);
@@ -141,6 +150,12 @@ app_args_parse(int argc, char **argv)
return 0;
}
+bool
+app_graph_stats_enabled(void)
+{
+ return app.enable_graph_stats;
+}
+
int
main(int argc, char **argv)
{
@@ -24,4 +24,6 @@
extern volatile bool force_quit;
extern struct conn *conn;
+bool app_graph_stats_enabled(void);
+
#endif