aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2009-08-09 22:51:23 -0400
committerThomas Gleixner <tglx@linutronix.de>2009-08-29 08:10:06 -0400
commitc6a2a1770245f654f35f60e1458d4356680f9519 (patch)
tree0a015269ca839ac2fe91b3d86955997bf7b8686d /include/trace
parent2b022e3d4bf9885f781221c59d86283a2cdfc2ed (diff)
hrtimer: Add tracepoint for hrtimers
Add tracepoints which cover the life cycle of a hrtimer. The tracepoints are integrated with the already existing debug_object debug points as far as possible. [ tglx: Fixed comments, made output conistent, easier to read and parse. Fixed output for 32bit archs which do not use the scalar representation of ktime_t. Hand current time to trace_hrtimer_expiry_entry instead of calling get_time() inside of the trace assignment. ] Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Anton Blanchard <anton@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Zhaolei <zhaolei@cn.fujitsu.com> LKML-Reference: <4A7F8B2B.5020908@cn.fujitsu.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/timer.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
index 725892a93b49..df3c07fa0cb8 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -5,6 +5,7 @@
5#define _TRACE_TIMER_H 5#define _TRACE_TIMER_H
6 6
7#include <linux/tracepoint.h> 7#include <linux/tracepoint.h>
8#include <linux/hrtimer.h>
8#include <linux/timer.h> 9#include <linux/timer.h>
9 10
10/** 11/**
@@ -131,6 +132,144 @@ TRACE_EVENT(timer_cancel,
131 TP_printk("timer %p", __entry->timer) 132 TP_printk("timer %p", __entry->timer)
132); 133);
133 134
135/**
136 * hrtimer_init - called when the hrtimer is initialized
137 * @timer: pointer to struct hrtimer
138 * @clockid: the hrtimers clock
139 * @mode: the hrtimers mode
140 */
141TRACE_EVENT(hrtimer_init,
142
143 TP_PROTO(struct hrtimer *timer, clockid_t clockid,
144 enum hrtimer_mode mode),
145
146 TP_ARGS(timer, clockid, mode),
147
148 TP_STRUCT__entry(
149 __field( void *, timer )
150 __field( clockid_t, clockid )
151 __field( enum hrtimer_mode, mode )
152 ),
153
154 TP_fast_assign(
155 __entry->timer = timer;
156 __entry->clockid = clockid;
157 __entry->mode = mode;
158 ),
159
160 TP_printk("hrtimer %p, clockid %s, mode %s", __entry->timer,
161 __entry->clockid == CLOCK_REALTIME ?
162 "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
163 __entry->mode == HRTIMER_MODE_ABS ?
164 "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
165);
166
167/**
168 * hrtimer_start - called when the hrtimer is started
169 * @timer: pointer to struct hrtimer
170 */
171TRACE_EVENT(hrtimer_start,
172
173 TP_PROTO(struct hrtimer *timer),
174
175 TP_ARGS(timer),
176
177 TP_STRUCT__entry(
178 __field( void *, timer )
179 __field( void *, function )
180 __field( s64, expires )
181 __field( s64, softexpires )
182 ),
183
184 TP_fast_assign(
185 __entry->timer = timer;
186 __entry->function = timer->function;
187 __entry->expires = hrtimer_get_expires(timer).tv64;
188 __entry->softexpires = hrtimer_get_softexpires(timer).tv64;
189 ),
190
191 TP_printk("hrtimer %p, func %pf, expires %llu, softexpires %llu",
192 __entry->timer, __entry->function,
193 (unsigned long long)ktime_to_ns((ktime_t) {
194 .tv64 = __entry->expires }),
195 (unsigned long long)ktime_to_ns((ktime_t) {
196 .tv64 = __entry->softexpires }))
197);
198
199/**
200 * htimmer_expire_entry - called immediately before the hrtimer callback
201 * @timer: pointer to struct hrtimer
202 * @now: pointer to variable which contains current time of the
203 * timers base.
204 *
205 * Allows to determine the timer latency.
206 */
207TRACE_EVENT(hrtimer_expire_entry,
208
209 TP_PROTO(struct hrtimer *timer, ktime_t *now),
210
211 TP_ARGS(timer, now),
212
213 TP_STRUCT__entry(
214 __field( void *, timer )
215 __field( s64, now )
216 ),
217
218 TP_fast_assign(
219 __entry->timer = timer;
220 __entry->now = now->tv64;
221 ),
222
223 TP_printk("hrtimer %p, now %llu", __entry->timer,
224 (unsigned long long)ktime_to_ns((ktime_t) {
225 .tv64 = __entry->now }))
226 );
227
228/**
229 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
230 * @timer: pointer to struct hrtimer
231 *
232 * When used in combination with the hrtimer_expire_entry tracepoint we can
233 * determine the runtime of the callback function.
234 */
235TRACE_EVENT(hrtimer_expire_exit,
236
237 TP_PROTO(struct hrtimer *timer),
238
239 TP_ARGS(timer),
240
241 TP_STRUCT__entry(
242 __field( void *, timer )
243 ),
244
245 TP_fast_assign(
246 __entry->timer = timer;
247 ),
248
249 TP_printk("hrtimer %p", __entry->timer)
250);
251
252/**
253 * hrtimer_cancel - called when the hrtimer is canceled
254 * @timer: pointer to struct hrtimer
255 */
256TRACE_EVENT(hrtimer_cancel,
257
258 TP_PROTO(struct hrtimer *timer),
259
260 TP_ARGS(timer),
261
262 TP_STRUCT__entry(
263 __field( void *, timer )
264 ),
265
266 TP_fast_assign(
267 __entry->timer = timer;
268 ),
269
270 TP_printk("hrtimer %p", __entry->timer)
271);
272
134#endif /* _TRACE_TIMER_H */ 273#endif /* _TRACE_TIMER_H */
135 274
136/* This part must be outside protection */ 275/* This part must be outside protection */