trace-event.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 thread;
  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. int read_trace_init(int file_bigendian, int host_bigendian);
  25. void print_trace_event(int cpu, void *data, int size);
  26. void print_event(int cpu, void *data, int size, unsigned long long nsecs,
  27. char *comm);
  28. int parse_ftrace_file(char *buf, unsigned long size);
  29. int parse_event_file(char *buf, unsigned long size, char *sys);
  30. struct pevent_record *trace_peek_data(int cpu);
  31. struct event_format *trace_find_event(int type);
  32. unsigned long long
  33. raw_field_value(struct event_format *event, const char *name, void *data);
  34. void *raw_field_ptr(struct event_format *event, const char *name, void *data);
  35. void parse_proc_kallsyms(char *file, unsigned int size __unused);
  36. void parse_ftrace_printk(char *file, unsigned int size __unused);
  37. ssize_t trace_report(int fd, bool repipe);
  38. int trace_parse_common_type(void *data);
  39. int trace_parse_common_pid(void *data);
  40. struct event_format *trace_find_next_event(struct event_format *event);
  41. unsigned long long read_size(void *ptr, int size);
  42. unsigned long long eval_flag(const char *flag);
  43. struct pevent_record *trace_read_data(int cpu);
  44. int read_tracing_data(int fd, struct list_head *pattrs);
  45. struct tracing_data {
  46. /* size is only valid if temp is 'true' */
  47. ssize_t size;
  48. bool temp;
  49. char temp_file[50];
  50. };
  51. struct tracing_data *tracing_data_get(struct list_head *pattrs,
  52. int fd, bool temp);
  53. void tracing_data_put(struct tracing_data *tdata);
  54. struct scripting_ops {
  55. const char *name;
  56. int (*start_script) (const char *script, int argc, const char **argv);
  57. int (*stop_script) (void);
  58. void (*process_event) (union perf_event *event,
  59. struct perf_sample *sample,
  60. struct perf_evsel *evsel,
  61. struct machine *machine,
  62. struct thread *thread);
  63. int (*generate_script) (const char *outfile);
  64. };
  65. int script_spec_register(const char *spec, struct scripting_ops *ops);
  66. void setup_perl_scripting(void);
  67. void setup_python_scripting(void);
  68. struct scripting_context {
  69. void *event_data;
  70. };
  71. int common_pc(struct scripting_context *context);
  72. int common_flags(struct scripting_context *context);
  73. int common_lock_depth(struct scripting_context *context);
  74. #endif /* _PERF_UTIL_TRACE_EVENT_H */