Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef PERF_BUILD_ID_H_
0003 #define PERF_BUILD_ID_H_ 1
0004 
0005 #define BUILD_ID_SIZE   20 /* SHA-1 length in bytes */
0006 #define BUILD_ID_MIN_SIZE   16 /* MD5/UUID/GUID length in bytes */
0007 #define SBUILD_ID_SIZE  (BUILD_ID_SIZE * 2 + 1)
0008 #define SBUILD_ID_MIN_SIZE  (BUILD_ID_MIN_SIZE * 2 + 1)
0009 
0010 #include "machine.h"
0011 #include "tool.h"
0012 #include <linux/types.h>
0013 
0014 struct build_id {
0015     u8  data[BUILD_ID_SIZE];
0016     size_t  size;
0017 };
0018 
0019 struct nsinfo;
0020 
0021 extern struct perf_tool build_id__mark_dso_hit_ops;
0022 struct dso;
0023 struct feat_fd;
0024 
0025 void build_id__init(struct build_id *bid, const u8 *data, size_t size);
0026 int build_id__sprintf(const struct build_id *build_id, char *bf);
0027 bool build_id__is_defined(const struct build_id *bid);
0028 int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id);
0029 int filename__sprintf_build_id(const char *pathname, char *sbuild_id);
0030 char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf,
0031                     size_t size);
0032 
0033 char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size,
0034                  bool is_debug);
0035 char *__dso__build_id_filename(const struct dso *dso, char *bf, size_t size,
0036                    bool is_debug, bool is_kallsyms);
0037 
0038 int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
0039                struct perf_sample *sample, struct evsel *evsel,
0040                struct machine *machine);
0041 
0042 int dsos__hit_all(struct perf_session *session);
0043 
0044 int perf_event__inject_buildid(struct perf_tool *tool, union perf_event *event,
0045                    struct perf_sample *sample, struct evsel *evsel,
0046                    struct machine *machine);
0047 
0048 bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
0049 int perf_session__write_buildid_table(struct perf_session *session,
0050                       struct feat_fd *fd);
0051 int perf_session__cache_build_ids(struct perf_session *session);
0052 int __perf_session__cache_build_ids(struct perf_session *session,
0053                     machine__dso_t fn, void *priv);
0054 
0055 char *build_id_cache__origname(const char *sbuild_id);
0056 char *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size);
0057 char *build_id_cache__cachedir(const char *sbuild_id, const char *name,
0058                    struct nsinfo *nsi, bool is_kallsyms,
0059                    bool is_vdso);
0060 
0061 struct strlist;
0062 
0063 struct strlist *build_id_cache__list_all(bool validonly);
0064 char *build_id_cache__complement(const char *incomplete_sbuild_id);
0065 int build_id_cache__list_build_ids(const char *pathname, struct nsinfo *nsi,
0066                    struct strlist **result);
0067 bool build_id_cache__cached(const char *sbuild_id);
0068 int build_id_cache__add(const char *sbuild_id, const char *name, const char *realname,
0069             struct nsinfo *nsi, bool is_kallsyms, bool is_vdso,
0070             const char *proper_name, const char *root_dir);
0071 int __build_id_cache__add_s(const char *sbuild_id,
0072                 const char *name, struct nsinfo *nsi,
0073                 bool is_kallsyms, bool is_vdso,
0074                 const char *proper_name, const char *root_dir);
0075 static inline int build_id_cache__add_s(const char *sbuild_id,
0076                     const char *name, struct nsinfo *nsi,
0077                     bool is_kallsyms, bool is_vdso)
0078 {
0079     return __build_id_cache__add_s(sbuild_id, name, nsi, is_kallsyms, is_vdso, NULL, NULL);
0080 }
0081 int build_id_cache__remove_s(const char *sbuild_id);
0082 
0083 extern char buildid_dir[];
0084 
0085 void set_buildid_dir(const char *dir);
0086 void disable_buildid_cache(void);
0087 
0088 #endif