trace-event.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _PERF_UTIL_TRACE_EVENT_H
  3. #define _PERF_UTIL_TRACE_EVENT_H
  4. #include <traceevent/event-parse.h>
  5. #include "parse-events.h"
  6. struct machine;
  7. struct perf_sample;
  8. union perf_event;
  9. struct perf_tool;
  10. struct thread;
  11. struct tep_plugin_list;
  12. struct trace_event {
  13. struct tep_handle *pevent;
  14. struct tep_plugin_list *plugin_list;
  15. };
  16. int trace_event__init(struct trace_event *t);
  17. void trace_event__cleanup(struct trace_event *t);
  18. int trace_event__register_resolver(struct machine *machine,
  19. tep_func_resolver_t *func);
  20. struct tep_event*
  21. trace_event__tp_format(const char *sys, const char *name);
  22. struct tep_event *trace_event__tp_format_id(int id);
  23. int bigendian(void);
  24. void event_format__fprintf(struct tep_event *event,
  25. int cpu, void *data, int size, FILE *fp);
  26. void event_format__print(struct tep_event *event,
  27. int cpu, void *data, int size);
  28. int parse_ftrace_file(struct tep_handle *pevent, char *buf, unsigned long size);
  29. int parse_event_file(struct tep_handle *pevent,
  30. char *buf, unsigned long size, char *sys);
  31. unsigned long long
  32. raw_field_value(struct tep_event *event, const char *name, void *data);
  33. void parse_proc_kallsyms(struct tep_handle *pevent, char *file, unsigned int size);
  34. void parse_ftrace_printk(struct tep_handle *pevent, char *file, unsigned int size);
  35. void parse_saved_cmdline(struct tep_handle *pevent, char *file, unsigned int size);
  36. ssize_t trace_report(int fd, struct trace_event *tevent, bool repipe);
  37. unsigned long long read_size(struct tep_event *event, void *ptr, int size);
  38. unsigned long long eval_flag(const char *flag);
  39. int read_tracing_data(int fd, struct list_head *pattrs);
  40. struct tracing_data {
  41. /* size is only valid if temp is 'true' */
  42. ssize_t size;
  43. bool temp;
  44. char temp_file[50];
  45. };
  46. struct tracing_data *tracing_data_get(struct list_head *pattrs,
  47. int fd, bool temp);
  48. int tracing_data_put(struct tracing_data *tdata);
  49. struct addr_location;
  50. struct perf_session;
  51. struct perf_stat_config;
  52. struct scripting_ops {
  53. const char *name;
  54. int (*start_script) (const char *script, int argc, const char **argv);
  55. int (*flush_script) (void);
  56. int (*stop_script) (void);
  57. void (*process_event) (union perf_event *event,
  58. struct perf_sample *sample,
  59. struct evsel *evsel,
  60. struct addr_location *al);
  61. void (*process_switch)(union perf_event *event,
  62. struct perf_sample *sample,
  63. struct machine *machine);
  64. void (*process_stat)(struct perf_stat_config *config,
  65. struct evsel *evsel, u64 tstamp);
  66. void (*process_stat_interval)(u64 tstamp);
  67. int (*generate_script) (struct tep_handle *pevent, const char *outfile);
  68. };
  69. extern unsigned int scripting_max_stack;
  70. int script_spec_register(const char *spec, struct scripting_ops *ops);
  71. void setup_perl_scripting(void);
  72. void setup_python_scripting(void);
  73. struct scripting_context {
  74. struct tep_handle *pevent;
  75. void *event_data;
  76. };
  77. int common_pc(struct scripting_context *context);
  78. int common_flags(struct scripting_context *context);
  79. int common_lock_depth(struct scripting_context *context);
  80. #endif /* _PERF_UTIL_TRACE_EVENT_H */