Skip to content

Commit 5c9a2f2

Browse files
committed
rtla/timerlat: Simplify "no value" printing on top
JIRA: https://issues.redhat.com/browse/RHEL-50869 commit 5f07693 Author: Daniel Bristot de Oliveira <bristot@kernel.org> Date: Wed Apr 24 16:36:50 2024 +0200 rtla/timerlat: Simplify "no value" printing on top Instead of printing three times the same output, print it only once, reducing lines and being sure that all no values have the same length. It also fixes an extra '\n' when running the with kernel threads, like here: =============== %< ============== Timer Latency 0 00:00:01 | IRQ Timer Latency (us) | Thread Timer Latency (us) CPU COUNT | cur min avg max | cur min avg max 2 #0 | - - - - | 161 161 161 161 3 #0 | - - - - | 161 161 161 161 8 #1 | 54 54 54 54 | - - - -'\n' ---------------|----------------------------------------|--------------------------------------- ALL #1 e0 | 54 54 54 | 161 161 161 =============== %< ============== This '\n' should have been removed with the user-space support that added another '\n' if not running with kernel threads. Link: https://lkml.kernel.org/r/0a4d8085e7cd706733a5dc10a81ca38b82bd4992.1713968967.git.bristot@kernel.org Cc: stable@vger.kernel.org Cc: Jonathan Corbet <corbet@lwn.net> Cc: Juri Lelli <juri.lelli@redhat.com> Fixes: cdca4f4 ("rtla/timerlat_top: Add timerlat user-space support") Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org> Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
1 parent 937033e commit 5c9a2f2

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

tools/tracing/rtla/src/timerlat_top.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ static void timerlat_top_header(struct osnoise_tool *top)
212212
trace_seq_printf(s, "\n");
213213
}
214214

215+
static const char *no_value = " -";
216+
215217
/*
216218
* timerlat_top_print - prints the output of a given CPU
217219
*/
@@ -239,10 +241,7 @@ static void timerlat_top_print(struct osnoise_tool *top, int cpu)
239241
trace_seq_printf(s, "%3d #%-9d |", cpu, cpu_data->irq_count);
240242

241243
if (!cpu_data->irq_count) {
242-
trace_seq_printf(s, " - ");
243-
trace_seq_printf(s, " - ");
244-
trace_seq_printf(s, " - ");
245-
trace_seq_printf(s, " - |");
244+
trace_seq_printf(s, "%s %s %s %s |", no_value, no_value, no_value, no_value);
246245
} else {
247246
trace_seq_printf(s, "%9llu ", cpu_data->cur_irq / params->output_divisor);
248247
trace_seq_printf(s, "%9llu ", cpu_data->min_irq / params->output_divisor);
@@ -251,10 +250,7 @@ static void timerlat_top_print(struct osnoise_tool *top, int cpu)
251250
}
252251

253252
if (!cpu_data->thread_count) {
254-
trace_seq_printf(s, " - ");
255-
trace_seq_printf(s, " - ");
256-
trace_seq_printf(s, " - ");
257-
trace_seq_printf(s, " -\n");
253+
trace_seq_printf(s, "%s %s %s %s", no_value, no_value, no_value, no_value);
258254
} else {
259255
trace_seq_printf(s, "%9llu ", cpu_data->cur_thread / divisor);
260256
trace_seq_printf(s, "%9llu ", cpu_data->min_thread / divisor);
@@ -271,10 +267,7 @@ static void timerlat_top_print(struct osnoise_tool *top, int cpu)
271267
trace_seq_printf(s, " |");
272268

273269
if (!cpu_data->user_count) {
274-
trace_seq_printf(s, " - ");
275-
trace_seq_printf(s, " - ");
276-
trace_seq_printf(s, " - ");
277-
trace_seq_printf(s, " -\n");
270+
trace_seq_printf(s, "%s %s %s %s\n", no_value, no_value, no_value, no_value);
278271
} else {
279272
trace_seq_printf(s, "%9llu ", cpu_data->cur_user / divisor);
280273
trace_seq_printf(s, "%9llu ", cpu_data->min_user / divisor);

0 commit comments

Comments
 (0)