tracing: add irq tracepoint documentation
[safe/jmp/linux-2.6] / include / trace / events / irq.h
1 #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_IRQ_H
3
4 #include <linux/tracepoint.h>
5 #include <linux/interrupt.h>
6
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM irq
9
10 /**
11  * irq_handler_entry - called immediately before the irq action handler
12  * @irq: irq number
13  * @action: pointer to struct irqaction
14  *
15  * The struct irqaction pointed to by @action contains various
16  * information about the handler, including the device name,
17  * @action->name, and the device id, @action->dev_id. When used in
18  * conjunction with the irq_handler_exit tracepoint, we can figure
19  * out irq handler latencies.
20  */
21 TRACE_EVENT(irq_handler_entry,
22
23         TP_PROTO(int irq, struct irqaction *action),
24
25         TP_ARGS(irq, action),
26
27         TP_STRUCT__entry(
28                 __field(        int,    irq             )
29                 __string(       name,   action->name    )
30         ),
31
32         TP_fast_assign(
33                 __entry->irq = irq;
34                 __assign_str(name, action->name);
35         ),
36
37         TP_printk("irq=%d handler=%s", __entry->irq, __get_str(name))
38 );
39
40 /**
41  * irq_handler_exit - called immediately after the irq action handler returns
42  * @irq: irq number
43  * @action: pointer to struct irqaction
44  * @ret: return value
45  *
46  * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
47  * @action->handler scuccessully handled this irq. Otherwise, the irq might be
48  * a shared irq line, or the irq was not handled successfully. Can be used in
49  * conjunction with the irq_handler_entry to understand irq handler latencies.
50  */
51 TRACE_EVENT(irq_handler_exit,
52
53         TP_PROTO(int irq, struct irqaction *action, int ret),
54
55         TP_ARGS(irq, action, ret),
56
57         TP_STRUCT__entry(
58                 __field(        int,    irq     )
59                 __field(        int,    ret     )
60         ),
61
62         TP_fast_assign(
63                 __entry->irq    = irq;
64                 __entry->ret    = ret;
65         ),
66
67         TP_printk("irq=%d return=%s",
68                   __entry->irq, __entry->ret ? "handled" : "unhandled")
69 );
70
71 /**
72  * softirq_entry - called immediately before the softirq handler
73  * @h: pointer to struct softirq_action
74  * @vec: pointer to first struct softirq_action in softirq_vec array
75  *
76  * The @h parameter, contains a pointer to the struct softirq_action
77  * which has a pointer to the action handler that is called. By subtracting
78  * the @vec pointer from the @h pointer, we can determine the softirq
79  * number. Also, when used in combination with the softirq_exit tracepoint
80  * we can determine the softirq latency.
81  */
82 TRACE_EVENT(softirq_entry,
83
84         TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
85
86         TP_ARGS(h, vec),
87
88         TP_STRUCT__entry(
89                 __field(        int,    vec                     )
90                 __string(       name,   softirq_to_name[h-vec]  )
91         ),
92
93         TP_fast_assign(
94                 __entry->vec = (int)(h - vec);
95                 __assign_str(name, softirq_to_name[h-vec]);
96         ),
97
98         TP_printk("softirq=%d action=%s", __entry->vec, __get_str(name))
99 );
100
101 /**
102  * softirq_exit - called immediately after the softirq handler returns
103  * @h: pointer to struct softirq_action
104  * @vec: pointer to first struct softirq_action in softirq_vec array
105  *
106  * The @h parameter contains a pointer to the struct softirq_action
107  * that has handled the softirq. By subtracting the @vec pointer from
108  * the @h pointer, we can determine the softirq number. Also, when used in
109  * combination with the softirq_entry tracepoint we can determine the softirq
110  * latency.
111  */
112 TRACE_EVENT(softirq_exit,
113
114         TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
115
116         TP_ARGS(h, vec),
117
118         TP_STRUCT__entry(
119                 __field(        int,    vec                     )
120                 __string(       name,   softirq_to_name[h-vec]  )
121         ),
122
123         TP_fast_assign(
124                 __entry->vec = (int)(h - vec);
125                 __assign_str(name, softirq_to_name[h-vec]);
126         ),
127
128         TP_printk("softirq=%d action=%s", __entry->vec, __get_str(name))
129 );
130
131 #endif /*  _TRACE_IRQ_H */
132
133 /* This part must be outside protection */
134 #include <trace/define_trace.h>