[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc8d963c095e10e2dee093ef7f50943ad6b606d4.1755014784.git.ipravdin.official@gmail.com>
Date: Tue, 12 Aug 2025 12:27:32 -0400
From: Ivan Pravdin <ipravdin.official@...il.com>
To: rostedt@...dmis.org,
corbet@....net,
tglozar@...hat.com,
linux-trace-kernel@...r.kernel.org,
linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Ivan Pravdin <ipravdin.official@...il.com>
Subject: [PATCH 3/3] rtla: fix -a overriding -t argument
When running rtla as
`rtla <timerlat|osnoise> <top|hist> -t custom_file.txt -a 100`
-a options override trace output filename specified by -t option.
Running the command above will create <timerlat|osnoise>_trace.txt file
instead of custom_file.txt. Fix this by making sure that -a option does
not override trace output filename even if it's passed after trace
output filename is specified.
Fixes: 173a3b014827 ("rtla/timerlat: Add the automatic trace option")
Signed-off-by: Ivan Pravdin <ipravdin.official@...il.com>
---
tools/tracing/rtla/src/osnoise_hist.c | 8 +++++---
tools/tracing/rtla/src/osnoise_top.c | 8 +++++---
tools/tracing/rtla/src/timerlat_hist.c | 8 +++++---
tools/tracing/rtla/src/timerlat_top.c | 8 +++++---
4 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index 92c379fbe030..babcd97cec66 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -543,7 +543,8 @@ static struct osnoise_params
params->threshold = 1;
/* set trace */
- params->trace_output = "osnoise_trace.txt";
+ if (!params->trace_output)
+ params->trace_output = "osnoise_trace.txt";
break;
case 'b':
@@ -639,10 +640,11 @@ static struct osnoise_params
params->trace_output = &optarg[1];
else
params->trace_output = &optarg[0];
- } else if (optind < argc && argv[optind][0] != '0')
+ } else if (optind < argc && argv[optind][0] != '0') {
params->trace_output = argv[optind];
- else
+ } else {
params->trace_output = "osnoise_trace.txt";
+ }
break;
case '0': /* no header */
params->no_header = 1;
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index d149c3c4ac11..6c1e83f7a828 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -383,7 +383,8 @@ struct osnoise_params *osnoise_top_parse_args(int argc, char **argv)
params->threshold = 1;
/* set trace */
- params->trace_output = "osnoise_trace.txt";
+ if (!params->trace_output)
+ params->trace_output = "osnoise_trace.txt";
break;
case 'c':
@@ -469,10 +470,11 @@ struct osnoise_params *osnoise_top_parse_args(int argc, char **argv)
params->trace_output = &optarg[1];
else
params->trace_output = &optarg[0];
- } else if (optind < argc && argv[optind][0] != '-')
+ } else if (optind < argc && argv[optind][0] != '-') {
params->trace_output = argv[optind];
- else
+ } else {
params->trace_output = "osnoise_trace.txt";
+ }
break;
case 'T':
params->threshold = get_llong_from_str(optarg);
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index c397f6260054..d4f2a5f02998 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -874,7 +874,8 @@ static struct timerlat_params
params->print_stack = auto_thresh;
/* set trace */
- trace_output = "timerlat_trace.txt";
+ if (!trace_output)
+ trace_output = "timerlat_trace.txt";
break;
case 'c':
@@ -971,10 +972,11 @@ static struct timerlat_params
trace_output = &optarg[1];
else
trace_output = &optarg[0];
- } else if (optind < argc && argv[optind][0] != '-')
+ } else if (optind < argc && argv[optind][0] != '-') {
trace_output = argv[optind];
- else
+ } else {
trace_output = "timerlat_trace.txt";
+ }
break;
case 'u':
params->user_workload = 1;
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 73949d52cf41..4f40e7ebde88 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -613,7 +613,8 @@ static struct timerlat_params
params->print_stack = auto_thresh;
/* set trace */
- trace_output = "timerlat_trace.txt";
+ if (!trace_output)
+ trace_output = "timerlat_trace.txt";
break;
case '5':
@@ -716,10 +717,11 @@ static struct timerlat_params
trace_output = &optarg[1];
else
trace_output = &optarg[0];
- } else if (optind < argc && argv[optind][0] != '-')
+ } else if (optind < argc && argv[optind][0] != '-') {
trace_output = argv[optind];
- else
+ } else {
trace_output = "timerlat_trace.txt";
+ }
break;
case 'u':
params->user_workload = true;
--
2.48.1
Powered by blists - more mailing lists