aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2019-06-12 14:05:00 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-06-13 10:57:32 -0400
commit31536589783b26c5afc73054c179ac49d3061c9f (patch)
tree5ee3bfabb04f9e7eda456125879d94f282ad4147
parent31d0e2211955918a03e347b17e827d475212c06f (diff)
downloadtrace-cmd-31536589783b26c5afc73054c179ac49d3061c9f.tar.gz
trace-cmd: Have --max-graph-depth only be part of instance
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. Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com> Reviewed-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--tracecmd/include/trace-local.h2
-rw-r--r--tracecmd/trace-record.c27
2 files changed, 17 insertions, 12 deletions
diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
index a1a06e91..1cad3ccc 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 ee35ada1..2d716a81 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();