Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d132caa authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf machine: Add a kallsyms loading constructor

To reduce the boilerplate for searching for functions in the running
kernel and modules.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-93iqzayafpaxaguoiwjqezgz@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent d5f805c0
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -87,6 +87,25 @@ struct machine *machine__new_host(void)
	return NULL;
	return NULL;
}
}


struct machine *machine__new_kallsyms(void)
{
	struct machine *machine = machine__new_host();
	/*
	 * FIXME:
	 * 1) MAP__FUNCTION will go away when we stop loading separate maps for
	 *    functions and data objects.
	 * 2) We should switch to machine__load_kallsyms(), i.e. not explicitely
	 *    ask for not using the kcore parsing code, once this one is fixed
	 *    to create a map per module.
	 */
	if (machine && __machine__load_kallsyms(machine, "/proc/kallsyms", MAP__FUNCTION, true) <= 0) {
		machine__delete(machine);
		machine = NULL;
	}

	return machine;
}

static void dsos__purge(struct dsos *dsos)
static void dsos__purge(struct dsos *dsos)
{
{
	struct dso *pos, *n;
	struct dso *pos, *n;
+1 −0
Original line number Original line Diff line number Diff line
@@ -129,6 +129,7 @@ char *machine__mmap_name(struct machine *machine, char *bf, size_t size);
void machines__set_comm_exec(struct machines *machines, bool comm_exec);
void machines__set_comm_exec(struct machines *machines, bool comm_exec);


struct machine *machine__new_host(void);
struct machine *machine__new_host(void);
struct machine *machine__new_kallsyms(void);
int machine__init(struct machine *machine, const char *root_dir, pid_t pid);
int machine__init(struct machine *machine, const char *root_dir, pid_t pid);
void machine__exit(struct machine *machine);
void machine__exit(struct machine *machine);
void machine__delete_threads(struct machine *machine);
void machine__delete_threads(struct machine *machine);