trace-event.h 2.8 KB

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