probe-file.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 open_trace_file(const char *trace_file, bool readwrite);
  33. int probe_file__open(int flag);
  34. int probe_file__open_both(int *kfd, int *ufd, int flag);
  35. struct strlist *probe_file__get_namelist(int fd);
  36. struct strlist *probe_file__get_rawlist(int fd);
  37. int probe_file__add_event(int fd, struct probe_trace_event *tev);
  38. int probe_file__del_events(int fd, struct strfilter *filter);
  39. int probe_file__get_events(int fd, struct strfilter *filter,
  40. struct strlist *plist);
  41. int probe_file__del_strlist(int fd, struct strlist *namelist);
  42. int probe_cache_entry__get_event(struct probe_cache_entry *entry,
  43. struct probe_trace_event **tevs);
  44. struct probe_cache *probe_cache__new(const char *target);
  45. int probe_cache__add_entry(struct probe_cache *pcache,
  46. struct perf_probe_event *pev,
  47. struct probe_trace_event *tevs, int ntevs);
  48. int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname);
  49. int probe_cache__commit(struct probe_cache *pcache);
  50. void probe_cache__purge(struct probe_cache *pcache);
  51. void probe_cache__delete(struct probe_cache *pcache);
  52. int probe_cache__filter_purge(struct probe_cache *pcache,
  53. struct strfilter *filter);
  54. struct probe_cache_entry *probe_cache__find(struct probe_cache *pcache,
  55. struct perf_probe_event *pev);
  56. struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
  57. const char *group, const char *event);
  58. int probe_cache__show_all_caches(struct strfilter *filter);
  59. bool probe_type_is_available(enum probe_type type);
  60. bool kretprobe_offset_is_supported(void);
  61. #else /* ! HAVE_LIBELF_SUPPORT */
  62. static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused)
  63. {
  64. return NULL;
  65. }
  66. #define probe_cache__delete(pcache) do {} while (0)
  67. #endif
  68. #endif