trace-event.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef _PERF_UTIL_TRACE_EVENT_H
  2. #define _PERF_UTIL_TRACE_EVENT_H
  3. #include <traceevent/event-parse.h>
  4. #include "parse-events.h"
  5. struct machine;
  6. struct perf_sample;
  7. union perf_event;
  8. struct perf_tool;
  9. struct thread;
  10. struct plugin_list;
  11. struct trace_event {
  12. struct pevent *pevent;
  13. struct plugin_list *plugin_list;
  14. };
  15. int trace_event__init(struct trace_event *t);
  16. void trace_event__cleanup(struct trace_event *t);
  17. int trace_event__register_resolver(struct machine *machine,
  18. pevent_func_resolver_t *func);
  19. struct event_format*
  20. trace_event__tp_format(const char *sys, const char *name);
  21. struct event_format *trace_event__tp_format_id(int id);
  22. int bigendian(void);
  23. void event_format__fprintf(struct event_format *event,
  24. int cpu, void *data, int size, FILE *fp);
  25. void event_format__print(struct event_format *event,
  26. int cpu, void *data, int size);
  27. int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
  28. int parse_event_file(struct pevent *pevent,
  29. char *buf, unsigned long size, char *sys);
  30. unsigned long long
  31. raw_field_value(struct event_format *event, const char *name, void *data);
  32. void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
  33. void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
  34. ssize_t trace_report(int fd, struct trace_event *tevent, bool repipe);
  35. struct event_format *trace_find_next_event(struct pevent *pevent,
  36. struct event_format *event);
  37. unsigned long long read_size(struct event_format *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 perf_evsel *evsel,
  60. struct addr_location *al);
  61. void (*process_stat)(struct perf_stat_config *config,
  62. struct perf_evsel *evsel, u64 tstamp);
  63. void (*process_stat_interval)(u64 tstamp);
  64. int (*generate_script) (struct pevent *pevent, const char *outfile);
  65. };
  66. extern unsigned int scripting_max_stack;
  67. int script_spec_register(const char *spec, struct scripting_ops *ops);
  68. void setup_perl_scripting(void);
  69. void setup_python_scripting(void);
  70. struct scripting_context {
  71. struct pevent *pevent;
  72. void *event_data;
  73. };
  74. int common_pc(struct scripting_context *context);
  75. int common_flags(struct scripting_context *context);
  76. int common_lock_depth(struct scripting_context *context);
  77. #endif /* _PERF_UTIL_TRACE_EVENT_H */