parse-events.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef __PERF_PARSE_EVENTS_H
  2. #define __PERF_PARSE_EVENTS_H
  3. /*
  4. * Parse symbolic events/counts passed in as options:
  5. */
  6. #include "../../../include/linux/perf_event.h"
  7. struct list_head;
  8. struct perf_evsel;
  9. struct perf_evlist;
  10. struct option;
  11. struct tracepoint_path {
  12. char *system;
  13. char *name;
  14. struct tracepoint_path *next;
  15. };
  16. extern struct tracepoint_path *tracepoint_id_to_path(u64 config);
  17. extern bool have_tracepoints(struct list_head *evlist);
  18. const char *event_type(int type);
  19. const char *event_name(struct perf_evsel *event);
  20. extern const char *__event_name(int type, u64 config, char *name);
  21. extern int parse_events_option(const struct option *opt, const char *str,
  22. int unset);
  23. extern int parse_events(struct perf_evlist *evlist, const char *str,
  24. int unset);
  25. extern int parse_filter(const struct option *opt, const char *str, int unset);
  26. #define EVENTS_HELP_MAX (128*1024)
  27. enum {
  28. PARSE_EVENTS__TERM_TYPE_CONFIG,
  29. PARSE_EVENTS__TERM_TYPE_CONFIG1,
  30. PARSE_EVENTS__TERM_TYPE_CONFIG2,
  31. PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
  32. PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
  33. PARSE_EVENTS__TERM_TYPE_NUM,
  34. PARSE_EVENTS__TERM_TYPE_STR,
  35. PARSE_EVENTS__TERM_TYPE_HARDCODED_MAX =
  36. PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
  37. };
  38. struct parse_events__term {
  39. char *config;
  40. union {
  41. char *str;
  42. long num;
  43. } val;
  44. int type;
  45. struct list_head list;
  46. };
  47. int parse_events__is_hardcoded_term(struct parse_events__term *term);
  48. int parse_events__new_term(struct parse_events__term **term, int type,
  49. char *config, char *str, long num);
  50. void parse_events__free_terms(struct list_head *terms);
  51. int parse_events_modifier(struct list_head *list __used, char *str __used);
  52. int parse_events_add_tracepoint(struct list_head *list, int *idx,
  53. char *sys, char *event);
  54. int parse_events_add_raw(struct perf_evlist *evlist, unsigned long config,
  55. unsigned long config1, unsigned long config2,
  56. char *mod);
  57. int parse_events_add_numeric_legacy(struct list_head *list, int *idx,
  58. const char *name, unsigned long config,
  59. struct list_head *head_config);
  60. int parse_events_add_numeric(struct list_head *list, int *idx,
  61. unsigned long type, unsigned long config,
  62. struct list_head *head_config);
  63. int parse_events_add_cache(struct list_head *list, int *idx,
  64. char *type, char *op_result1, char *op_result2);
  65. int parse_events_add_breakpoint(struct list_head *list, int *idx,
  66. void *ptr, char *type);
  67. int parse_events_add_pmu(struct list_head *list, int *idx,
  68. char *pmu , struct list_head *head_config);
  69. void parse_events_update_lists(struct list_head *list_event,
  70. struct list_head *list_all);
  71. void parse_events_error(struct list_head *list_all,
  72. struct list_head *list_event,
  73. int *idx, char const *msg);
  74. void print_events(const char *event_glob);
  75. void print_events_type(u8 type);
  76. void print_tracepoint_events(const char *subsys_glob, const char *event_glob);
  77. int print_hwcache_events(const char *event_glob);
  78. extern int is_valid_tracepoint(const char *event_string);
  79. extern int valid_debugfs_mount(const char *debugfs);
  80. #endif /* __PERF_PARSE_EVENTS_H */