perf dso: Add dso__has_symbols() method
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: d88205db9caa0e9d42dde8ff6c2fa0c7b57cd11d Gitweb: https://git.kernel.org/tip/d88205db9caa0e9d42dde8ff6c2fa0c7b57cd11d Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Mon, 23 Apr 2018 17:08:02 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 26 Apr 2018 13:47:05 -0300
perf dso: Add dso__has_symbols() method
To replace longer code sequences in various places.
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-top.c | 4 ++-- tools/perf/util/dso.h | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-)
tools/perf/builtin-report.c +1 -1
@@ -525,7 +525,7 @@ static void report__warn_kptr_restrict(const struct report *rep)if (kernel_map) {const struct dso *kdso = kernel_map->dso; -if (!RB_EMPTY_ROOT (&kdso->symbols[MAP__FUNCTION ])) { +if (dso__has_symbols (kdso,MAP__FUNCTION )) { desc ="If some relocation was applied (e.g. " "kexec) symbols may be misresolved." ; }
tools/perf/builtin-top.c +2 -2
@@ -742,7 +742,7 @@ static void perf_event__process_sample(struct perf_tool *tool,"Kernel address maps (/proc/{kallsyms,modules}) are restricted.\n\n" "Check /proc/sys/kernel/kptr_restrict.\n\n" "Kernel%s samples will not be resolved.\n" , - al.map && !RB_EMPTY_ROOT (&al.map->dso->symbols[MAP__FUNCTION ]) ? + al.map &&dso__has_symbols (al.map->dso,MAP__FUNCTION ) ? " modules" : "");if (use_browser <=0 )sleep (5 );
@@ -765,7 +765,7 @@ static void perf_event__process_sample(struct perf_tool *tool,*/ if (!machine->kptr_restrict_warned && !top->vmlinux_warned &&__map__is_kernel (al.map) && -RB_EMPTY_ROOT (&al.map->dso->symbols[MAP__FUNCTION ])) { +dso__has_symbols (al.map->dso,MAP__FUNCTION )) {if (symbol_conf.vmlinux_name) {char serr[256 ];dso__strerror_load (al.map->dso, serr,sizeof (serr));
tools/perf/util/dso.h +5 -0
@@ -233,6 +233,11 @@ static inline void __dso__zput(struct dso **dso)bool dso__loaded (const struct dso *dso,enum map_type type); +static inline bool dso__has_symbols (const struct dso *dso,enum map_type type) +{ +return !RB_EMPTY_ROOT (&dso->symbols[type]); +} +bool dso__sorted_by_name (const struct dso *dso,enum map_type type);void dso__set_sorted_by_name (struct dso *dso,enum map_type type);void dso__sort_by_name (struct dso *dso,enum map_type type);