probe-file.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef __PROBE_FILE_H
  2. #define __PROBE_FILE_H
  3. #include "strlist.h"
  4. #include "strfilter.h"
  5. #include "probe-event.h"
  6. /* Cache of probe definitions */
  7. struct probe_cache_entry {
  8. struct list_head node;
  9. bool sdt;
  10. struct perf_probe_event pev;
  11. char *spev;
  12. struct strlist *tevlist;
  13. };
  14. struct probe_cache {
  15. int fd;
  16. struct list_head entries;
  17. };
  18. enum probe_type {
  19. PROBE_TYPE_U = 0,
  20. PROBE_TYPE_S,
  21. PROBE_TYPE_X,
  22. PROBE_TYPE_STRING,
  23. PROBE_TYPE_BITFIELD,
  24. PROBE_TYPE_END,
  25. };
  26. #define PF_FL_UPROBE 1
  27. #define PF_FL_RW 2
  28. #define for_each_probe_cache_entry(entry, pcache) \
  29. list_for_each_entry(entry, &pcache->entries, node)
  30. /* probe-file.c depends on libelf */
  31. #ifdef HAVE_LIBELF_SUPPORT
  32. int probe_file__open(int flag);
  33. int probe_file__open_both(int *kfd, int *ufd, int flag);
  34. struct strlist *probe_file__get_namelist(int fd);
  35. struct strlist *probe_file__get_rawlist(int fd);
  36. int probe_file__add_event(int fd, struct probe_trace_event *tev);
  37. int probe_file__del_events(int fd, struct strfilter *filter);
  38. int probe_file__get_events(int fd, struct strfilter *filter,
  39. struct strlist *plist);
  40. int probe_file__del_strlist(int fd, struct strlist *namelist);
  41. int probe_cache_entry__get_event(struct probe_cache_entry *entry,
  42. struct probe_trace_event **tevs);
  43. struct probe_cache *probe_cache__new(const char *target);
  44. int probe_cache__add_entry(struct probe_cache *pcache,
  45. struct perf_probe_event *pev,
  46. struct probe_trace_event *tevs, int ntevs);
  47. int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname);
  48. int probe_cache__commit(struct probe_cache *pcache);
  49. void probe_cache__purge(struct probe_cache *pcache);
  50. void probe_cache__delete(struct probe_cache *pcache);
  51. int probe_cache__filter_purge(struct probe_cache *pcache,
  52. struct strfilter *filter);
  53. struct probe_cache_entry *probe_cache__find(struct probe_cache *pcache,
  54. struct perf_probe_event *pev);
  55. struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
  56. const char *group, const char *event);
  57. int probe_cache__show_all_caches(struct strfilter *filter);
  58. bool probe_type_is_available(enum probe_type type);
  59. #else /* ! HAVE_LIBELF_SUPPORT */
  60. static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused)
  61. {
  62. return NULL;
  63. }
  64. #define probe_cache__delete(pcache) do {} while (0)
  65. #endif
  66. #endif