public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [for-next][PATCH 0/3] tracing/tools: Updates for 6.11
@ 2024-06-27 20:50 Steven Rostedt
  2024-06-27 20:50 ` [for-next][PATCH 1/3] rtla/osnoise: Use pretty formatting only on interactive tty Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steven Rostedt @ 2024-06-27 20:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Daniel Wagner, Luis Claudio R. Goncalves, Clark Williams

In honor of Daniel, I pulled down his repo and noticed that he had
a for-next branch that he has not pushed out yet. So I just took
his branch directly, and will be adding it to the linux-trace.git
tree. It is mostly trivial changes.

  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
tools/for-next

Head SHA1: 28beb730ee167e505c86d1a8ae239e97d0136b13


Daniel Wagner (1):
      tools: build: use correct lib name for libtracefs feature detection

Luis Claudio R. Goncalves (2):
      rtla/osnoise: Use pretty formatting only on interactive tty
      rtla/osnoise: Better report when histogram is empty

----
 tools/build/feature/Makefile          |  2 +-
 tools/build/feature/test-libtracefs.c |  2 +-
 tools/tracing/rtla/src/osnoise_hist.c | 15 +++++++++++++++
 tools/tracing/rtla/src/osnoise_top.c  | 19 +++++++++++++++----
 4 files changed, 32 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [for-next][PATCH 1/3] rtla/osnoise: Use pretty formatting only on interactive tty
  2024-06-27 20:50 [for-next][PATCH 0/3] tracing/tools: Updates for 6.11 Steven Rostedt
@ 2024-06-27 20:50 ` Steven Rostedt
  2024-06-27 20:50 ` [for-next][PATCH 2/3] rtla/osnoise: Better report when histogram is empty Steven Rostedt
  2024-06-27 20:50 ` [for-next][PATCH 3/3] tools: build: use correct lib name for libtracefs feature detection Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2024-06-27 20:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Daniel Wagner, Luis Claudio R. Goncalves, Clark Williams,
	Daniel Bristot de Oliveira, John Kacur

From: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>

