18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef PERF_BUILD_ID_H_ 38c2ecf20Sopenharmony_ci#define PERF_BUILD_ID_H_ 1 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#define BUILD_ID_SIZE 20 68c2ecf20Sopenharmony_ci#define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1) 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include "tool.h" 98c2ecf20Sopenharmony_ci#include <linux/types.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistruct build_id { 128c2ecf20Sopenharmony_ci u8 data[BUILD_ID_SIZE]; 138c2ecf20Sopenharmony_ci size_t size; 148c2ecf20Sopenharmony_ci}; 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cistruct nsinfo; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciextern struct perf_tool build_id__mark_dso_hit_ops; 198c2ecf20Sopenharmony_cistruct dso; 208c2ecf20Sopenharmony_cistruct feat_fd; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_civoid build_id__init(struct build_id *bid, const u8 *data, size_t size); 238c2ecf20Sopenharmony_ciint build_id__sprintf(const struct build_id *build_id, char *bf); 248c2ecf20Sopenharmony_ciint sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id); 258c2ecf20Sopenharmony_ciint filename__sprintf_build_id(const char *pathname, char *sbuild_id); 268c2ecf20Sopenharmony_cichar *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf, 278c2ecf20Sopenharmony_ci size_t size); 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cichar *dso__build_id_filename(const struct dso *dso, char *bf, size_t size, 308c2ecf20Sopenharmony_ci bool is_debug); 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciint build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, 338c2ecf20Sopenharmony_ci struct perf_sample *sample, struct evsel *evsel, 348c2ecf20Sopenharmony_ci struct machine *machine); 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciint dsos__hit_all(struct perf_session *session); 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciint perf_event__inject_buildid(struct perf_tool *tool, union perf_event *event, 398c2ecf20Sopenharmony_ci struct perf_sample *sample, struct evsel *evsel, 408c2ecf20Sopenharmony_ci struct machine *machine); 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cibool perf_session__read_build_ids(struct perf_session *session, bool with_hits); 438c2ecf20Sopenharmony_ciint perf_session__write_buildid_table(struct perf_session *session, 448c2ecf20Sopenharmony_ci struct feat_fd *fd); 458c2ecf20Sopenharmony_ciint perf_session__cache_build_ids(struct perf_session *session); 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cichar *build_id_cache__origname(const char *sbuild_id); 488c2ecf20Sopenharmony_cichar *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size); 498c2ecf20Sopenharmony_cichar *build_id_cache__cachedir(const char *sbuild_id, const char *name, 508c2ecf20Sopenharmony_ci struct nsinfo *nsi, bool is_kallsyms, 518c2ecf20Sopenharmony_ci bool is_vdso); 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistruct strlist; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistruct strlist *build_id_cache__list_all(bool validonly); 568c2ecf20Sopenharmony_cichar *build_id_cache__complement(const char *incomplete_sbuild_id); 578c2ecf20Sopenharmony_ciint build_id_cache__list_build_ids(const char *pathname, struct nsinfo *nsi, 588c2ecf20Sopenharmony_ci struct strlist **result); 598c2ecf20Sopenharmony_cibool build_id_cache__cached(const char *sbuild_id); 608c2ecf20Sopenharmony_ciint build_id_cache__add_s(const char *sbuild_id, 618c2ecf20Sopenharmony_ci const char *name, struct nsinfo *nsi, 628c2ecf20Sopenharmony_ci bool is_kallsyms, bool is_vdso); 638c2ecf20Sopenharmony_ciint build_id_cache__remove_s(const char *sbuild_id); 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ciextern char buildid_dir[]; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_civoid set_buildid_dir(const char *dir); 688c2ecf20Sopenharmony_civoid disable_buildid_cache(void); 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#endif 71