linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace-cmd: fix "trace-cmd stat" output
@ 2018-12-14 11:34 Tzvetomir Stoyanov
  0 siblings, 0 replies; only message in thread
From: Tzvetomir Stoyanov @ 2018-12-14 11:34 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-14 11:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 11:34 [PATCH] trace-cmd: fix "trace-cmd stat" output Tzvetomir Stoyanov

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).