From patchwork Fri Dec 14 11:34:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10760167 Return-Path: Received: from mail-eopbgr710082.outbound.protection.outlook.com ([40.107.71.82]:33975 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726344AbeLNLe5 (ORCPT ); Fri, 14 Dec 2018 06:34:57 -0500 From: Tzvetomir Stoyanov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH] trace-cmd: fix "trace-cmd stat" output Date: Fri, 14 Dec 2018 11:34:54 +0000 Message-ID: <20181214113441.12166-1-tstoyanov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1629 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 --- 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);