Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Subject: [PATCH 2/3] trace-cmd: Have --max-graph-depth only be part of instance
Date: Wed, 12 Jun 2019 14:19:29 -0400
Message-ID: <20190612182019.007518394@goodmis.org> (raw)
In-Reply-To: <20190612181927.608151291@goodmis.org>

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

New kernels will allow function graph tracer to be used in an instance,
which means that the max_graph_depth file will be per instance and not just
the top level file. Make the max_graph_depth associated to the instance and
not part of the trace record context.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/include/trace-local.h |  2 ++
 tracecmd/trace-record.c        | 27 +++++++++++++++------------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
index a1a06e9196b4..1cad3ccc4de7 100644
--- a/tracecmd/include/trace-local.h
+++ b/tracecmd/include/trace-local.h
@@ -183,6 +183,8 @@ struct buffer_instance {
 	struct tracecmd_msg_handle *msg_handle;
 	struct tracecmd_output *network_handle;
 
+	char			*max_graph_depth;
+
 	int			flags;
 	int			tracing_on_init_val;
 	int			tracing_on_fd;
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index ee35ada10d6e..2d716a81acbf 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -207,7 +207,6 @@ struct common_record_context {
 	struct buffer_instance *instance;
 	const char *output;
 	char *date2ts;
-	char *max_graph_depth;
 	int data_flags;
 
 	int record_all;
@@ -4892,9 +4891,9 @@ static void parse_record_options(int argc,
 			ctx->data_flags |= DATA_FL_OFFSET;
 			break;
 		case OPT_max_graph_depth:
-			free(ctx->max_graph_depth);
-			ctx->max_graph_depth = strdup(optarg);
-			if (!ctx->max_graph_depth)
+			free(ctx->instance->max_graph_depth);
+			ctx->instance->max_graph_depth = strdup(optarg);
+			if (!ctx->instance->max_graph_depth)
 				die("Could not allocate option");
 			break;
 		case OPT_no_filter:
@@ -5056,10 +5055,12 @@ static void record_trace(int argc, char **argv,
 	update_plugins(type);
 	set_options();
 
-	if (ctx->max_graph_depth) {
-		for_all_instances(instance)
-			set_max_graph_depth(instance, ctx->max_graph_depth);
-		free(ctx->max_graph_depth);
+	for_all_instances(instance) {
+		if (instance->max_graph_depth) {
+			set_max_graph_depth(instance, instance->max_graph_depth);
+			free(instance->max_graph_depth);
+			instance->max_graph_depth = NULL;
+		}
 	}
 
 	allocate_seq();
@@ -5155,10 +5156,12 @@ void trace_extract(int argc, char **argv)
 	update_plugins(type);
 	set_options();
 
-	if (ctx.max_graph_depth) {
-		for_all_instances(instance)
-			set_max_graph_depth(instance, ctx.max_graph_depth);
-		free(ctx.max_graph_depth);
+	for_all_instances(instance) {
+		if (instance->max_graph_depth) {
+			set_max_graph_depth(instance, instance->max_graph_depth);
+			free(instance->max_graph_depth);
+			instance->max_graph_depth = NULL;
+		}
 	}
 
 	allocate_seq();
-- 
2.20.1



  parent reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12 18:19 [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Steven Rostedt
2019-06-12 18:19 ` [PATCH 1/3] trace-cmd: Fix typo in Makefile bidr to bdir Steven Rostedt
2019-06-13 14:40   ` Tzvetomir Stoyanov
2019-06-12 18:19 ` Steven Rostedt [this message]
2019-06-13 14:48   ` [PATCH 2/3] trace-cmd: Have --max-graph-depth only be part of instance Tzvetomir Stoyanov
2019-06-12 18:19 ` [PATCH 3/3] trace-cmd: Check the return of get_file_content() before calling add_reset_file() Steven Rostedt
2019-06-13 14:51   ` Tzvetomir Stoyanov
2019-06-13 14:51 ` [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Slavomir Kaslev
2019-06-13 14:56   ` Steven Rostedt

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190612182019.007518394@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org linux-trace-devel@archiver.kernel.org
	public-inbox-index linux-trace-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox