Commit f9f60efb authored by Changbin Du's avatar Changbin Du Committed by Arnaldo Carvalho de Melo

perf ftrace: Reuse target::initial_delay

Replace perf_ftrace::initial_delay with target::initial_delay.
Specifying a negative initial_delay is meaningless for ftrace in
practice but allowed here.
Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hui Wang <hw.huiwang@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230302031146.2801588-4-changbin.du@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent cb4b9e68
...@@ -623,7 +623,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace) ...@@ -623,7 +623,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace)
/* display column headers */ /* display column headers */
read_tracing_file_to_stdout("trace"); read_tracing_file_to_stdout("trace");
if (!ftrace->initial_delay) { if (!ftrace->target.initial_delay) {
if (write_tracing_file("tracing_on", "1") < 0) { if (write_tracing_file("tracing_on", "1") < 0) {
pr_err("can't enable tracing\n"); pr_err("can't enable tracing\n");
goto out_close_fd; goto out_close_fd;
...@@ -632,8 +632,8 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace) ...@@ -632,8 +632,8 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace)
evlist__start_workload(ftrace->evlist); evlist__start_workload(ftrace->evlist);
if (ftrace->initial_delay) { if (ftrace->target.initial_delay > 0) {
usleep(ftrace->initial_delay * 1000); usleep(ftrace->target.initial_delay * 1000);
if (write_tracing_file("tracing_on", "1") < 0) { if (write_tracing_file("tracing_on", "1") < 0) {
pr_err("can't enable tracing\n"); pr_err("can't enable tracing\n");
goto out_close_fd; goto out_close_fd;
...@@ -1164,7 +1164,7 @@ int cmd_ftrace(int argc, const char **argv) ...@@ -1164,7 +1164,7 @@ int cmd_ftrace(int argc, const char **argv)
"Size of per cpu buffer, needs to use a B, K, M or G suffix.", parse_buffer_size), "Size of per cpu buffer, needs to use a B, K, M or G suffix.", parse_buffer_size),
OPT_BOOLEAN(0, "inherit", &ftrace.inherit, OPT_BOOLEAN(0, "inherit", &ftrace.inherit,
"Trace children processes"), "Trace children processes"),
OPT_UINTEGER('D', "delay", &ftrace.initial_delay, OPT_INTEGER('D', "delay", &ftrace.target.initial_delay,
"Number of milliseconds to wait before starting tracing after program start"), "Number of milliseconds to wait before starting tracing after program start"),
OPT_PARENT(common_options), OPT_PARENT(common_options),
}; };
......
...@@ -25,7 +25,6 @@ struct perf_ftrace { ...@@ -25,7 +25,6 @@ struct perf_ftrace {
int graph_noirqs; int graph_noirqs;
int graph_verbose; int graph_verbose;
int graph_thresh; int graph_thresh;
unsigned int initial_delay;
}; };
struct filter_entry { struct filter_entry {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment