trace-event.h 2.6 KB

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