@@ -55,6 +55,10 @@ OPTIONS
If *-B* is also specified, show the status of the top level tracing directory
as well as the instance(s).
+*-o*::
+ Display the all the options along with their values. If they start with "no", then
+ the option is disabled.
+
SEE ALSO
--------
trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
@@ -294,6 +294,7 @@ void add_instance(struct buffer_instance *instance, int cpu_count);
void update_first_instance(struct buffer_instance *instance, int topt);
void show_instance_file(struct buffer_instance *instance, const char *name);
+void show_options(const char *prefix, struct buffer_instance *buffer);
struct trace_guest {
char *name;
@@ -255,14 +255,18 @@ static void show_tracers(void)
show_file("available_tracers");
}
-static void show_options(void)
+void show_options(const char *prefix, struct buffer_instance *buffer)
{
+ struct tracefs_instance *instance = buffer ? buffer->tracefs : NULL;
struct dirent *dent;
struct stat st;
char *path;
DIR *dir;
- path = tracefs_get_tracing_file("options");
+ if (!prefix)
+ prefix = "";
+
+ path = tracefs_instance_get_file(instance, "options");
if (!path)
goto show_file;
if (stat(path, &st) < 0)
@@ -288,12 +292,12 @@ static void show_options(void)
ret = asprintf(&file, "options/%s", name);
if (ret < 0)
die("Failed to allocate file name");
- ret = tracefs_instance_file_read_number(NULL, file, &val);
+ ret = tracefs_instance_file_read_number(instance, file, &val);
if (!ret) {
if (val)
- printf("%s\n", name);
+ printf("%s%s\n", prefix, name);
else
- printf("no%s\n", name);
+ printf("%sno%s\n", prefix, name);
}
free(file);
}
@@ -549,7 +553,7 @@ void trace_list(int argc, char **argv)
show_tracers();
if (options)
- show_options();
+ show_options(NULL, NULL);
if (plug)
show_plugins();
@@ -575,7 +579,7 @@ void trace_list(int argc, char **argv)
printf("\ntracers:\n");
show_tracers();
printf("\noptions:\n");
- show_options();
+ show_options(NULL, NULL);
}
return;
@@ -835,7 +835,7 @@ static void report_traceon(struct buffer_instance *instance)
free(str);
}
-static void stat_instance(struct buffer_instance *instance)
+static void stat_instance(struct buffer_instance *instance, bool opt)
{
if (instance != &top_instance) {
if (instance != first_instance)
@@ -859,6 +859,10 @@ static void stat_instance(struct buffer_instance *instance)
report_file(instance, "set_event_pid", "", "Filtered event PIDs:\n");
report_file(instance, "set_ftrace_pid", "no pid",
"Filtered function tracer PIDs:\n");
+ if (opt) {
+ printf("\nOptions:\n");
+ show_options(" ", instance);
+ }
report_traceon(instance);
report_file(instance, "error_log", "", "Error log:\n");
if (instance == &top_instance)
@@ -868,6 +872,7 @@ static void stat_instance(struct buffer_instance *instance)
void trace_stat (int argc, char **argv)
{
struct buffer_instance *instance = &top_instance;
+ bool opt = false;
int topt = 0;
int status;
int c;
@@ -875,7 +880,7 @@ void trace_stat (int argc, char **argv)
init_top_instance();
for (;;) {
- c = getopt(argc-1, argv+1, "htB:");
+ c = getopt(argc-1, argv+1, "htoB:");
if (c == -1)
break;
switch (c) {
@@ -896,6 +901,9 @@ void trace_stat (int argc, char **argv)
topt = 1;
instance = &top_instance;
break;
+ case 'o':
+ opt = 1;
+ break;
default:
usage(argv);
}
@@ -904,7 +912,7 @@ void trace_stat (int argc, char **argv)
update_first_instance(instance, topt);
for_all_instances(instance) {
- stat_instance(instance);
+ stat_instance(instance, opt);
}
if (tracecmd_stack_tracer_status(&status) >= 0) {
@@ -258,9 +258,10 @@ static struct usage_help usage_help[] = {
{
"stat",
"show the status of the running tracing (ftrace) system",
- " %s stat [-B buf][-t]"
+ " %s stat [-B buf][-t][-o]"
" -B show the status of a instance buffer\n"
" -t show the top level status along with buffer specified by -B\n"
+ " -o list tracing options\n"
},
{
"split",