trace-event.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. int bigendian(void);
  22. void event_format__fprintf(struct event_format *event,
  23. int cpu, void *data, int size, FILE *fp);
  24. void event_format__print(struct event_format *event,
  25. int cpu, void *data, int size);
  26. int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
  27. int parse_event_file(struct pevent *pevent,
  28. char *buf, unsigned long size, char *sys);
  29. unsigned long long
  30. raw_field_value(struct event_format *event, const char *name, void *data);
  31. void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
  32. void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
  33. ssize_t trace_report(int fd, struct trace_event *tevent, bool repipe);
  34. struct event_format *trace_find_next_event(struct pevent *pevent,
  35. struct event_format *event);
  36. unsigned long long read_size(struct event_format *event, void *ptr, int size);
  37. unsigned long long eval_flag(const char *flag);
  38. int read_tracing_data(int fd, struct list_head *pattrs);
  39. struct tracing_data {
  40. /* size is only valid if temp is 'true' */
  41. ssize_t size;
  42. bool temp;
  43. char temp_file[50];
  44. };
  45. struct tracing_data *tracing_data_get(struct list_head *pattrs,
  46. int fd, bool temp);
  47. int tracing_data_put(struct tracing_data *tdata);
  48. struct addr_location;
  49. struct perf_session;
  50. struct scripting_ops {
  51. const char *name;
  52. int (*start_script) (const char *script, int argc, const char **argv);
  53. int (*flush_script) (void);
  54. int (*stop_script) (void);
  55. void (*process_event) (union perf_event *event,
  56. struct perf_sample *sample,
  57. struct perf_evsel *evsel,
  58. struct addr_location *al);
  59. int (*generate_script) (struct pevent *pevent, const char *outfile);
  60. };
  61. extern unsigned int scripting_max_stack;
  62. int script_spec_register(const char *spec, struct scripting_ops *ops);
  63. void setup_perl_scripting(void);
  64. void setup_python_scripting(void);
  65. struct scripting_context {
  66. struct pevent *pevent;
  67. void *event_data;
  68. };
  69. int common_pc(struct scripting_context *context);
  70. int common_flags(struct scripting_context *context);
  71. int common_lock_depth(struct scripting_context *context);
  72. #endif /* _PERF_UTIL_TRACE_EVENT_H */