[PATCH v3 5/5] trace-cmd stat: Support -a for all buffers. Update docs.

From: Howard Cochran
Date: Wed Apr 22 2015 - 00:57:14 EST


As for stop, restart, reset, extract, -a means show status of
all buffer instances except the top one. Use -t to get the top
one too.

Also added documentation for the existing -B and -t options.

Signed-off-by: Howard Cochran <hcochran@xxxxxxxxxxxxxxxx>
---
Documentation/trace-cmd-stat.1.txt | 19 +++++++++++++++++++
trace-stat.c | 15 +++++++++++----
trace-usage.c | 6 +++++-
3 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/Documentation/trace-cmd-stat.1.txt b/Documentation/trace-cmd-stat.1.txt
index 7e4263e..62c2e18 100644
--- a/Documentation/trace-cmd-stat.1.txt
+++ b/Documentation/trace-cmd-stat.1.txt
@@ -41,6 +41,25 @@ system. The status that it shows is:

*Uprobes:* Shows any uprobes that are defined for tracing.

+OPTIONS
+-------
+*-B* 'buffer-name'::
+ If the kernel supports multiple buffers, this will display the status of
+ of the given buffer instance. This may be used multiple times to
+ specify different buffers. When this option is used, the status of the
+ top level instance will not be shown unless *-t* is given.
+
+*-a*::
+ Display the status of all existing buffer instances. When this option
+ is used, the status of the top level instance will not be displayed
+ unless *-t* is given.
+
+*-t*::
+ Display the status of the top level instance buffer. Without the *-B*
+ or *-a* option, this is the same as the default. But if *-B* or *-a*
+ is used, this is required if the top level instance buffer should also
+ be displayed.
+
SEE ALSO
--------
trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
diff --git a/trace-stat.c b/trace-stat.c
index 6c38719..9bd773e 100644
--- a/trace-stat.c
+++ b/trace-stat.c
@@ -865,6 +865,12 @@ static void report_traceon(struct buffer_instance *instance)

static void stat_instance(struct buffer_instance *instance)
{
+ if (instance->name) {
+ /* Lack of trailing newline is intentional */
+ printf("\nInstance: %s\n====================",
+ instance->name);
+ }
+
report_plugin(instance);
report_events(instance);
report_event_filters(instance);
@@ -887,7 +893,7 @@ void trace_stat (int argc, char **argv)
int c;

for (;;) {
- c = getopt(argc-1, argv+1, "tB:");
+ c = getopt(argc-1, argv+1, "hatB:");
if (c == -1)
break;
switch (c) {
@@ -897,9 +903,9 @@ void trace_stat (int argc, char **argv)
case 'B':
instance = create_instance(optarg);
add_instance(instance);
- /* top instance requires direct access */
- if (!topt && is_top_instance(first_instance))
- first_instance = instance;
+ break;
+ case 'a':
+ add_all_instances();
break;
case 't':
/* Force to use top instance */
@@ -911,6 +917,7 @@ void trace_stat (int argc, char **argv)
usage(argv);
}
}
+ update_first_instance(topt);

for_all_instances(instance) {
stat_instance(instance);
diff --git a/trace-usage.c b/trace-usage.c
index 56c68b4..6e85fdf 100644
--- a/trace-usage.c
+++ b/trace-usage.c
@@ -182,7 +182,11 @@ static struct usage_help usage_help[] = {
{
"stat",
"show the status of the running tracing (ftrace) system",
- " %s stat"
+ " %s stat [-B buf][-a][-t]\n"
+ " Shows the status of the tracing system"
+ " -B status for a given buffer (more than one may be specified)\n"
+ " -a status for all buffers (except top one)\n"
+ " -t status the top level buffer (useful with -B or -a)\n"
},
{
"split",
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/