Use system include path in wrappers
[lttng-modules.git] / instrumentation / events / lttng-module / writeback.h
... / ...
CommitLineData
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM writeback
3
4#if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define LTTNG_TRACE_WRITEBACK_H
6
7#include "../../../probes/lttng-tracepoint-event.h"
8#include <linux/tracepoint.h>
9#include <linux/backing-dev.h>
10#include <linux/writeback.h>
11#include <linux/version.h>
12
13#ifndef _TRACE_WRITEBACK_DEF_
14#define _TRACE_WRITEBACK_DEF_
15
16#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
17static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
18{
19 struct super_block *sb = inode->i_sb;
20
21 if (strcmp(sb->s_type->name, "bdev") == 0)
22 return inode->i_mapping->backing_dev_info;
23
24 return sb->s_bdi;
25}
26#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) */
27
28#endif
29
30#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
31#define show_inode_state(state) \
32 __print_flags(state, "|", \
33 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
34 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
35 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
36 {I_NEW, "I_NEW"}, \
37 {I_WILL_FREE, "I_WILL_FREE"}, \
38 {I_FREEING, "I_FREEING"}, \
39 {I_CLEAR, "I_CLEAR"}, \
40 {I_SYNC, "I_SYNC"}, \
41 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
42 {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \
43 {I_REFERENCED, "I_REFERENCED"} \
44 )
45#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
46#define show_inode_state(state) \
47 __print_flags(state, "|", \
48 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
49 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
50 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
51 {I_NEW, "I_NEW"}, \
52 {I_WILL_FREE, "I_WILL_FREE"}, \
53 {I_FREEING, "I_FREEING"}, \
54 {I_CLEAR, "I_CLEAR"}, \
55 {I_SYNC, "I_SYNC"}, \
56 {I_REFERENCED, "I_REFERENCED"} \
57 )
58#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
59
60#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
61
62LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
63 TP_PROTO(struct page *page, struct address_space *mapping),
64 TP_ARGS(page, mapping),
65 TP_FIELDS(
66 ctf_array_text(char, name,
67 mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32)
68 ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
69 ctf_integer(pgoff_t, index, page->index)
70 )
71)
72
73LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
74 TP_PROTO(struct inode *inode, int flags),
75 TP_ARGS(inode, flags),
76 TP_FIELDS(
77 /* may be called for files on pseudo FSes w/ unregistered bdi */
78 ctf_array_text(char, name,
79 inode_to_bdi(inode)->dev ?
80 dev_name(inode_to_bdi(inode)->dev) : "(unknown)", 32)
81 ctf_integer(unsigned long, ino, inode->i_ino)
82 ctf_integer(unsigned long, state, inode->i_state)
83 ctf_integer(unsigned long, flags, flags)
84 )
85)
86#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
87LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
88 TP_PROTO(struct inode *inode, int flags), \
89 TP_ARGS(inode, flags))
90LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
91LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
92LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty)
93
94LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
95 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
96 TP_ARGS(inode, wbc),
97 TP_FIELDS(
98 ctf_array_text(char, name,
99 dev_name(inode_to_bdi(inode)->dev), 32)
100 ctf_integer(unsigned long, ino, inode->i_ino)
101 ctf_integer(int, sync_mode, wbc->sync_mode)
102 )
103)
104
105#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
106LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
107 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
108 TP_ARGS(inode, wbc))
109LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
110LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
111
112#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
113
114LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
115 TP_PROTO(struct page *page, struct address_space *mapping),
116 TP_ARGS(page, mapping),
117 TP_FIELDS(
118 ctf_array_text(char, name,
119 mapping ? dev_name(mapping->backing_dev_info->dev) : "(unknown)", 32)
120 ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
121 ctf_integer(pgoff_t, index, page->index)
122 )
123)
124
125LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
126 TP_PROTO(struct inode *inode, int flags),
127 TP_ARGS(inode, flags),
128 TP_FIELDS(
129 /* may be called for files on pseudo FSes w/ unregistered bdi */
130 ctf_array_text(char, name,
131 inode->i_mapping->backing_dev_info->dev ?
132 dev_name(inode->i_mapping->backing_dev_info->dev)
133 : "(unknown)", 32)
134 ctf_integer(unsigned long, ino, inode->i_ino)
135 ctf_integer(unsigned long, flags, flags)
136 )
137)
138#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
139LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
140 TP_PROTO(struct inode *inode, int flags), \
141 TP_ARGS(inode, flags))
142LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
143LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
144
145LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
146 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
147 TP_ARGS(inode, wbc),
148 TP_FIELDS(
149 ctf_array_text(char, name,
150 dev_name(inode->i_mapping->backing_dev_info->dev), 32)
151 ctf_integer(unsigned long, ino, inode->i_ino)
152 ctf_integer(int, sync_mode, wbc->sync_mode)
153 )
154)
155
156#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
157LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
158 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
159 TP_ARGS(inode, wbc))
160LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
161LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
162
163#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
164
165#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
166
167LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
168 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work),
169 TP_ARGS(wb, work),
170 TP_FIELDS(
171 ctf_array_text(char, name, wb->bdi->dev ? dev_name(wb->bdi->dev) :
172 "(unknown)", 32)
173 )
174)
175
176#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
177
178LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
179 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
180 TP_ARGS(bdi, work),
181 TP_FIELDS(
182 ctf_array_text(char, name, bdi->dev ? dev_name(bdi->dev) :
183 "(unknown)", 32)
184 )
185)
186
187#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
188
189LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
190 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
191 TP_ARGS(bdi, work),
192 TP_FIELDS(
193 ctf_array_text(char, name,
194 dev_name(bdi->dev ? bdi->dev :
195 default_backing_dev_info.dev), 32)
196 )
197)
198
199#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
200
201#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
202
203#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
204LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \
205 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \
206 TP_ARGS(wb, work))
207
208#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
209
210#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
211LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \
212 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
213 TP_ARGS(bdi, work))
214
215#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
216
217LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread)
218LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue)
219LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec)
220#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
221LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start)
222LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written)
223LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait)
224#endif
225
226LTTNG_TRACEPOINT_EVENT(writeback_pages_written,
227 TP_PROTO(long pages_written),
228 TP_ARGS(pages_written),
229 TP_FIELDS(
230 ctf_integer(long, pages, pages_written)
231 )
232)
233
234#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
235
236LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class,
237 TP_PROTO(struct bdi_writeback *wb),
238 TP_ARGS(wb),
239 TP_FIELDS(
240 ctf_array_text(char, name,
241 dev_name(wb->bdi->dev), 32)
242 )
243)
244
245#undef DEFINE_WRITEBACK_EVENT
246#define DEFINE_WRITEBACK_EVENT(name) \
247LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \
248 TP_PROTO(struct bdi_writeback *wb), \
249 TP_ARGS(wb))
250
251#define DEFINE_WRITEBACK_EVENT_MAP(name, map) \
252LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
253 TP_PROTO(struct bdi_writeback *wb), \
254 TP_ARGS(wb))
255
256LTTNG_TRACEPOINT_EVENT(writeback_bdi_register,
257 TP_PROTO(struct backing_dev_info *bdi),
258 TP_ARGS(bdi),
259 TP_FIELDS(
260 ctf_array_text(char, name,
261 dev_name(bdi->dev), 32)
262 )
263)
264
265#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
266
267LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class,
268 TP_PROTO(struct backing_dev_info *bdi),
269 TP_ARGS(bdi),
270 TP_FIELDS(
271 ctf_array_text(char, name,
272 dev_name(bdi->dev), 32)
273 )
274)
275
276#undef DEFINE_WRITEBACK_EVENT
277#define DEFINE_WRITEBACK_EVENT(name) \
278LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \
279 TP_PROTO(struct backing_dev_info *bdi), \
280 TP_ARGS(bdi))
281
282#define DEFINE_WRITEBACK_EVENT_MAP(name, map) \
283LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
284 TP_PROTO(struct backing_dev_info *bdi), \
285 TP_ARGS(bdi))
286
287DEFINE_WRITEBACK_EVENT(writeback_bdi_register)
288
289#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
290
291DEFINE_WRITEBACK_EVENT(writeback_nowork)
292#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
293DEFINE_WRITEBACK_EVENT(writeback_wake_background)
294#endif
295DEFINE_WRITEBACK_EVENT(writeback_wake_thread)
296DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread)
297DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister)
298DEFINE_WRITEBACK_EVENT(writeback_thread_start)
299DEFINE_WRITEBACK_EVENT(writeback_thread_stop)
300#if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0))
301DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start)
302DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait)
303
304LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written,
305
306 writeback_balance_dirty_written,
307
308 TP_PROTO(struct backing_dev_info *bdi, int written),
309
310 TP_ARGS(bdi, written),
311
312 TP_FIELDS(
313 ctf_array_text(char, name, dev_name(bdi->dev), 32)
314 ctf_integer(int, written, written)
315 )
316)
317#endif
318
319LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class,
320 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
321 TP_ARGS(wbc, bdi),
322 TP_FIELDS(
323 ctf_array_text(char, name, dev_name(bdi->dev), 32)
324 ctf_integer(long, nr_to_write, wbc->nr_to_write)
325 ctf_integer(long, pages_skipped, wbc->pages_skipped)
326 ctf_integer(int, sync_mode, wbc->sync_mode)
327 ctf_integer(int, for_kupdate, wbc->for_kupdate)
328 ctf_integer(int, for_background, wbc->for_background)
329 ctf_integer(int, for_reclaim, wbc->for_reclaim)
330 ctf_integer(int, range_cyclic, wbc->range_cyclic)
331#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
332 ctf_integer(int, more_io, wbc->more_io)
333 ctf_integer(unsigned long, older_than_this,
334 wbc->older_than_this ? *wbc->older_than_this : 0)
335#endif
336 ctf_integer(long, range_start, (long) wbc->range_start)
337 ctf_integer(long, range_end, (long) wbc->range_end)
338 )
339)
340
341#undef DEFINE_WBC_EVENT
342#define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \
343LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \
344 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
345 TP_ARGS(wbc, bdi))
346#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
347LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start, writeback_wbc_writeback_start)
348LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written, writeback_wbc_writeback_written)
349LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait, writeback_wbc_writeback_wait)
350LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start)
351LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written)
352LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait)
353#endif
354LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
355
356#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
357LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
358 TP_PROTO(struct bdi_writeback *wb,
359#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
360 struct wb_writeback_work *work,
361#else
362 unsigned long *older_than_this,
363#endif
364 int moved),
365#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
366 TP_ARGS(wb, work, moved),
367#else
368 TP_ARGS(wb, older_than_this, moved),
369#endif
370 TP_FIELDS(
371 ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
372#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
373#else
374 ctf_integer(unsigned long, older,
375 older_than_this ? *older_than_this : 0)
376 ctf_integer(long, age,
377 older_than_this ?
378 (jiffies - *older_than_this) * 1000 / HZ
379 : -1)
380#endif
381 ctf_integer(int, moved, moved)
382 )
383)
384
385LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
386
387 writeback_global_dirty_state,
388
389 TP_PROTO(unsigned long background_thresh,
390 unsigned long dirty_thresh
391 ),
392
393 TP_ARGS(background_thresh,
394 dirty_thresh
395 ),
396
397 TP_FIELDS(
398 ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY))
399 ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK))
400 ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS))
401 ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED))
402 ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN))
403 ctf_integer(unsigned long, background_thresh, background_thresh)
404 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
405 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
406 )
407)
408#endif
409
410#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
411
412#define KBps(x) ((x) << (PAGE_SHIFT - 10))
413
414#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
415
416LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
417
418 writeback_bdi_dirty_ratelimit,
419
420 TP_PROTO(struct bdi_writeback *wb,
421 unsigned long dirty_rate,
422 unsigned long task_ratelimit),
423
424 TP_ARGS(wb, dirty_rate, task_ratelimit),
425
426 TP_FIELDS(
427 ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32)
428 ctf_integer(unsigned long, write_bw, KBps(wb->bdi->wb.write_bandwidth))
429 ctf_integer(unsigned long, avg_write_bw, KBps(wb->bdi->wb.avg_write_bandwidth))
430 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
431 ctf_integer(unsigned long, dirty_ratelimit, KBps(wb->bdi->wb.dirty_ratelimit))
432 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
433 ctf_integer(unsigned long, balanced_dirty_ratelimit,
434 KBps(wb->bdi->wb.balanced_dirty_ratelimit))
435 )
436)
437
438#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0))
439
440LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
441
442 writeback_bdi_dirty_ratelimit,
443
444 TP_PROTO(struct backing_dev_info *bdi,
445 unsigned long dirty_rate,
446 unsigned long task_ratelimit),
447
448 TP_ARGS(bdi, dirty_rate, task_ratelimit),
449
450 TP_FIELDS(
451 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
452 ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth))
453 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth))
454 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
455 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit))
456 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
457 ctf_integer(unsigned long, balanced_dirty_ratelimit,
458 KBps(bdi->wb.balanced_dirty_ratelimit))
459 )
460)
461
462#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
463
464LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
465
466 writeback_bdi_dirty_ratelimit,
467
468 TP_PROTO(struct backing_dev_info *bdi,
469 unsigned long dirty_rate,
470 unsigned long task_ratelimit),
471
472 TP_ARGS(bdi, dirty_rate, task_ratelimit),
473
474 TP_FIELDS(
475 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
476 ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth))
477 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth))
478 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
479 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit))
480 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
481 ctf_integer(unsigned long, balanced_dirty_ratelimit,
482 KBps(bdi->balanced_dirty_ratelimit))
483 )
484)
485
486#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
487
488#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
489
490LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
491
492 writeback_balance_dirty_pages,
493
494 TP_PROTO(struct bdi_writeback *wb,
495 unsigned long thresh,
496 unsigned long bg_thresh,
497 unsigned long dirty,
498 unsigned long bdi_thresh,
499 unsigned long bdi_dirty,
500 unsigned long dirty_ratelimit,
501 unsigned long task_ratelimit,
502 unsigned long dirtied,
503 unsigned long period,
504 long pause,
505 unsigned long start_time),
506
507 TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
508 dirty_ratelimit, task_ratelimit,
509 dirtied, period, pause, start_time
510 ),
511
512 TP_FIELDS(
513 ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32)
514 ctf_integer(unsigned long, limit, global_dirty_limit)
515 ctf_integer(unsigned long, setpoint,
516 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
517 ctf_integer(unsigned long, dirty, dirty)
518 ctf_integer(unsigned long, bdi_setpoint,
519 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
520 bdi_thresh / (thresh + 1))
521 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
522 ctf_integer(unsigned long, dirty_ratelimit,
523 KBps(dirty_ratelimit))
524 ctf_integer(unsigned long, task_ratelimit,
525 KBps(task_ratelimit))
526 ctf_integer(unsigned int, dirtied, dirtied)
527 ctf_integer(unsigned int, dirtied_pause,
528 current->nr_dirtied_pause)
529 ctf_integer(unsigned long, paused,
530 (jiffies - start_time) * 1000 / HZ)
531 ctf_integer(long, pause, pause * 1000 / HZ)
532 ctf_integer(unsigned long, period,
533 period * 1000 / HZ)
534 ctf_integer(long, think,
535 current->dirty_paused_when == 0 ? 0 :
536 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
537 )
538)
539
540#else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
541
542LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
543
544 writeback_balance_dirty_pages,
545
546 TP_PROTO(struct backing_dev_info *bdi,
547 unsigned long thresh,
548 unsigned long bg_thresh,
549 unsigned long dirty,
550 unsigned long bdi_thresh,
551 unsigned long bdi_dirty,
552 unsigned long dirty_ratelimit,
553 unsigned long task_ratelimit,
554 unsigned long dirtied,
555#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
556 unsigned long period,
557#endif
558 long pause,
559 unsigned long start_time),
560
561 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
562 dirty_ratelimit, task_ratelimit,
563#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
564 dirtied, period, pause, start_time
565#else
566 dirtied, pause, start_time
567#endif
568 ),
569
570 TP_FIELDS(
571 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
572 ctf_integer(unsigned long, limit, global_dirty_limit)
573 ctf_integer(unsigned long, setpoint,
574 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
575 ctf_integer(unsigned long, dirty, dirty)
576 ctf_integer(unsigned long, bdi_setpoint,
577 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
578 bdi_thresh / (thresh + 1))
579 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
580 ctf_integer(unsigned long, dirty_ratelimit,
581 KBps(dirty_ratelimit))
582 ctf_integer(unsigned long, task_ratelimit,
583 KBps(task_ratelimit))
584 ctf_integer(unsigned int, dirtied, dirtied)
585 ctf_integer(unsigned int, dirtied_pause,
586 current->nr_dirtied_pause)
587 ctf_integer(unsigned long, paused,
588 (jiffies - start_time) * 1000 / HZ)
589 ctf_integer(long, pause, pause * 1000 / HZ)
590#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
591 ctf_integer(unsigned long, period,
592 period * 1000 / HZ)
593 ctf_integer(long, think,
594 current->dirty_paused_when == 0 ? 0 :
595 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
596#endif
597 )
598)
599#endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
600
601#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
602
603#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
604LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
605
606 TP_PROTO(struct inode *inode),
607 TP_ARGS(inode),
608
609 TP_FIELDS(
610 ctf_array_text(char, name,
611 dev_name(inode_to_bdi(inode)->dev), 32)
612 ctf_integer(unsigned long, ino, inode->i_ino)
613 ctf_integer(unsigned long, state, inode->i_state)
614 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
615 )
616)
617#endif
618
619#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
620LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template,
621
622 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
623
624 TP_ARGS(usec_timeout, usec_delayed),
625
626 TP_FIELDS(
627 ctf_integer(unsigned int, usec_timeout, usec_timeout)
628 ctf_integer(unsigned int, usec_delayed, usec_delayed)
629 )
630)
631
632LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait,
633
634 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
635
636 TP_ARGS(usec_timeout, usec_delayed)
637)
638
639LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested,
640
641 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
642
643 TP_ARGS(usec_timeout, usec_delayed)
644)
645#endif
646
647#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
648LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,
649
650 TP_PROTO(struct inode *inode,
651 struct writeback_control *wbc,
652 unsigned long nr_to_write
653 ),
654
655 TP_ARGS(inode, wbc, nr_to_write),
656
657 TP_FIELDS(
658 ctf_array_text(char, name,
659 dev_name(inode_to_bdi(inode)->dev), 32)
660 ctf_integer(unsigned long, ino, inode->i_ino)
661 ctf_integer(unsigned long, state, inode->i_state)
662 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
663 ctf_integer(unsigned long, writeback_index,
664 inode->i_mapping->writeback_index)
665 ctf_integer(long, nr_to_write, nr_to_write)
666 ctf_integer(unsigned long, wrote,
667 nr_to_write - wbc->nr_to_write)
668 )
669)
670
671#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
672LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue,
673 TP_PROTO(struct inode *inode,
674 struct writeback_control *wbc,
675 unsigned long nr_to_write),
676 TP_ARGS(inode, wbc, nr_to_write)
677)
678#endif
679
680LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode,
681 TP_PROTO(struct inode *inode,
682 struct writeback_control *wbc,
683 unsigned long nr_to_write),
684 TP_ARGS(inode, wbc, nr_to_write)
685)
686#endif
687
688#endif /* LTTNG_TRACE_WRITEBACK_H */
689
690/* This part must be outside protection */
691#include "../../../probes/define_trace.h"
This page took 0.030073 seconds and 4 git commands to generate.