Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM timer |
| 4 | |
| 5 | #if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_TIMER_H |
| 7 | |
| 8 | #include <linux/tracepoint.h> |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 9 | #include <linux/hrtimer.h> |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 10 | #include <linux/timer.h> |
| 11 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 12 | DECLARE_EVENT_CLASS(timer_class, |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 13 | |
| 14 | TP_PROTO(struct timer_list *timer), |
| 15 | |
| 16 | TP_ARGS(timer), |
| 17 | |
| 18 | TP_STRUCT__entry( |
| 19 | __field( void *, timer ) |
| 20 | ), |
| 21 | |
| 22 | TP_fast_assign( |
| 23 | __entry->timer = timer; |
| 24 | ), |
| 25 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 26 | TP_printk("timer=%p", __entry->timer) |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 27 | ); |
| 28 | |
| 29 | /** |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 30 | * timer_init - called when the timer is initialized |
| 31 | * @timer: pointer to struct timer_list |
| 32 | */ |
| 33 | DEFINE_EVENT(timer_class, timer_init, |
| 34 | |
| 35 | TP_PROTO(struct timer_list *timer), |
| 36 | |
| 37 | TP_ARGS(timer) |
| 38 | ); |
| 39 | |
Thomas Gleixner | 8a58a34 | 2017-02-10 16:41:15 +0100 | [diff] [blame] | 40 | #define decode_timer_flags(flags) \ |
| 41 | __print_flags(flags, "|", \ |
| 42 | { TIMER_MIGRATING, "M" }, \ |
| 43 | { TIMER_DEFERRABLE, "D" }, \ |
| 44 | { TIMER_PINNED, "P" }, \ |
| 45 | { TIMER_IRQSAFE, "I" }) |
| 46 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 47 | /** |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 48 | * timer_start - called when the timer is started |
| 49 | * @timer: pointer to struct timer_list |
| 50 | * @expires: the timers expiry time |
| 51 | */ |
| 52 | TRACE_EVENT(timer_start, |
| 53 | |
Badhri Jagan Sridharan | 4e413e8 | 2015-05-07 16:20:34 -0700 | [diff] [blame] | 54 | TP_PROTO(struct timer_list *timer, |
| 55 | unsigned long expires, |
Thomas Gleixner | 0eeda71 | 2015-05-26 22:50:29 +0000 | [diff] [blame] | 56 | unsigned int flags), |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 57 | |
Thomas Gleixner | 0eeda71 | 2015-05-26 22:50:29 +0000 | [diff] [blame] | 58 | TP_ARGS(timer, expires, flags), |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 59 | |
| 60 | TP_STRUCT__entry( |
| 61 | __field( void *, timer ) |
| 62 | __field( void *, function ) |
| 63 | __field( unsigned long, expires ) |
| 64 | __field( unsigned long, now ) |
Thomas Gleixner | 0eeda71 | 2015-05-26 22:50:29 +0000 | [diff] [blame] | 65 | __field( unsigned int, flags ) |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 66 | ), |
| 67 | |
| 68 | TP_fast_assign( |
| 69 | __entry->timer = timer; |
| 70 | __entry->function = timer->function; |
| 71 | __entry->expires = expires; |
| 72 | __entry->now = jiffies; |
Thomas Gleixner | 0eeda71 | 2015-05-26 22:50:29 +0000 | [diff] [blame] | 73 | __entry->flags = flags; |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 74 | ), |
| 75 | |
Anna-Maria Gleixner | 6849cbb | 2019-03-21 13:09:20 +0100 | [diff] [blame^] | 76 | TP_printk("timer=%p function=%ps expires=%lu [timeout=%ld] cpu=%u idx=%u flags=%s", |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 77 | __entry->timer, __entry->function, __entry->expires, |
Thomas Gleixner | 8a58a34 | 2017-02-10 16:41:15 +0100 | [diff] [blame] | 78 | (long)__entry->expires - __entry->now, |
| 79 | __entry->flags & TIMER_CPUMASK, |
| 80 | __entry->flags >> TIMER_ARRAYSHIFT, |
| 81 | decode_timer_flags(__entry->flags & TIMER_TRACE_FLAGMASK)) |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 82 | ); |
| 83 | |
| 84 | /** |
| 85 | * timer_expire_entry - called immediately before the timer callback |
| 86 | * @timer: pointer to struct timer_list |
| 87 | * |
| 88 | * Allows to determine the timer latency. |
| 89 | */ |
| 90 | TRACE_EVENT(timer_expire_entry, |
| 91 | |
| 92 | TP_PROTO(struct timer_list *timer), |
| 93 | |
| 94 | TP_ARGS(timer), |
| 95 | |
| 96 | TP_STRUCT__entry( |
| 97 | __field( void *, timer ) |
| 98 | __field( unsigned long, now ) |
Arjan van de Ven | ede1b42 | 2010-08-18 15:33:13 -0700 | [diff] [blame] | 99 | __field( void *, function) |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 100 | ), |
| 101 | |
| 102 | TP_fast_assign( |
| 103 | __entry->timer = timer; |
| 104 | __entry->now = jiffies; |
Arjan van de Ven | ede1b42 | 2010-08-18 15:33:13 -0700 | [diff] [blame] | 105 | __entry->function = timer->function; |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 106 | ), |
| 107 | |
Anna-Maria Gleixner | 6849cbb | 2019-03-21 13:09:20 +0100 | [diff] [blame^] | 108 | TP_printk("timer=%p function=%ps now=%lu", |
| 109 | __entry->timer, __entry->function, __entry->now) |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 110 | ); |
| 111 | |
| 112 | /** |
| 113 | * timer_expire_exit - called immediately after the timer callback returns |
| 114 | * @timer: pointer to struct timer_list |
| 115 | * |
| 116 | * When used in combination with the timer_expire_entry tracepoint we can |
| 117 | * determine the runtime of the timer callback function. |
| 118 | * |
| 119 | * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might |
| 120 | * be invalid. We solely track the pointer. |
| 121 | */ |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 122 | DEFINE_EVENT(timer_class, timer_expire_exit, |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 123 | |
| 124 | TP_PROTO(struct timer_list *timer), |
| 125 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 126 | TP_ARGS(timer) |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 127 | ); |
| 128 | |
| 129 | /** |
| 130 | * timer_cancel - called when the timer is canceled |
| 131 | * @timer: pointer to struct timer_list |
| 132 | */ |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 133 | DEFINE_EVENT(timer_class, timer_cancel, |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 134 | |
| 135 | TP_PROTO(struct timer_list *timer), |
| 136 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 137 | TP_ARGS(timer) |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 138 | ); |
| 139 | |
Anna-Maria Gleixner | 91633ee | 2017-12-21 11:41:37 +0100 | [diff] [blame] | 140 | #define decode_clockid(type) \ |
| 141 | __print_symbolic(type, \ |
| 142 | { CLOCK_REALTIME, "CLOCK_REALTIME" }, \ |
| 143 | { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" }, \ |
| 144 | { CLOCK_BOOTTIME, "CLOCK_BOOTTIME" }, \ |
| 145 | { CLOCK_TAI, "CLOCK_TAI" }) |
| 146 | |
| 147 | #define decode_hrtimer_mode(mode) \ |
| 148 | __print_symbolic(mode, \ |
| 149 | { HRTIMER_MODE_ABS, "ABS" }, \ |
| 150 | { HRTIMER_MODE_REL, "REL" }, \ |
| 151 | { HRTIMER_MODE_ABS_PINNED, "ABS|PINNED" }, \ |
Anna-Maria Gleixner | 98ecadd | 2017-12-21 11:41:55 +0100 | [diff] [blame] | 152 | { HRTIMER_MODE_REL_PINNED, "REL|PINNED" }, \ |
| 153 | { HRTIMER_MODE_ABS_SOFT, "ABS|SOFT" }, \ |
| 154 | { HRTIMER_MODE_REL_SOFT, "REL|SOFT" }, \ |
| 155 | { HRTIMER_MODE_ABS_PINNED_SOFT, "ABS|PINNED|SOFT" }, \ |
| 156 | { HRTIMER_MODE_REL_PINNED_SOFT, "REL|PINNED|SOFT" }) |
Anna-Maria Gleixner | 91633ee | 2017-12-21 11:41:37 +0100 | [diff] [blame] | 157 | |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 158 | /** |
| 159 | * hrtimer_init - called when the hrtimer is initialized |
Masanari Iida | cf2fbdd | 2013-03-16 20:53:05 +0900 | [diff] [blame] | 160 | * @hrtimer: pointer to struct hrtimer |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 161 | * @clockid: the hrtimers clock |
| 162 | * @mode: the hrtimers mode |
| 163 | */ |
| 164 | TRACE_EVENT(hrtimer_init, |
| 165 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 166 | TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid, |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 167 | enum hrtimer_mode mode), |
| 168 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 169 | TP_ARGS(hrtimer, clockid, mode), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 170 | |
| 171 | TP_STRUCT__entry( |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 172 | __field( void *, hrtimer ) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 173 | __field( clockid_t, clockid ) |
| 174 | __field( enum hrtimer_mode, mode ) |
| 175 | ), |
| 176 | |
| 177 | TP_fast_assign( |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 178 | __entry->hrtimer = hrtimer; |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 179 | __entry->clockid = clockid; |
| 180 | __entry->mode = mode; |
| 181 | ), |
| 182 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 183 | TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer, |
Anna-Maria Gleixner | 91633ee | 2017-12-21 11:41:37 +0100 | [diff] [blame] | 184 | decode_clockid(__entry->clockid), |
| 185 | decode_hrtimer_mode(__entry->mode)) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 186 | ); |
| 187 | |
| 188 | /** |
| 189 | * hrtimer_start - called when the hrtimer is started |
Masanari Iida | cf2fbdd | 2013-03-16 20:53:05 +0900 | [diff] [blame] | 190 | * @hrtimer: pointer to struct hrtimer |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 191 | */ |
| 192 | TRACE_EVENT(hrtimer_start, |
| 193 | |
Anna-Maria Gleixner | 63e2ed3 | 2017-12-21 11:41:38 +0100 | [diff] [blame] | 194 | TP_PROTO(struct hrtimer *hrtimer, enum hrtimer_mode mode), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 195 | |
Anna-Maria Gleixner | 63e2ed3 | 2017-12-21 11:41:38 +0100 | [diff] [blame] | 196 | TP_ARGS(hrtimer, mode), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 197 | |
| 198 | TP_STRUCT__entry( |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 199 | __field( void *, hrtimer ) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 200 | __field( void *, function ) |
| 201 | __field( s64, expires ) |
| 202 | __field( s64, softexpires ) |
Anna-Maria Gleixner | 63e2ed3 | 2017-12-21 11:41:38 +0100 | [diff] [blame] | 203 | __field( enum hrtimer_mode, mode ) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 204 | ), |
| 205 | |
| 206 | TP_fast_assign( |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 207 | __entry->hrtimer = hrtimer; |
| 208 | __entry->function = hrtimer->function; |
Thomas Gleixner | 2456e85 | 2016-12-25 11:38:40 +0100 | [diff] [blame] | 209 | __entry->expires = hrtimer_get_expires(hrtimer); |
| 210 | __entry->softexpires = hrtimer_get_softexpires(hrtimer); |
Anna-Maria Gleixner | 63e2ed3 | 2017-12-21 11:41:38 +0100 | [diff] [blame] | 211 | __entry->mode = mode; |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 212 | ), |
| 213 | |
Anna-Maria Gleixner | 6849cbb | 2019-03-21 13:09:20 +0100 | [diff] [blame^] | 214 | TP_printk("hrtimer=%p function=%ps expires=%llu softexpires=%llu " |
Anna-Maria Gleixner | 63e2ed3 | 2017-12-21 11:41:38 +0100 | [diff] [blame] | 215 | "mode=%s", __entry->hrtimer, __entry->function, |
Thomas Gleixner | 2456e85 | 2016-12-25 11:38:40 +0100 | [diff] [blame] | 216 | (unsigned long long) __entry->expires, |
Anna-Maria Gleixner | 63e2ed3 | 2017-12-21 11:41:38 +0100 | [diff] [blame] | 217 | (unsigned long long) __entry->softexpires, |
| 218 | decode_hrtimer_mode(__entry->mode)) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 219 | ); |
| 220 | |
| 221 | /** |
Masanari Iida | cf2fbdd | 2013-03-16 20:53:05 +0900 | [diff] [blame] | 222 | * hrtimer_expire_entry - called immediately before the hrtimer callback |
| 223 | * @hrtimer: pointer to struct hrtimer |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 224 | * @now: pointer to variable which contains current time of the |
| 225 | * timers base. |
| 226 | * |
| 227 | * Allows to determine the timer latency. |
| 228 | */ |
| 229 | TRACE_EVENT(hrtimer_expire_entry, |
| 230 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 231 | TP_PROTO(struct hrtimer *hrtimer, ktime_t *now), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 232 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 233 | TP_ARGS(hrtimer, now), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 234 | |
| 235 | TP_STRUCT__entry( |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 236 | __field( void *, hrtimer ) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 237 | __field( s64, now ) |
Arjan van de Ven | ede1b42 | 2010-08-18 15:33:13 -0700 | [diff] [blame] | 238 | __field( void *, function) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 239 | ), |
| 240 | |
| 241 | TP_fast_assign( |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 242 | __entry->hrtimer = hrtimer; |
Thomas Gleixner | 2456e85 | 2016-12-25 11:38:40 +0100 | [diff] [blame] | 243 | __entry->now = *now; |
Arjan van de Ven | ede1b42 | 2010-08-18 15:33:13 -0700 | [diff] [blame] | 244 | __entry->function = hrtimer->function; |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 245 | ), |
| 246 | |
Anna-Maria Gleixner | 6849cbb | 2019-03-21 13:09:20 +0100 | [diff] [blame^] | 247 | TP_printk("hrtimer=%p function=%ps now=%llu", |
| 248 | __entry->hrtimer, __entry->function, |
Thomas Gleixner | 2456e85 | 2016-12-25 11:38:40 +0100 | [diff] [blame] | 249 | (unsigned long long) __entry->now) |
| 250 | ); |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 251 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 252 | DECLARE_EVENT_CLASS(hrtimer_class, |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 253 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 254 | TP_PROTO(struct hrtimer *hrtimer), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 255 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 256 | TP_ARGS(hrtimer), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 257 | |
| 258 | TP_STRUCT__entry( |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 259 | __field( void *, hrtimer ) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 260 | ), |
| 261 | |
| 262 | TP_fast_assign( |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 263 | __entry->hrtimer = hrtimer; |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 264 | ), |
| 265 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 266 | TP_printk("hrtimer=%p", __entry->hrtimer) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 267 | ); |
| 268 | |
| 269 | /** |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 270 | * hrtimer_expire_exit - called immediately after the hrtimer callback returns |
Masanari Iida | cf2fbdd | 2013-03-16 20:53:05 +0900 | [diff] [blame] | 271 | * @hrtimer: pointer to struct hrtimer |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 272 | * |
| 273 | * When used in combination with the hrtimer_expire_entry tracepoint we can |
| 274 | * determine the runtime of the callback function. |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 275 | */ |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 276 | DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit, |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 277 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 278 | TP_PROTO(struct hrtimer *hrtimer), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 279 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 280 | TP_ARGS(hrtimer) |
| 281 | ); |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 282 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 283 | /** |
| 284 | * hrtimer_cancel - called when the hrtimer is canceled |
| 285 | * @hrtimer: pointer to struct hrtimer |
| 286 | */ |
| 287 | DEFINE_EVENT(hrtimer_class, hrtimer_cancel, |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 288 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 289 | TP_PROTO(struct hrtimer *hrtimer), |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 290 | |
Li Zefan | 363d0f6 | 2010-05-24 16:23:15 +0800 | [diff] [blame] | 291 | TP_ARGS(hrtimer) |
Xiao Guangrong | c6a2a17 | 2009-08-10 10:51:23 +0800 | [diff] [blame] | 292 | ); |
| 293 | |
Xiao Guangrong | 3f0a525 | 2009-08-10 10:52:30 +0800 | [diff] [blame] | 294 | /** |
| 295 | * itimer_state - called when itimer is started or canceled |
| 296 | * @which: name of the interval timer |
| 297 | * @value: the itimers value, itimer is canceled if value->it_value is |
| 298 | * zero, otherwise it is started |
| 299 | * @expires: the itimers expiry time |
| 300 | */ |
| 301 | TRACE_EVENT(itimer_state, |
| 302 | |
| 303 | TP_PROTO(int which, const struct itimerval *const value, |
Frederic Weisbecker | 858cf3a | 2017-01-31 04:09:35 +0100 | [diff] [blame] | 304 | unsigned long long expires), |
Xiao Guangrong | 3f0a525 | 2009-08-10 10:52:30 +0800 | [diff] [blame] | 305 | |
| 306 | TP_ARGS(which, value, expires), |
| 307 | |
| 308 | TP_STRUCT__entry( |
Frederic Weisbecker | 858cf3a | 2017-01-31 04:09:35 +0100 | [diff] [blame] | 309 | __field( int, which ) |
| 310 | __field( unsigned long long, expires ) |
| 311 | __field( long, value_sec ) |
| 312 | __field( long, value_usec ) |
| 313 | __field( long, interval_sec ) |
| 314 | __field( long, interval_usec ) |
Xiao Guangrong | 3f0a525 | 2009-08-10 10:52:30 +0800 | [diff] [blame] | 315 | ), |
| 316 | |
| 317 | TP_fast_assign( |
| 318 | __entry->which = which; |
| 319 | __entry->expires = expires; |
| 320 | __entry->value_sec = value->it_value.tv_sec; |
| 321 | __entry->value_usec = value->it_value.tv_usec; |
| 322 | __entry->interval_sec = value->it_interval.tv_sec; |
| 323 | __entry->interval_usec = value->it_interval.tv_usec; |
| 324 | ), |
| 325 | |
Thomas Gleixner | e9c0748 | 2009-12-10 13:23:19 +0100 | [diff] [blame] | 326 | TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld", |
Frederic Weisbecker | 858cf3a | 2017-01-31 04:09:35 +0100 | [diff] [blame] | 327 | __entry->which, __entry->expires, |
Xiao Guangrong | 3f0a525 | 2009-08-10 10:52:30 +0800 | [diff] [blame] | 328 | __entry->value_sec, __entry->value_usec, |
| 329 | __entry->interval_sec, __entry->interval_usec) |
| 330 | ); |
| 331 | |
| 332 | /** |
| 333 | * itimer_expire - called when itimer expires |
| 334 | * @which: type of the interval timer |
| 335 | * @pid: pid of the process which owns the timer |
| 336 | * @now: current time, used to calculate the latency of itimer |
| 337 | */ |
| 338 | TRACE_EVENT(itimer_expire, |
| 339 | |
Frederic Weisbecker | 858cf3a | 2017-01-31 04:09:35 +0100 | [diff] [blame] | 340 | TP_PROTO(int which, struct pid *pid, unsigned long long now), |
Xiao Guangrong | 3f0a525 | 2009-08-10 10:52:30 +0800 | [diff] [blame] | 341 | |
| 342 | TP_ARGS(which, pid, now), |
| 343 | |
| 344 | TP_STRUCT__entry( |
Frederic Weisbecker | 858cf3a | 2017-01-31 04:09:35 +0100 | [diff] [blame] | 345 | __field( int , which ) |
| 346 | __field( pid_t, pid ) |
| 347 | __field( unsigned long long, now ) |
Xiao Guangrong | 3f0a525 | 2009-08-10 10:52:30 +0800 | [diff] [blame] | 348 | ), |
| 349 | |
| 350 | TP_fast_assign( |
| 351 | __entry->which = which; |
| 352 | __entry->now = now; |
| 353 | __entry->pid = pid_nr(pid); |
| 354 | ), |
| 355 | |
Thomas Gleixner | e9c0748 | 2009-12-10 13:23:19 +0100 | [diff] [blame] | 356 | TP_printk("which=%d pid=%d now=%llu", __entry->which, |
Frederic Weisbecker | 858cf3a | 2017-01-31 04:09:35 +0100 | [diff] [blame] | 357 | (int) __entry->pid, __entry->now) |
Xiao Guangrong | 3f0a525 | 2009-08-10 10:52:30 +0800 | [diff] [blame] | 358 | ); |
| 359 | |
Frederic Weisbecker | 2c82d1be | 2013-04-20 17:35:50 +0200 | [diff] [blame] | 360 | #ifdef CONFIG_NO_HZ_COMMON |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 361 | |
| 362 | #define TICK_DEP_NAMES \ |
Steven Rostedt (Red Hat) | c87edb3 | 2016-08-05 12:41:52 -0400 | [diff] [blame] | 363 | tick_dep_mask_name(NONE) \ |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 364 | tick_dep_name(POSIX_TIMER) \ |
| 365 | tick_dep_name(PERF_EVENTS) \ |
| 366 | tick_dep_name(SCHED) \ |
| 367 | tick_dep_name_end(CLOCK_UNSTABLE) |
| 368 | |
| 369 | #undef tick_dep_name |
Steven Rostedt (Red Hat) | c87edb3 | 2016-08-05 12:41:52 -0400 | [diff] [blame] | 370 | #undef tick_dep_mask_name |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 371 | #undef tick_dep_name_end |
| 372 | |
Steven Rostedt (Red Hat) | c87edb3 | 2016-08-05 12:41:52 -0400 | [diff] [blame] | 373 | /* The MASK will convert to their bits and they need to be processed too */ |
| 374 | #define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \ |
| 375 | TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); |
| 376 | #define tick_dep_name_end(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \ |
| 377 | TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); |
| 378 | /* NONE only has a mask defined for it */ |
| 379 | #define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 380 | |
| 381 | TICK_DEP_NAMES |
| 382 | |
| 383 | #undef tick_dep_name |
Steven Rostedt (Red Hat) | c87edb3 | 2016-08-05 12:41:52 -0400 | [diff] [blame] | 384 | #undef tick_dep_mask_name |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 385 | #undef tick_dep_name_end |
| 386 | |
| 387 | #define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep }, |
Steven Rostedt (Red Hat) | c87edb3 | 2016-08-05 12:41:52 -0400 | [diff] [blame] | 388 | #define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep }, |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 389 | #define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep } |
| 390 | |
| 391 | #define show_tick_dep_name(val) \ |
| 392 | __print_symbolic(val, TICK_DEP_NAMES) |
| 393 | |
Frederic Weisbecker | cb41a29 | 2013-04-20 17:35:50 +0200 | [diff] [blame] | 394 | TRACE_EVENT(tick_stop, |
| 395 | |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 396 | TP_PROTO(int success, int dependency), |
Frederic Weisbecker | cb41a29 | 2013-04-20 17:35:50 +0200 | [diff] [blame] | 397 | |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 398 | TP_ARGS(success, dependency), |
Frederic Weisbecker | cb41a29 | 2013-04-20 17:35:50 +0200 | [diff] [blame] | 399 | |
| 400 | TP_STRUCT__entry( |
| 401 | __field( int , success ) |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 402 | __field( int , dependency ) |
Frederic Weisbecker | cb41a29 | 2013-04-20 17:35:50 +0200 | [diff] [blame] | 403 | ), |
| 404 | |
| 405 | TP_fast_assign( |
| 406 | __entry->success = success; |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 407 | __entry->dependency = dependency; |
Frederic Weisbecker | cb41a29 | 2013-04-20 17:35:50 +0200 | [diff] [blame] | 408 | ), |
| 409 | |
Frederic Weisbecker | e6e6cc2 | 2015-12-11 03:27:25 +0100 | [diff] [blame] | 410 | TP_printk("success=%d dependency=%s", __entry->success, \ |
| 411 | show_tick_dep_name(__entry->dependency)) |
Frederic Weisbecker | cb41a29 | 2013-04-20 17:35:50 +0200 | [diff] [blame] | 412 | ); |
| 413 | #endif |
| 414 | |
Xiao Guangrong | 2b022e3 | 2009-08-10 10:48:59 +0800 | [diff] [blame] | 415 | #endif /* _TRACE_TIMER_H */ |
| 416 | |
| 417 | /* This part must be outside protection */ |
| 418 | #include <trace/define_trace.h> |