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

Commit 75be6cf4 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar
Browse files

perf symbols: Make symbol_conf global



This simplifies a lot of functions, less stuff to be done by
tool writers.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260914682-29652-1-git-send-email-acme@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7ef17aaf
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -51,11 +51,6 @@ struct sym_priv {
	struct sym_ext	*ext;
};

static struct symbol_conf symbol_conf = {
	.priv_size	  = sizeof(struct sym_priv),
	.try_vmlinux_path = true,
};

static const char *sym_hist_filter;

static int symbol_filter(struct map *map __used, struct symbol *sym)
@@ -464,10 +459,10 @@ static struct perf_event_ops event_ops = {

static int __cmd_annotate(void)
{
	struct perf_session *session = perf_session__new(input_name, O_RDONLY,
							 force, &symbol_conf);
	int ret;
	struct perf_session *session;

	session = perf_session__new(input_name, O_RDONLY, force);
	if (session == NULL)
		return -ENOMEM;

@@ -523,7 +518,10 @@ static const struct option options[] = {

int cmd_annotate(int argc, const char **argv, const char *prefix __used)
{
	if (symbol__init(&symbol_conf) < 0)
	symbol_conf.priv_size = sizeof(struct sym_priv);
	symbol_conf.try_vmlinux_path = true;

	if (symbol__init() < 0)
		return -1;

	argc = parse_options(argc, argv, options, annotate_usage, 0);
+3 −2
Original line number Diff line number Diff line
@@ -54,8 +54,9 @@ static int perf_file_section__process_buildids(struct perf_file_section *self,
static int __cmd_buildid_list(void)
{
	int err = -1;
	struct perf_session *session = perf_session__new(input_name, O_RDONLY,
							 force, NULL);
	struct perf_session *session;

	session = perf_session__new(input_name, O_RDONLY, force);
	if (session == NULL)
		return -1;

+3 −5
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@ static char const *input_old = "perf.data.old",
static int	   force;
static bool 	   show_percent;

struct symbol_conf symbol_conf;

static int perf_session__add_hist_entry(struct perf_session *self,
					struct addr_location *al, u64 count)
{
@@ -226,8 +224,8 @@ static int __cmd_diff(void)
	int ret, i;
	struct perf_session *session[2];

	session[0] = perf_session__new(input_old, O_RDONLY, force, &symbol_conf);
	session[1] = perf_session__new(input_new, O_RDONLY, force, &symbol_conf);
	session[0] = perf_session__new(input_old, O_RDONLY, force);
	session[1] = perf_session__new(input_new, O_RDONLY, force);
	if (session[0] == NULL || session[1] == NULL)
		return -ENOMEM;

@@ -267,7 +265,7 @@ static const struct option options[] = {

int cmd_diff(int argc, const char **argv, const char *prefix __used)
{
	if (symbol__init(&symbol_conf) < 0)
	if (symbol__init() < 0)
		return -1;

	setup_sorting(diff_usage, options);
+2 −3
Original line number Diff line number Diff line
@@ -505,8 +505,7 @@ static void sort_result(void)
static int __cmd_kmem(void)
{
	int err;
	struct perf_session *session = perf_session__new(input_name, O_RDONLY,
							 0, NULL);
	struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
	if (session == NULL)
		return -ENOMEM;

@@ -767,7 +766,7 @@ static int __cmd_record(int argc, const char **argv)

int cmd_kmem(int argc, const char **argv, const char *prefix __used)
{
	symbol__init(0);
	symbol__init();

	argc = parse_options(argc, argv, kmem_options, kmem_usage, 0);

+6 −8
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@ static struct {
	int nr_probe;
	struct probe_point probes[MAX_PROBES];
	struct strlist *dellist;
	struct symbol_conf conf;
	struct perf_session *psession;
	struct map *kmap;
} session;
@@ -151,7 +150,7 @@ static const struct option options[] = {
	OPT_BOOLEAN('v', "verbose", &verbose,
		    "be more verbose (show parsed arguments, etc)"),
#ifndef NO_LIBDWARF
	OPT_STRING('k', "vmlinux", &session.conf.vmlinux_name,
	OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
		   "file", "vmlinux pathname"),
#endif
	OPT_BOOLEAN('l', "list", &session.list_events,
@@ -224,13 +223,12 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
	}

	/* Initialize symbol maps for vmlinux */
	session.conf.sort_by_name = true;
	if (session.conf.vmlinux_name == NULL)
		session.conf.try_vmlinux_path = true;
	if (symbol__init(&session.conf) < 0)
	symbol_conf.sort_by_name = true;
	if (symbol_conf.vmlinux_name == NULL)
		symbol_conf.try_vmlinux_path = true;
	if (symbol__init() < 0)
		die("Failed to init symbol map.");
	session.psession = perf_session__new(NULL, O_WRONLY, false,
					     &session.conf);
	session.psession = perf_session__new(NULL, O_WRONLY, false);
	if (session.psession == NULL)
		die("Failed to init perf_session.");
	session.kmap = map_groups__find_by_name(&session.psession->kmaps,
Loading