mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 06:04:23 +08:00
perf record: Fix sample cgroup & namespace tracking
The recent change in 'struct perf_tool' constification broke the cgroup
and/or namespace tracking by resetting tool fields. It should set the
values after perf_tool__init().
Fixes: cecb1cf154
("perf record: Use perf_tool__init()")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240818212948.2873156-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
05c4cfeba0
commit
3432bae89e
@ -2374,13 +2374,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
|
||||
signal(SIGTERM, sig_handler);
|
||||
signal(SIGSEGV, sigsegv_handler);
|
||||
|
||||
if (rec->opts.record_namespaces)
|
||||
tool->namespace_events = true;
|
||||
|
||||
if (rec->opts.record_cgroup) {
|
||||
#ifdef HAVE_FILE_HANDLE
|
||||
tool->cgroup_events = true;
|
||||
#else
|
||||
#ifndef HAVE_FILE_HANDLE
|
||||
pr_err("cgroup tracking is not supported\n");
|
||||
return -1;
|
||||
#endif
|
||||
@ -2406,6 +2401,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
|
||||
tool->mmap2 = build_id__process_mmap2;
|
||||
tool->itrace_start = process_timestamp_boundary;
|
||||
tool->aux = process_timestamp_boundary;
|
||||
tool->namespace_events = rec->opts.record_namespaces;
|
||||
tool->cgroup_events = rec->opts.record_cgroup;
|
||||
session = perf_session__new(data, tool);
|
||||
if (IS_ERR(session)) {
|
||||
pr_err("Perf session creation failed.\n");
|
||||
|
Loading…
Reference in New Issue
Block a user