diff mbox series

trace-cmd: fix "trace-cmd stat" output

Message ID 20181214113441.12166-1-tstoyanov@vmware.com (mailing list archive)
State Accepted
Commit dc81f843af659cc2f7c52bd529f76162a0ed32ab
Headers show
Series trace-cmd: fix "trace-cmd stat" output | expand

Commit Message

Tzvetomir Stoyanov Dec. 14, 2018, 11:34 a.m. UTC
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 mbox series

Patch

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