Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf record: Reuse target::initial_delay

This just simply replace record_opts::initial_delay with
target::initial_delay. Nothing else is changed.

Signed-off-by: Changbin Du <changbin.du@huawei.com>
Acked-by: Namhyung 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-3-changbin.du@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Changbin Du and committed by
Arnaldo Carvalho de Melo
cb4b9e68 07d85ba9

+14 -15
+6 -6
tools/perf/builtin-record.c
··· 1292 1292 * dummy event so that we can track PERF_RECORD_MMAP to cover the delay 1293 1293 * of waiting or event synthesis. 1294 1294 */ 1295 - if (opts->initial_delay || target__has_cpu(&opts->target) || 1295 + if (opts->target.initial_delay || target__has_cpu(&opts->target) || 1296 1296 perf_pmu__has_hybrid()) { 1297 1297 pos = evlist__get_tracking_event(evlist); 1298 1298 if (!evsel__is_dummy_event(pos)) { ··· 1307 1307 * Enable the dummy event when the process is forked for 1308 1308 * initial_delay, immediately for system wide. 1309 1309 */ 1310 - if (opts->initial_delay && !pos->immediate && 1310 + if (opts->target.initial_delay && !pos->immediate && 1311 1311 !target__has_cpu(&opts->target)) 1312 1312 pos->core.attr.enable_on_exec = 1; 1313 1313 else ··· 2522 2522 * (apart from group members) have enable_on_exec=1 set, 2523 2523 * so don't spoil it by prematurely enabling them. 2524 2524 */ 2525 - if (!target__none(&opts->target) && !opts->initial_delay) 2525 + if (!target__none(&opts->target) && !opts->target.initial_delay) 2526 2526 evlist__enable(rec->evlist); 2527 2527 2528 2528 /* ··· 2574 2574 evlist__start_workload(rec->evlist); 2575 2575 } 2576 2576 2577 - if (opts->initial_delay) { 2577 + if (opts->target.initial_delay) { 2578 2578 pr_info(EVLIST_DISABLED_MSG); 2579 - if (opts->initial_delay > 0) { 2580 - usleep(opts->initial_delay * USEC_PER_MSEC); 2579 + if (opts->target.initial_delay > 0) { 2580 + usleep(opts->target.initial_delay * USEC_PER_MSEC); 2581 2581 evlist__enable(rec->evlist); 2582 2582 pr_info(EVLIST_ENABLED_MSG); 2583 2583 }
+4 -4
tools/perf/builtin-trace.c
··· 3993 3993 if (err < 0) 3994 3994 goto out_error_mmap; 3995 3995 3996 - if (!target__none(&trace->opts.target) && !trace->opts.initial_delay) 3996 + if (!target__none(&trace->opts.target) && !trace->opts.target.initial_delay) 3997 3997 evlist__enable(evlist); 3998 3998 3999 3999 if (forks) 4000 4000 evlist__start_workload(evlist); 4001 4001 4002 - if (trace->opts.initial_delay) { 4003 - usleep(trace->opts.initial_delay * 1000); 4002 + if (trace->opts.target.initial_delay) { 4003 + usleep(trace->opts.target.initial_delay * 1000); 4004 4004 evlist__enable(evlist); 4005 4005 } 4006 4006 ··· 4788 4788 "per thread proc mmap processing timeout in ms"), 4789 4789 OPT_CALLBACK('G', "cgroup", &trace, "name", "monitor event in cgroup name only", 4790 4790 trace__parse_cgroups), 4791 - OPT_INTEGER('D', "delay", &trace.opts.initial_delay, 4791 + OPT_INTEGER('D', "delay", &trace.opts.target.initial_delay, 4792 4792 "ms to wait before starting measurement after program " 4793 4793 "start"), 4794 4794 OPTS_EVSWITCH(&trace.evswitch),
+3 -3
tools/perf/util/evlist.c
··· 2262 2262 if (unset) 2263 2263 return 0; 2264 2264 2265 - opts->initial_delay = str_to_delay(str); 2266 - if (opts->initial_delay) 2265 + opts->target.initial_delay = str_to_delay(str); 2266 + if (opts->target.initial_delay) 2267 2267 return 0; 2268 2268 2269 2269 ret = parse_event_enable_times(str, NULL); ··· 2306 2306 2307 2307 eet->evlist = evlist; 2308 2308 evlist->eet = eet; 2309 - opts->initial_delay = eet->times[0].start; 2309 + opts->target.initial_delay = eet->times[0].start; 2310 2310 2311 2311 return 0; 2312 2312
+1 -1
tools/perf/util/evsel.c
··· 1334 1334 * group leaders for traced executed by perf. 1335 1335 */ 1336 1336 if (target__none(&opts->target) && evsel__is_group_leader(evsel) && 1337 - !opts->initial_delay) 1337 + !opts->target.initial_delay) 1338 1338 attr->enable_on_exec = 1; 1339 1339 1340 1340 if (evsel->immediate) {
-1
tools/perf/util/record.h
··· 65 65 const char *auxtrace_snapshot_opts; 66 66 const char *auxtrace_sample_opts; 67 67 bool sample_transaction; 68 - int initial_delay; 69 68 bool use_clockid; 70 69 clockid_t clockid; 71 70 u64 clockid_res_ns;