perf: Provide a new deterministic events reordering algorithm
[safe/jmp/linux-2.6] / tools / perf / util / trace-event.h
index 3ddb894..406d452 100644 (file)
@@ -1,6 +1,8 @@
-#ifndef _PARSE_EVENTS_H
-#define _PARSE_EVENTS_H
+#ifndef __PERF_TRACE_EVENTS_H
+#define __PERF_TRACE_EVENTS_H
 
+#include <stdbool.h>
+#include "parse-events.h"
 
 #define __unused __attribute__((unused))
 
@@ -25,6 +27,11 @@ enum {
 enum format_flags {
        FIELD_IS_ARRAY          = 1,
        FIELD_IS_POINTER        = 2,
+       FIELD_IS_SIGNED         = 4,
+       FIELD_IS_STRING         = 8,
+       FIELD_IS_DYNAMIC        = 16,
+       FIELD_IS_FLAG           = 32,
+       FIELD_IS_SYMBOLIC       = 64,
 };
 
 struct format_field {
@@ -49,6 +56,7 @@ struct print_arg_atom {
 
 struct print_arg_string {
        char                    *string;
+       int                     offset;
 };
 
 struct print_arg_field {
@@ -130,15 +138,18 @@ struct event {
        int                     flags;
        struct format           format;
        struct print_fmt        print_fmt;
+       char                    *system;
 };
 
 enum {
-       EVENT_FL_ISFTRACE       = 1,
-       EVENT_FL_ISPRINT        = 2,
-       EVENT_FL_ISBPRINT       = 4,
-       EVENT_FL_ISFUNC         = 8,
-       EVENT_FL_ISFUNCENT      = 16,
-       EVENT_FL_ISFUNCRET      = 32,
+       EVENT_FL_ISFTRACE       = 0x01,
+       EVENT_FL_ISPRINT        = 0x02,
+       EVENT_FL_ISBPRINT       = 0x04,
+       EVENT_FL_ISFUNC         = 0x08,
+       EVENT_FL_ISFUNCENT      = 0x10,
+       EVENT_FL_ISFUNCRET      = 0x20,
+
+       EVENT_FL_FAILED         = 0x80000000
 };
 
 struct record {
@@ -152,7 +163,7 @@ struct record *trace_read_data(int cpu);
 
 void parse_set_info(int nr_cpus, int long_sz);
 
-void trace_report(void);
+ssize_t trace_report(int fd, bool repipe);
 
 void *malloc_or_die(unsigned int size);
 
@@ -164,7 +175,7 @@ void print_funcs(void);
 void print_printk(void);
 
 int parse_ftrace_file(char *buf, unsigned long size);
-int parse_event_file(char *buf, unsigned long size, char *system);
+int parse_event_file(char *buf, unsigned long size, char *sys);
 void print_event(int cpu, void *data, int size, unsigned long long nsecs,
                  char *comm);
 
@@ -231,8 +242,54 @@ extern int header_page_size_size;
 extern int header_page_data_offset;
 extern int header_page_data_size;
 
-int parse_header_page(char *buf, unsigned long size);
+extern bool latency_format;
+
+int trace_parse_common_type(void *data);
+int trace_parse_common_pid(void *data);
+int parse_common_pc(void *data);
+int parse_common_flags(void *data);
+int parse_common_lock_depth(void *data);
+struct event *trace_find_event(int id);
+struct event *trace_find_next_event(struct event *event);
+unsigned long long read_size(void *ptr, int size);
+unsigned long long
+raw_field_value(struct event *event, const char *name, void *data);
+void *raw_field_ptr(struct event *event, const char *name, void *data);
+unsigned long long eval_flag(const char *flag);
+
+int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events);
+ssize_t read_tracing_data_size(int fd, struct perf_event_attr *pattrs,
+                              int nb_events);
+
+/* taken from kernel/trace/trace.h */
+enum trace_flag_type {
+       TRACE_FLAG_IRQS_OFF             = 0x01,
+       TRACE_FLAG_IRQS_NOSUPPORT       = 0x02,
+       TRACE_FLAG_NEED_RESCHED         = 0x04,
+       TRACE_FLAG_HARDIRQ              = 0x08,
+       TRACE_FLAG_SOFTIRQ              = 0x10,
+};
+
+struct scripting_ops {
+       const char *name;
+       int (*start_script) (const char *script, int argc, const char **argv);
+       int (*stop_script) (void);
+       void (*process_event) (int cpu, void *data, int size,
+                              unsigned long long nsecs, char *comm);
+       int (*generate_script) (const char *outfile);
+};
+
+int script_spec_register(const char *spec, struct scripting_ops *ops);
+
+void setup_perl_scripting(void);
+void setup_python_scripting(void);
+
+struct scripting_context {
+       void *event_data;
+};
 
-void read_tracing_data(void);
+int common_pc(struct scripting_context *context);
+int common_flags(struct scripting_context *context);
+int common_lock_depth(struct scripting_context *context);
 
-#endif /* _PARSE_EVENTS_H */
+#endif /* __PERF_TRACE_EVENTS_H */