From nobody Thu Dec 18 18:01:34 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BCCA19AA5D for ; Thu, 27 Jun 2024 21:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719522124; cv=none; b=tvFvppSLAmybkYxwm2MBvjCWz1uBNpTbW8oh0X5GiOX+VJ+pphxMPOxc9MdvVxV7UeSkEU7QshnFqgqWkyDs2bdQHvAebzyepDKWHXH6fEpWTip3CL3jIjFHNn/h9ECcu5rPsLnFuw+rZSyVtxSNyGAkzMBvPGBLKTyTligGLTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719522124; c=relaxed/simple; bh=1tkTuwgRdTqCRUm9PPbyXU/b2nxuXiB8D2jFPWEFqd0=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=WaQb1Z8Kq+TckFKIdOe1iBloenkk+DzCaBRkEmeUaUlcFOa2Bp7duwXsHQXp5cpO82WP39L9VW0V4B+1aVtylB4xwJ5v9RdOBqcqZsM90x7VJVFvii/vmLFh2JyAMWRB/FOwOVo0XMGF948hm5IQN4iDWMvRjgHGwphl6Pbk0DM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32D67C32789; Thu, 27 Jun 2024 21:02:04 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sMwGe-000000031k7-34gi; Thu, 27 Jun 2024 17:02:56 -0400 Message-ID: <20240627210256.595062681@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 27 Jun 2024 16:50:23 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Wagner , "Luis Claudio R. Goncalves" , Clark Williams , Daniel Bristot de Oliveira , John Kacur Subject: [for-next][PATCH 1/3] rtla/osnoise: Use pretty formatting only on interactive tty References: <20240627205022.857212058@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Luis Claudio R. Goncalves" 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 Reviewed-by: John Kacur Reviewed-by: Clark Williams Signed-off-by: Luis Claudio R. Goncalves Signed-off-by: Daniel Bristot de Oliveira --- 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) =20 get_duration(top->start_time, duration, sizeof(duration)); =20 - trace_seq_printf(s, "\033[2;37;40m"); + if (params->pretty_output) + trace_seq_printf(s, "\033[2;37;40m"); + trace_seq_printf(s, " "); =20 if (params->mode =3D=3D MODE_OSNOISE) { @@ -174,12 +177,16 @@ static void osnoise_top_header(struct osnoise_tool *t= op) } =20 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"); =20 trace_seq_printf(s, "duration: %9s | time is in us\n", duration); =20 - 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"); =20 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"); } =20 @@ -619,6 +627,9 @@ osnoise_top_apply_config(struct osnoise_tool *tool, str= uct osnoise_top_params *p auto_house_keeping(¶ms->monitored_cpus); } =20 + if (isatty(1) && !params->quiet) + params->pretty_output =3D 1; + return 0; =20 out_err: --=20 2.43.0 From nobody Thu Dec 18 18:01:34 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B32E719F488 for ; Thu, 27 Jun 2024 21:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719522124; cv=none; b=XJd/MO+9JzZDbkmeWUgTPvlluOLRP8Je5BC3Lvc0P5yshWILoEZNEbJ/OtBFkG96tewogRiOOARe1Rg4wJYw5qhab1H/bYRLqT36felhgTv4RFgudXvcFfm8EP8ofsgnW2VPIJU6Hy5zdcEuae5D/sGiJ/NN9JROPIBvLOWgHsA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719522124; c=relaxed/simple; bh=fBHm2aJE5BQePO6xN6ulviz3Ck3xv58aqXPvq+k5j1o=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=nmDQoC9YYsrpEx9oi6S2m4xtaBw6p2dmHyAL7N/G9/gsVFFCdOW51zA2jrlYVI8DgVOYSKrHDnJ3WPhrYJjhl9RSPWfZLPg6k9+isGrLRMRMpOiSoe7dFrliBxgKGnpr2mAj/92TbQDIQcuZXXz1vKQ5ZzWTUGzzHBgM00If9Mo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6602EC4AF07; Thu, 27 Jun 2024 21:02:04 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sMwGe-000000031kc-3jeJ; Thu, 27 Jun 2024 17:02:56 -0400 Message-ID: <20240627210256.757142831@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 27 Jun 2024 16:50:24 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Wagner , "Luis Claudio R. Goncalves" , Clark Williams , Daniel Bristot de Oliveira , John Kacur Subject: [for-next][PATCH 2/3] rtla/osnoise: Better report when histogram is empty References: <20240627205022.857212058@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Luis Claudio R. Goncalves" 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 Cc: John Kacur Cc: Clark Williams Reviewed-by: John Kacur Signed-off-by: Luis Claudio R. Goncalves Signed-off-by: Daniel Bristot de Oliveira --- 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 =3D tool->data; struct trace_instance *trace =3D &tool->trace; + int has_samples =3D 0; int bucket, cpu; int total; =20 @@ -402,11 +403,25 @@ osnoise_print_stats(struct osnoise_hist_params *param= s, struct osnoise_tool *too continue; } =20 + /* There are samples above the threshold */ + has_samples =3D 1; trace_seq_printf(trace->seq, "\n"); trace_seq_do_printf(trace->seq); trace_seq_reset(trace->seq); } =20 + /* + * 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: "); =20 --=20 2.43.0 From nobody Thu Dec 18 18:01:34 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B329119F469 for ; Thu, 27 Jun 2024 21:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719522124; cv=none; b=s4NVapf/lq1T0G/Q2NNKau5FA40v9ogxFJehiFKljlGluyrG4IwJyKQkdXqR/OURtBP0HSErZZwdaXmuVv0rT8SwrpBqOPpSGkwK6Ae/8hs7YRXUE5nMyAoZs/uB6JblAvZqffUHaG3ZRWiQLIyg4QJTawF1ojXw/BJXva3W1Q8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719522124; c=relaxed/simple; bh=5A1xrcYEqkBgQFzZBOgLxlRJaM6yasYiRU8R1ppF8p8=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=MFhg8Io6UFReVzW8t0/210YaPgnQyW2ZqSL7ab3IDWqmxqAcgd9EnJIJIELWAcaoAVrp2GTxUFh5QiI1OIr9Ffo0if30VQCO7HRtEDpZ4PQdEhgflszvVK8QVC4+cr/UIx7DoXn4mI+lNs8CG7o1mTwSqxPnqDqujvH8gbq2UHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AE9EC4AF09; Thu, 27 Jun 2024 21:02:04 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sMwGf-000000031l7-0Doo; Thu, 27 Jun 2024 17:02:57 -0400 Message-ID: <20240627210256.912091413@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 27 Jun 2024 16:50:25 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Wagner , "Luis Claudio R. Goncalves" , Clark Williams , Daniel Bristot de Oliveira Subject: [for-next][PATCH 3/3] tools: build: use correct lib name for libtracefs feature detection References: <20240627205022.857212058@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Daniel Wagner 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 Signed-off-by: Daniel Wagner Signed-off-by: Daniel Bristot de Oliveira --- 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 =20 $(OUTPUT)test-libtracefs.bin: - $(BUILD) $(shell $(PKG_CONFIG) --cflags libtraceevent 2>/dev/null) -ltra= cefs + $(BUILD) $(shell $(PKG_CONFIG) --cflags libtracefs 2>/dev/null) -ltracefs =20 $(OUTPUT)test-libcrypto.bin: $(BUILD) -lcrypto diff --git a/tools/build/feature/test-libtracefs.c b/tools/build/feature/te= st-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 +#include =20 int main(void) { --=20 2.43.0