Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[safe/jmp/linux-2.6] / include / linux / ftrace_event.h
index 38f8d65..c082f22 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/trace_seq.h>
 #include <linux/percpu.h>
 #include <linux/hardirq.h>
+#include <linux/perf_event.h>
 
 struct trace_array;
 struct tracer;
@@ -24,6 +25,9 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
 const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
                                     const struct trace_print_flags *symbol_array);
 
+const char *ftrace_print_hex_seq(struct trace_seq *p,
+                                const unsigned char *buf, int len);
+
 /*
  * The trace entry - the most basic unit of tracing. This is what
  * is printed in the end as a single line in the trace output, such as:
@@ -57,6 +61,7 @@ struct trace_iterator {
        /* The below is zeroed out in pipe_read */
        struct trace_seq        seq;
        struct trace_entry      *ent;
+       unsigned long           lost_events;
        int                     leftover;
        int                     cpu;
        u64                     ts;
@@ -121,9 +126,8 @@ struct ftrace_event_call {
        int                     (*regfunc)(struct ftrace_event_call *);
        void                    (*unregfunc)(struct ftrace_event_call *);
        int                     id;
+       const char              *print_fmt;
        int                     (*raw_init)(struct ftrace_event_call *);
-       int                     (*show_format)(struct ftrace_event_call *,
-                                              struct trace_seq *);
        int                     (*define_fields)(struct ftrace_event_call *);
        struct list_head        fields;
        int                     filter_active;
@@ -131,15 +135,12 @@ struct ftrace_event_call {
        void                    *mod;
        void                    *data;
 
-       atomic_t                profile_count;
-       int                     (*profile_enable)(struct ftrace_event_call *);
-       void                    (*profile_disable)(struct ftrace_event_call *);
+       int                     perf_refcount;
+       int                     (*perf_event_enable)(struct ftrace_event_call *);
+       void                    (*perf_event_disable)(struct ftrace_event_call *);
 };
 
-#define FTRACE_MAX_PROFILE_SIZE        2048
-
-extern char *perf_trace_buf;
-extern char *perf_trace_buf_nmi;
+#define PERF_MAX_TRACE_SIZE    2048
 
 #define MAX_FILTER_PRED                32
 #define MAX_FILTER_STR_VAL     256     /* Should handle KSYM_SYMBOL_LEN */
@@ -158,7 +159,7 @@ enum {
        FILTER_PTR_STRING,
 };
 
-extern int trace_define_common_fields(struct ftrace_event_call *call);
+extern int trace_event_raw_init(struct ftrace_event_call *call);
 extern int trace_define_field(struct ftrace_event_call *call, const char *type,
                              const char *name, int offset, int size,
                              int is_signed, int filter_type);
@@ -188,13 +189,30 @@ do {                                                                      \
                __trace_printk(ip, fmt, ##args);                        \
 } while (0)
 
-#ifdef CONFIG_EVENT_PROFILE
+#ifdef CONFIG_PERF_EVENTS
 struct perf_event;
-extern int ftrace_profile_enable(int event_id);
-extern void ftrace_profile_disable(int event_id);
+
+DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);
+
+extern int perf_trace_enable(int event_id);
+extern void perf_trace_disable(int event_id);
 extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
                                     char *filter_str);
 extern void ftrace_profile_free_filter(struct perf_event *event);
+extern void *
+perf_trace_buf_prepare(int size, unsigned short type, int *rctxp,
+                        unsigned long *irq_flags);
+
+static inline void
+perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
+                      u64 count, unsigned long irq_flags, struct pt_regs *regs)
+{
+       struct trace_entry *entry = raw_data;
+
+       perf_tp_event(entry->type, addr, count, raw_data, size, regs);
+       perf_swevent_put_recursion_context(rctx);
+       local_irq_restore(irq_flags);
+}
 #endif
 
 #endif /* _LINUX_FTRACE_EVENT_H */