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

Commit 3183f8ca authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf symbols: Unify symbol maps

Remove the split of symbol tables for data (MAP__VARIABLE) and for
functions (MAP__FUNCTION), its unneeded and there were various places
doing two lookups to find a symbol, so simplify this.

We still will consider only the symbols that matched the filters in
place, i.e. see the (elf_(sec,sym)|symbol_type)__filter() routines in
the patch, just so that we consider only the same symbols as before,
to reduce the possibility of regressions.

All the tests on 50-something build environments, in varios versions
of lots of distros and cross build environments were performed without
build regressions, as usual with all pull requests the other tests were
also performed: 'perf test' and 'make -C tools/perf build-test'.

Also this was done at a great granularity so that regressions can be
bisected more easily.

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


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e9814df8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
		 */
		if (al->sym != NULL) {
			rb_erase(&al->sym->rb_node,
				 &al->map->dso->symbols[al->map->type]);
				 &al->map->dso->symbols);
			symbol__delete(al->sym);
			dso__reset_find_symbol_cache(al->map->dso);
		}
+1 −4
Original line number Diff line number Diff line
@@ -715,10 +715,7 @@ static size_t maps__fprintf_task(struct maps *maps, int indent, FILE *fp)

static int map_groups__fprintf_task(struct map_groups *mg, int indent, FILE *fp)
{
	int printed = 0, i;
	for (i = 0; i < MAP__NR_TYPES; ++i)
		printed += maps__fprintf_task(&mg->maps[i], indent, fp);
	return printed;
	return maps__fprintf_task(&mg->maps, indent, fp);
}

static void task__print_level(struct task *task, FILE *fp, int level)
+2 −2
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ struct machine *setup_fake_machine(struct machines *machines)
			goto out;

		/* emulate dso__load() */
		dso__set_loaded(dso, MAP__FUNCTION);
		dso__set_loaded(dso);

		for (k = 0; k < fake_symbols[i].nr_syms; k++) {
			struct symbol *sym;
@@ -144,7 +144,7 @@ struct machine *setup_fake_machine(struct machines *machines)
				goto out;
			}

			symbols__insert(&dso->symbols[MAP__FUNCTION], sym);
			symbols__insert(&dso->symbols, sym);
		}

		dso__put(dso);
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ int map__browse(struct map *map)
{
	struct map_browser mb = {
		.b = {
			.entries = &map->dso->symbols[map->type],
			.entries = &map->dso->symbols,
			.refresh = ui_browser__rb_tree_refresh,
			.seek	 = ui_browser__rb_tree_seek,
			.write	 = map_browser__write,
+1 −1
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ static int db_ids_from_al(struct db_export *dbe, struct addr_location *al,
		if (!al->sym) {
			al->sym = symbol__new(al->addr, 0, 0, 0, "unknown");
			if (al->sym)
				dso__insert_symbol(dso, al->map->type, al->sym);
				dso__insert_symbol(dso, al->sym);
		}

		if (al->sym) {
Loading