Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
timer.h
Go to the documentation of this file.
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM timer
3 
4 #if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_TIMER_H
6 
7 #include <linux/tracepoint.h>
8 #include <linux/hrtimer.h>
9 #include <linux/timer.h>
10 
11 DECLARE_EVENT_CLASS(timer_class,
12 
13  TP_PROTO(struct timer_list *timer),
14 
15  TP_ARGS(timer),
16 
18  __field( void *, timer )
19  ),
20 
22  __entry->timer = timer;
23  ),
24 
25  TP_printk("timer=%p", __entry->timer)
26 );
27 
32 DEFINE_EVENT(timer_class, timer_init,
33 
34  TP_PROTO(struct timer_list *timer),
35 
36  TP_ARGS(timer)
37 );
38 
44 TRACE_EVENT(timer_start,
45 
46  TP_PROTO(struct timer_list *timer, unsigned long expires),
47 
48  TP_ARGS(timer, expires),
49 
51  __field( void *, timer )
52  __field( void *, function )
53  __field( unsigned long, expires )
54  __field( unsigned long, now )
55  ),
56 
58  __entry->timer = timer;
59  __entry->function = timer->function;
60  __entry->expires = expires;
61  __entry->now = jiffies;
62  ),
63 
64  TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]",
65  __entry->timer, __entry->function, __entry->expires,
66  (long)__entry->expires - __entry->now)
67 );
68 
75 TRACE_EVENT(timer_expire_entry,
76 
77  TP_PROTO(struct timer_list *timer),
78 
79  TP_ARGS(timer),
80 
82  __field( void *, timer )
83  __field( unsigned long, now )
84  __field( void *, function)
85  ),
86 
88  __entry->timer = timer;
89  __entry->now = jiffies;
90  __entry->function = timer->function;
91  ),
92 
93  TP_printk("timer=%p function=%pf now=%lu", __entry->timer, __entry->function,__entry->now)
94 );
95 
106 DEFINE_EVENT(timer_class, timer_expire_exit,
107 
108  TP_PROTO(struct timer_list *timer),
109 
110  TP_ARGS(timer)
111 );
112 
117 DEFINE_EVENT(timer_class, timer_cancel,
118 
119  TP_PROTO(struct timer_list *timer),
120 
121  TP_ARGS(timer)
122 );
123 
131 
132  TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
133  enum hrtimer_mode mode),
134 
135  TP_ARGS(hrtimer, clockid, mode),
136 
138  __field( void *, hrtimer )
139  __field( clockid_t, clockid )
140  __field( enum hrtimer_mode, mode )
141  ),
142 
144  __entry->hrtimer = hrtimer;
145  __entry->clockid = clockid;
146  __entry->mode = mode;
147  ),
148 
149  TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
150  __entry->clockid == CLOCK_REALTIME ?
151  "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
152  __entry->mode == HRTIMER_MODE_ABS ?
153  "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
154 );
155 
161 
162  TP_PROTO(struct hrtimer *hrtimer),
163 
164  TP_ARGS(hrtimer),
165 
167  __field( void *, hrtimer )
168  __field( void *, function )
169  __field( s64, expires )
170  __field( s64, softexpires )
171  ),
172 
174  __entry->hrtimer = hrtimer;
175  __entry->function = hrtimer->function;
176  __entry->expires = hrtimer_get_expires(hrtimer).tv64;
177  __entry->softexpires = hrtimer_get_softexpires(hrtimer).tv64;
178  ),
179 
180  TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu",
181  __entry->hrtimer, __entry->function,
182  (unsigned long long)ktime_to_ns((ktime_t) {
183  .tv64 = __entry->expires }),
184  (unsigned long long)ktime_to_ns((ktime_t) {
185  .tv64 = __entry->softexpires }))
186 );
187 
196 TRACE_EVENT(hrtimer_expire_entry,
197 
198  TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
199 
200  TP_ARGS(hrtimer, now),
201 
203  __field( void *, hrtimer )
204  __field( s64, now )
205  __field( void *, function)
206  ),
207 
209  __entry->hrtimer = hrtimer;
210  __entry->now = now->tv64;
211  __entry->function = hrtimer->function;
212  ),
213 
214  TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function,
215  (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now }))
216  );
217 
218 DECLARE_EVENT_CLASS(hrtimer_class,
219 
220  TP_PROTO(struct hrtimer *hrtimer),
221 
222  TP_ARGS(hrtimer),
223 
225  __field( void *, hrtimer )
226  ),
227 
229  __entry->hrtimer = hrtimer;
230  ),
231 
232  TP_printk("hrtimer=%p", __entry->hrtimer)
233 );
234 
242 DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit,
243 
244  TP_PROTO(struct hrtimer *hrtimer),
245 
246  TP_ARGS(hrtimer)
247 );
248 
253 DEFINE_EVENT(hrtimer_class, hrtimer_cancel,
254 
255  TP_PROTO(struct hrtimer *hrtimer),
256 
257  TP_ARGS(hrtimer)
258 );
259 
267 TRACE_EVENT(itimer_state,
268 
269  TP_PROTO(int which, const struct itimerval *const value,
270  cputime_t expires),
271 
272  TP_ARGS(which, value, expires),
273 
275  __field( int, which )
276  __field( cputime_t, expires )
277  __field( long, value_sec )
278  __field( long, value_usec )
279  __field( long, interval_sec )
280  __field( long, interval_usec )
281  ),
282 
284  __entry->which = which;
285  __entry->expires = expires;
286  __entry->value_sec = value->it_value.tv_sec;
287  __entry->value_usec = value->it_value.tv_usec;
288  __entry->interval_sec = value->it_interval.tv_sec;
289  __entry->interval_usec = value->it_interval.tv_usec;
290  ),
291 
292  TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld",
293  __entry->which, (unsigned long long)__entry->expires,
294  __entry->value_sec, __entry->value_usec,
295  __entry->interval_sec, __entry->interval_usec)
296 );
297 
304 TRACE_EVENT(itimer_expire,
305 
306  TP_PROTO(int which, struct pid *pid, cputime_t now),
307 
308  TP_ARGS(which, pid, now),
309 
311  __field( int , which )
312  __field( pid_t, pid )
313  __field( cputime_t, now )
314  ),
315 
317  __entry->which = which;
318  __entry->now = now;
319  __entry->pid = pid_nr(pid);
320  ),
321 
322  TP_printk("which=%d pid=%d now=%llu", __entry->which,
323  (int) __entry->pid, (unsigned long long)__entry->now)
324 );
325 
326 #endif /* _TRACE_TIMER_H */
327 
328 /* This part must be outside protection */
329 #include <trace/define_trace.h>