trace-event.h 3.1 KB

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