linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzvetomir Stoyanov <tstoyanov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd: fix "trace-cmd stat" output
Date: Fri, 14 Dec 2018 11:34:54 +0000	[thread overview]
Message-ID: <20181214113441.12166-1-tstoyanov@vmware.com> (raw)

This patch fixes the output of the "trace-cmd stat"
command to not display "(none enabled)" in case there
are enabled events from individual systems.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 tracecmd/trace-stat.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tracecmd/trace-stat.c b/tracecmd/trace-stat.c
index 99a22d0..538f4ad 100644
--- a/tracecmd/trace-stat.c
+++ b/tracecmd/trace-stat.c
@@ -324,6 +324,7 @@ static void report_events(struct buffer_instance *instance)
 	char *system;
 	enum event_iter_type type;
 	enum event_process processed = PROCESSED_NONE;
+	enum event_process processed_part = PROCESSED_NONE;
 
 	str = get_instance_file_content(instance, "events/enable");
 	if (!str)
@@ -358,7 +359,6 @@ static void report_events(struct buffer_instance *instance)
 
 	reset_event_iter(iter);
 
-	processed = PROCESSED_NONE;
 	system = NULL;
 	while ((type = trace_event_iter_next(iter, path, system))) {
 
@@ -369,18 +369,18 @@ static void report_events(struct buffer_instance *instance)
 				continue;
 
 			system = iter->system_dent->d_name;
-			if (processed)
-				processed = PROCESSED_SYSTEM;
+			if (processed_part)
+				processed_part = PROCESSED_SYSTEM;
 			continue;
 		}
 
 		process_event_enable(path, iter->system_dent->d_name,
-				     iter->event_dent->d_name, &processed);
+				     iter->event_dent->d_name, &processed_part);
 	}
 
 	trace_event_iter_free(iter);
 
-	if (!processed)
+	if (!processed && !processed_part)
 		printf("  (none enabled)\n");
 
 	tracecmd_put_tracing_file(path);
-- 
2.19.2

                 reply	other threads:[~2018-12-14 11:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly 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=20181214113441.12166-1-tstoyanov@vmware.com \
    --to=tstoyanov@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).