mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
perf kmem: Use perf_tool__init
Reduce the scope of the tool from global/static to just that of the cmd_kmem function where the session is scoped. Use the perf_tool__init() to initialize default values. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Jonathan Cameron <jonathan.cameron@huawei.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Nick Terrell <terrelln@fb.com> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <song@kernel.org> Cc: Sun Haiyong <sunhaiyong@loongson.cn> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Yanteng Si <siyanteng@loongson.cn> Cc: Yicong Yang <yangyicong@hisilicon.com> Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20240812204720.631678-7-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ae737b6102
commit
f32b37cc78
@ -986,15 +986,6 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused,
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct perf_tool perf_kmem = {
|
||||
.sample = process_sample_event,
|
||||
.comm = perf_event__process_comm,
|
||||
.mmap = perf_event__process_mmap,
|
||||
.mmap2 = perf_event__process_mmap2,
|
||||
.namespaces = perf_event__process_namespaces,
|
||||
.ordered_events = true,
|
||||
};
|
||||
|
||||
static double fragmentation(unsigned long n_req, unsigned long n_alloc)
|
||||
{
|
||||
if (n_alloc == 0)
|
||||
@ -1971,6 +1962,7 @@ int cmd_kmem(int argc, const char **argv)
|
||||
NULL
|
||||
};
|
||||
struct perf_session *session;
|
||||
struct perf_tool perf_kmem;
|
||||
static const char errmsg[] = "No %s allocation events found. Have you run 'perf kmem record --%s'?\n";
|
||||
int ret = perf_config(kmem_config, NULL);
|
||||
|
||||
@ -1998,6 +1990,13 @@ int cmd_kmem(int argc, const char **argv)
|
||||
|
||||
data.path = input_name;
|
||||
|
||||
perf_tool__init(&perf_kmem, /*ordered_events=*/true);
|
||||
perf_kmem.sample = process_sample_event;
|
||||
perf_kmem.comm = perf_event__process_comm;
|
||||
perf_kmem.mmap = perf_event__process_mmap;
|
||||
perf_kmem.mmap2 = perf_event__process_mmap2;
|
||||
perf_kmem.namespaces = perf_event__process_namespaces;
|
||||
|
||||
kmem_session = session = perf_session__new(&data, &perf_kmem);
|
||||
if (IS_ERR(session))
|
||||
return PTR_ERR(session);
|
||||
|
Loading…
Reference in New Issue
Block a user