linux/tools/perf/util/trace-event.h
<<
>>
Prefs
   1#ifndef _PERF_UTIL_TRACE_EVENT_H
   2#define _PERF_UTIL_TRACE_EVENT_H
   3
   4#include "parse-events.h"
   5#include "event-parse.h"
   6#include "session.h"
   7
   8struct machine;
   9struct perf_sample;
  10union perf_event;
  11struct perf_tool;
  12struct thread;
  13
  14extern int header_page_size_size;
  15extern int header_page_ts_size;
  16extern int header_page_data_offset;
  17
  18extern bool latency_format;
  19extern struct pevent *perf_pevent;
  20
  21enum {
  22        RINGBUF_TYPE_PADDING            = 29,
  23        RINGBUF_TYPE_TIME_EXTEND        = 30,
  24        RINGBUF_TYPE_TIME_STAMP         = 31,
  25};
  26
  27#ifndef TS_SHIFT
  28#define TS_SHIFT                27
  29#endif
  30
  31int bigendian(void);
  32
  33struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
  34void print_trace_event(struct pevent *pevent, int cpu, void *data, int size);
  35
  36void print_event(struct pevent *pevent, int cpu, void *data, int size,
  37                 unsigned long long nsecs, char *comm);
  38
  39int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
  40int parse_event_file(struct pevent *pevent,
  41                     char *buf, unsigned long size, char *sys);
  42
  43struct pevent_record *trace_peek_data(struct pevent *pevent, int cpu);
  44
  45unsigned long long
  46raw_field_value(struct event_format *event, const char *name, void *data);
  47void *raw_field_ptr(struct event_format *event, const char *name, void *data);
  48
  49void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
  50void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
  51
  52ssize_t trace_report(int fd, struct pevent **pevent, bool repipe);
  53
  54int trace_parse_common_type(struct pevent *pevent, void *data);
  55int trace_parse_common_pid(struct pevent *pevent, void *data);
  56
  57struct event_format *trace_find_next_event(struct pevent *pevent,
  58                                           struct event_format *event);
  59unsigned long long read_size(struct pevent *pevent, void *ptr, int size);
  60unsigned long long eval_flag(const char *flag);
  61
  62struct pevent_record *trace_read_data(struct pevent *pevent, int cpu);
  63int read_tracing_data(int fd, struct list_head *pattrs);
  64
  65struct tracing_data {
  66        /* size is only valid if temp is 'true' */
  67        ssize_t size;
  68        bool temp;
  69        char temp_file[50];
  70};
  71
  72struct tracing_data *tracing_data_get(struct list_head *pattrs,
  73                                      int fd, bool temp);
  74void tracing_data_put(struct tracing_data *tdata);
  75
  76
  77struct scripting_ops {
  78        const char *name;
  79        int (*start_script) (const char *script, int argc, const char **argv);
  80        int (*stop_script) (void);
  81        void (*process_event) (union perf_event *event,
  82                               struct pevent *pevent,
  83                               struct perf_sample *sample,
  84                               struct perf_evsel *evsel,
  85                               struct machine *machine,
  86                               struct thread *thread);
  87        int (*generate_script) (struct pevent *pevent, const char *outfile);
  88};
  89
  90int script_spec_register(const char *spec, struct scripting_ops *ops);
  91
  92void setup_perl_scripting(void);
  93void setup_python_scripting(void);
  94
  95struct scripting_context {
  96        struct pevent *pevent;
  97        void *event_data;
  98};
  99
 100int common_pc(struct scripting_context *context);
 101int common_flags(struct scripting_context *context);
 102int common_lock_depth(struct scripting_context *context);
 103
 104#endif /* _PERF_UTIL_TRACE_EVENT_H */
 105