trace-event.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #include "session.h"
  6. struct machine;
  7. struct perf_sample;
  8. union perf_event;
  9. struct perf_tool;
  10. struct thread;
  11. extern struct pevent *perf_pevent;
  12. int bigendian(void);
  13. struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
  14. void event_format__print(struct event_format *event,
  15. int cpu, void *data, int size);
  16. int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
  17. int parse_event_file(struct pevent *pevent,
  18. char *buf, unsigned long size, char *sys);
  19. struct pevent_record *trace_peek_data(struct pevent *pevent, int cpu);
  20. unsigned long long
  21. raw_field_value(struct event_format *event, const char *name, void *data);
  22. void *raw_field_ptr(struct event_format *event, const char *name, void *data);
  23. void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
  24. void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
  25. ssize_t trace_report(int fd, struct pevent **pevent, bool repipe);
  26. int trace_parse_common_type(struct pevent *pevent, void *data);
  27. int trace_parse_common_pid(struct pevent *pevent, void *data);
  28. struct event_format *trace_find_next_event(struct pevent *pevent,
  29. struct event_format *event);
  30. unsigned long long read_size(struct event_format *event, void *ptr, int size);
  31. unsigned long long eval_flag(const char *flag);
  32. struct pevent_record *trace_read_data(struct pevent *pevent, int cpu);
  33. int read_tracing_data(int fd, struct list_head *pattrs);
  34. struct tracing_data {
  35. /* size is only valid if temp is 'true' */
  36. ssize_t size;
  37. bool temp;
  38. char temp_file[50];
  39. };
  40. struct tracing_data *tracing_data_get(struct list_head *pattrs,
  41. int fd, bool temp);
  42. int tracing_data_put(struct tracing_data *tdata);
  43. struct addr_location;
  44. struct perf_session;
  45. struct scripting_ops {
  46. const char *name;
  47. int (*start_script) (const char *script, int argc, const char **argv);
  48. int (*stop_script) (void);
  49. void (*process_event) (union perf_event *event,
  50. struct perf_sample *sample,
  51. struct perf_evsel *evsel,
  52. struct machine *machine,
  53. struct thread *thread,
  54. struct addr_location *al);
  55. int (*generate_script) (struct pevent *pevent, const char *outfile);
  56. };
  57. int script_spec_register(const char *spec, struct scripting_ops *ops);
  58. void setup_perl_scripting(void);
  59. void setup_python_scripting(void);
  60. struct scripting_context {
  61. struct pevent *pevent;
  62. void *event_data;
  63. };
  64. int common_pc(struct scripting_context *context);
  65. int common_flags(struct scripting_context *context);
  66. int common_lock_depth(struct scripting_context *context);
  67. #endif /* _PERF_UTIL_TRACE_EVENT_H */