osnoise top performs background/font color formatting that could make
the text output confusing if not on a terminal. Use the changes from
commit f5c0cdad6684a ("rtla/timerlat: Use pretty formatting only on
interactive tty") as an inspiration to fix this problem.

Apply the formatting only if running on a tty, and not in quiet mode.

Link: https://lkml.kernel.org/r/Zmb-yP_3EDHliI8Z@uudg.org

Suggested-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Reviewed-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Clark Williams <williams@redhat.com>
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 tools/tracing/rtla/src/osnoise_top.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 07ba55d4ec06..f594a44df840 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -42,6 +42,7 @@ struct osnoise_top_params {
 	int			hk_cpus;
 	int			warmup;
 	int			buffer_size;
+	int			pretty_output;
 	cpu_set_t		hk_cpu_set;
 	struct sched_attr	sched_param;
 	struct trace_events	*events;
@@ -163,7 +164,9 @@ static void osnoise_top_header(struct osnoise_tool *top)
 
 	get_duration(top->start_time, duration, sizeof(duration));
 
-	trace_seq_printf(s, "\033[2;37;40m");
+	if (params->pretty_output)
+		trace_seq_printf(s, "\033[2;37;40m");
+
 	trace_seq_printf(s, "                                          ");
 
 	if (params->mode == MODE_OSNOISE) {
@@ -174,12 +177,16 @@ static void osnoise_top_header(struct osnoise_tool *top)
 	}
 
 	trace_seq_printf(s, "                                   ");
-	trace_seq_printf(s, "\033[0;0;0m");
+
+	if (params->pretty_output)
+		trace_seq_printf(s, "\033[0;0;0m");
 	trace_seq_printf(s, "\n");
 
 	trace_seq_printf(s, "duration: %9s | time is in us\n", duration);
 
-	trace_seq_printf(s, "\033[2;30;47m");
+	if (params->pretty_output)
+		trace_seq_printf(s, "\033[2;30;47m");
+
 	trace_seq_printf(s, "CPU Period       Runtime ");
 	trace_seq_printf(s, "       Noise ");
 	trace_seq_printf(s, " %% CPU Aval ");
@@ -192,7 +199,8 @@ static void osnoise_top_header(struct osnoise_tool *top)
 	trace_seq_printf(s, "          IRQ      Softirq       Thread");
 
 eol:
-	trace_seq_printf(s, "\033[0;0;0m");
+	if (params->pretty_output)
+		trace_seq_printf(s, "\033[0;0;0m");
 	trace_seq_printf(s, "\n");
 }
 
@@ -619,6 +627,9 @@ osnoise_top_apply_config(struct osnoise_tool *tool, struct osnoise_top_params *p
 		auto_house_keeping(&params->monitored_cpus);
 	}
 
+	if (isatty(1) && !params->quiet)
+		params->pretty_output = 1;
+
 	return 0;
 
 out_err:
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [for-next][PATCH 2/3] rtla/osnoise: Better report when histogram is empty
  2024-06-27 20:50 [for-next][PATCH 0/3] tracing/tools: Updates for 6.11 Steven Rostedt
  2024-06-27 20:50 ` [for-next][PATCH 1/3] rtla/osnoise: Use pretty formatting only on interactive tty Steven Rostedt
@ 2024-06-27 20:50 ` Steven Rostedt
  2024-06-27 20:50 ` [for-next][PATCH 3/3] tools: build: use correct lib name for libtracefs feature detection Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2024-06-27 20:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Daniel Wagner, Luis Claudio R. Goncalves, Clark Williams,
	Daniel Bristot de Oliveira, John Kacur

From: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>

When osnoise hist does not observe any samples above the threshold,
no entries are recorded and the final report shows empty entries
for the usual statistics (count, min, max, avg):

    [~]# osnoise hist -d 5s -T 500
    # RTLA osnoise histogram
    # Time unit is microseconds (us)
    # Duration:   0 00:00:05
    Index
    over:
    count:
    min:
    avg:
    max:

That could lead users to confusing interpretations of the results.

A simple solution is to report 0 for count and the statistics, making it
clear that no noise (above the defined threshold) was observed:

    [~]# osnoise hist -d 5s -T 500
    # RTLA osnoise histogram
    # Time unit is microseconds (us)
    # Duration:   0 00:00:05
    Index
    over: 0
    count: 0
    min: 0
    avg: 0
    max: 0

Link: https://lkml.kernel.org/r/Zml6JmH5cbS7-HfZ@uudg.org

Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: John Kacur <jkacur@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Reviewed-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 tools/tracing/rtla/src/osnoise_hist.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 7be17d09f7e8..214e2c93fde0 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -374,6 +374,7 @@ osnoise_print_stats(struct osnoise_hist_params *params, struct osnoise_tool *too
 {
 	struct osnoise_hist_data *data = tool->data;
 	struct trace_instance *trace = &tool->trace;
+	int has_samples = 0;
 	int bucket, cpu;
 	int total;
 
@@ -402,11 +403,25 @@ osnoise_print_stats(struct osnoise_hist_params *params, struct osnoise_tool *too
 			continue;
 		}
 
+		/* There are samples above the threshold */
+		has_samples = 1;
 		trace_seq_printf(trace->seq, "\n");
 		trace_seq_do_printf(trace->seq);
 		trace_seq_reset(trace->seq);
 	}
 
+	/*
+	 * If no samples were recorded, skip calculations, print zeroed statistics
+	 * and return.
+	 */
+	if (!has_samples) {
+		trace_seq_reset(trace->seq);
+		trace_seq_printf(trace->seq, "over: 0\ncount: 0\nmin: 0\navg: 0\nmax: 0\n");
+		trace_seq_do_printf(trace->seq);
+		trace_seq_reset(trace->seq);
+		return;
+	}
+
 	if (!params->no_index)
 		trace_seq_printf(trace->seq, "over: ");
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [for-next][PATCH 3/3] tools: build: use correct lib name for libtracefs feature detection
  2024-06-27 20:50 [for-next][PATCH 0/3] tracing/tools: Updates for 6.11 Steven Rostedt
  2024-06-27 20:50 ` [for-next][PATCH 1/3] rtla/osnoise: Use pretty formatting only on interactive tty Steven Rostedt
  2024-06-27 20:50 ` [for-next][PATCH 2/3] rtla/osnoise: Better report when histogram is empty Steven Rostedt
@ 2024-06-27 20:50 ` Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2024-06-27 20:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Daniel Wagner, Luis Claudio R. Goncalves, Clark Williams,
	Daniel Bristot de Oliveira

From: Daniel Wagner <dwagner@suse.de>

Use libtracefs as package name to lookup the CFLAGS for libtracefs. This
makes it possible to use the distro specific path as include path for
the header file.

Link: https://lkml.kernel.org/r/20240617-rtla-build-v1-1-6882c34678e8@suse.de

Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 tools/build/feature/Makefile          | 2 +-
 tools/build/feature/test-libtracefs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index ed54cef450f5..489cbed7e82a 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -213,7 +213,7 @@ $(OUTPUT)test-libtraceevent.bin:
 	$(BUILD) -ltraceevent
 
 $(OUTPUT)test-libtracefs.bin:
-	 $(BUILD) $(shell $(PKG_CONFIG) --cflags libtraceevent 2>/dev/null) -ltracefs
+	 $(BUILD) $(shell $(PKG_CONFIG) --cflags libtracefs 2>/dev/null) -ltracefs
 
 $(OUTPUT)test-libcrypto.bin:
 	$(BUILD) -lcrypto
diff --git a/tools/build/feature/test-libtracefs.c b/tools/build/feature/test-libtracefs.c
index 8eff16c0c10b..29a757a7d848 100644
--- a/tools/build/feature/test-libtracefs.c
+++ b/tools/build/feature/test-libtracefs.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-#include <tracefs/tracefs.h>
+#include <tracefs.h>
 
 int main(void)
 {
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-27 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 20:50 [for-next][PATCH 0/3] tracing/tools: Updates for 6.11 Steven Rostedt
2024-06-27 20:50 ` [for-next][PATCH 1/3] rtla/osnoise: Use pretty formatting only on interactive tty Steven Rostedt
2024-06-27 20:50 ` [for-next][PATCH 2/3] rtla/osnoise: Better report when histogram is empty Steven Rostedt
2024-06-27 20:50 ` [for-next][PATCH 3/3] tools: build: use correct lib name for libtracefs feature detection Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox