perf machine: Add kernel_dso() method

To reduce boilerplate in some places.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-9s1bgoxxhlnu037e1nqx0tw3@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b0c76fc4
...@@ -42,6 +42,11 @@ ...@@ -42,6 +42,11 @@
static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock); static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock);
static struct dso *machine__kernel_dso(struct machine *machine)
{
return machine->vmlinux_map->dso;
}
static void dsos__init(struct dsos *dsos) static void dsos__init(struct dsos *dsos)
{ {
INIT_LIST_HEAD(&dsos->head); INIT_LIST_HEAD(&dsos->head);
...@@ -861,7 +866,7 @@ size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp) ...@@ -861,7 +866,7 @@ size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp)
{ {
int i; int i;
size_t printed = 0; size_t printed = 0;
struct dso *kdso = machine__kernel_map(machine)->dso; struct dso *kdso = machine__kernel_dso(machine);
if (kdso->has_build_id) { if (kdso->has_build_id) {
char filename[PATH_MAX]; char filename[PATH_MAX];
...@@ -1543,8 +1548,7 @@ static bool perf_event__is_extra_kernel_mmap(struct machine *machine, ...@@ -1543,8 +1548,7 @@ static bool perf_event__is_extra_kernel_mmap(struct machine *machine,
static int machine__process_extra_kernel_map(struct machine *machine, static int machine__process_extra_kernel_map(struct machine *machine,
union perf_event *event) union perf_event *event)
{ {
struct map *kernel_map = machine__kernel_map(machine); struct dso *kernel = machine__kernel_dso(machine);
struct dso *kernel = kernel_map ? kernel_map->dso : NULL;
struct extra_kernel_map xm = { struct extra_kernel_map xm = {
.start = event->mmap.start, .start = event->mmap.start,
.end = event->mmap.start + event->mmap.len, .end = event->mmap.start + event->mmap.len,
......
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