X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Fwriteback.h;h=2dca4e41df657ab21e42d3bc4f604587f8188031;hb=1b4cbadbff1a2bc47ab7bcc361fb8a72f6f3042c;hp=b0c81d2872cc2221adbfffcb785b731c32ff36c1;hpb=9cf29d3eaffa56199259919c90108de84724b4fb;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h index b0c81d28..2dca4e41 100644 --- a/instrumentation/events/lttng-module/writeback.h +++ b/instrumentation/events/lttng-module/writeback.h @@ -1,36 +1,16 @@ #undef TRACE_SYSTEM #define TRACE_SYSTEM writeback -#if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_WRITEBACK_H +#if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) +#define LTTNG_TRACE_WRITEBACK_H +#include "../../../probes/lttng-tracepoint-event.h" #include #include #include #ifndef _TRACE_WRITEBACK_DEF_ #define _TRACE_WRITEBACK_DEF_ -/* Have to duplicate it here from fs/fs-writeback.c */ -struct wb_writeback_work { - long nr_pages; - struct super_block *sb; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) - unsigned long *older_than_this; -#endif - enum writeback_sync_modes sync_mode; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) - unsigned int tagged_writepages:1; -#endif - unsigned int for_kupdate:1; - unsigned int range_cyclic:1; - unsigned int for_background:1; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - enum wb_reason reason; /* why was writeback initiated? */ -#endif - - struct list_head list; /* pending work list */ - struct completion *done; /* set if the caller waits */ -}; static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) { struct super_block *sb = inode->i_sb; @@ -67,73 +47,34 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) {WB_REASON_FORKER_THREAD, "forker_thread"} #endif -DECLARE_EVENT_CLASS(writeback_work_class, +LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), TP_ARGS(bdi, work), TP_STRUCT__entry( __array(char, name, 32) - __field(long, nr_pages) - __field(dev_t, sb_dev) - __field(int, sync_mode) - __field(int, for_kupdate) - __field(int, range_cyclic) - __field(int, for_background) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - __field(int, reason) -#endif ), TP_fast_assign( tp_memcpy(name, dev_name(bdi->dev ? bdi->dev : default_backing_dev_info.dev), 32) - tp_assign(nr_pages, work->nr_pages) - tp_assign(sb_dev, work->sb ? work->sb->s_dev : 0) - tp_assign(sync_mode, work->sync_mode) - tp_assign(for_kupdate, work->for_kupdate) - tp_assign(range_cyclic, work->range_cyclic) - tp_assign(for_background, work->for_background) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - tp_assign(reason, work->reason) -#endif ), -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " - "kupdate=%d range_cyclic=%d background=%d reason=%s", - __entry->name, - MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), - __entry->nr_pages, - __entry->sync_mode, - __entry->for_kupdate, - __entry->range_cyclic, - __entry->for_background, - __print_symbolic(__entry->reason, WB_WORK_REASON) - ) -#else - TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " - "kupdate=%d range_cyclic=%d background=%d", - __entry->name, - MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), - __entry->nr_pages, - __entry->sync_mode, - __entry->for_kupdate, - __entry->range_cyclic, - __entry->for_background + TP_printk("bdi %s", + __entry->name ) -#endif ) -#define DEFINE_WRITEBACK_WORK_EVENT(name) \ -DEFINE_EVENT(writeback_work_class, name, \ +#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \ +LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \ TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ TP_ARGS(bdi, work)) -DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread) -DEFINE_WRITEBACK_WORK_EVENT(writeback_queue) -DEFINE_WRITEBACK_WORK_EVENT(writeback_exec) +LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread) +LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue) +LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) -DEFINE_WRITEBACK_WORK_EVENT(writeback_start) -DEFINE_WRITEBACK_WORK_EVENT(writeback_written) -DEFINE_WRITEBACK_WORK_EVENT(writeback_wait) +LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start) +LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written) +LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait) #endif -TRACE_EVENT(writeback_pages_written, +LTTNG_TRACEPOINT_EVENT(writeback_pages_written, TP_PROTO(long pages_written), TP_ARGS(pages_written), TP_STRUCT__entry( @@ -145,7 +86,7 @@ TRACE_EVENT(writeback_pages_written, TP_printk("%ld", __entry->pages) ) -DECLARE_EVENT_CLASS(writeback_class, +LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class, TP_PROTO(struct backing_dev_info *bdi), TP_ARGS(bdi), TP_STRUCT__entry( @@ -159,12 +100,12 @@ DECLARE_EVENT_CLASS(writeback_class, ) ) #define DEFINE_WRITEBACK_EVENT(name) \ -DEFINE_EVENT(writeback_class, name, \ +LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \ TP_PROTO(struct backing_dev_info *bdi), \ TP_ARGS(bdi)) #define DEFINE_WRITEBACK_EVENT_MAP(name, map) \ -DEFINE_EVENT_MAP(writeback_class, name, map, \ +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \ TP_PROTO(struct backing_dev_info *bdi), \ TP_ARGS(bdi)) @@ -182,7 +123,7 @@ DEFINE_WRITEBACK_EVENT(writeback_thread_stop) DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start) DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait) -TRACE_EVENT_MAP(balance_dirty_written, +LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written, writeback_balance_dirty_written, @@ -207,7 +148,7 @@ TRACE_EVENT_MAP(balance_dirty_written, ) #endif -DECLARE_EVENT_CLASS(writeback_wbc_class, +LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class, TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), TP_ARGS(wbc, bdi), TP_STRUCT__entry( @@ -269,22 +210,22 @@ DECLARE_EVENT_CLASS(writeback_wbc_class, ) #undef DEFINE_WBC_EVENT -#define DEFINE_WBC_EVENT(name, map) \ -DEFINE_EVENT_MAP(writeback_wbc_class, name, map, \ +#define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \ +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \ TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ TP_ARGS(wbc, bdi)) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) -DEFINE_WBC_EVENT(wbc_writeback_start, writeback_wbc_writeback_start) -DEFINE_WBC_EVENT(wbc_writeback_written, writeback_wbc_writeback_written) -DEFINE_WBC_EVENT(wbc_writeback_wait, writeback_wbc_writeback_wait) -DEFINE_WBC_EVENT(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start) -DEFINE_WBC_EVENT(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written) -DEFINE_WBC_EVENT(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait) +LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start, writeback_wbc_writeback_start) +LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written, writeback_wbc_writeback_written) +LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait, writeback_wbc_writeback_wait) +LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start) +LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written) +LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait) #endif -DEFINE_WBC_EVENT(wbc_writepage, writeback_wbc_writepage) +LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) -TRACE_EVENT(writeback_queue_io, +LTTNG_TRACEPOINT_EVENT(writeback_queue_io, TP_PROTO(struct bdi_writeback *wb, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) struct wb_writeback_work *work, @@ -299,37 +240,27 @@ TRACE_EVENT(writeback_queue_io, #endif TP_STRUCT__entry( __array(char, name, 32) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) +#else __field(unsigned long, older) __field(long, age) - __field(int, moved) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - __field(int, reason) #endif + __field(int, moved) ), TP_fast_assign( tp_memcpy(name, dev_name(wb->bdi->dev), 32) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - tp_assign(older, - work->older_than_this ? *(work->older_than_this) : 0) - tp_assign(age, work->older_than_this ? - (jiffies - *(work->older_than_this)) * 1000 / HZ : -1) #else tp_assign(older, older_than_this ? *older_than_this : 0) tp_assign(age, older_than_this ? (jiffies - *older_than_this) * 1000 / HZ : -1) #endif tp_assign(moved, moved) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - tp_assign(reason, work->reason) -#endif ), #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s", + TP_printk("bdi %s: enqueue=%d", __entry->name, - __entry->older, /* older_than_this in jiffies */ - __entry->age, /* older_than_this in relative milliseconds */ __entry->moved, - __print_symbolic(__entry->reason, WB_WORK_REASON) ) #else TP_printk("bdi %s: older=%lu age=%ld enqueue=%d", @@ -341,7 +272,7 @@ TRACE_EVENT(writeback_queue_io, #endif ) -TRACE_EVENT_MAP(global_dirty_state, +LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, writeback_global_dirty_state, @@ -394,7 +325,7 @@ TRACE_EVENT_MAP(global_dirty_state, #define KBps(x) ((x) << (PAGE_SHIFT - 10)) -TRACE_EVENT_MAP(bdi_dirty_ratelimit, +LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, writeback_bdi_dirty_ratelimit, @@ -439,7 +370,7 @@ TRACE_EVENT_MAP(bdi_dirty_ratelimit, ) ) -TRACE_EVENT_MAP(balance_dirty_pages, +LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages, writeback_balance_dirty_pages, @@ -555,7 +486,7 @@ TRACE_EVENT_MAP(balance_dirty_pages, #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) -TRACE_EVENT(writeback_sb_inodes_requeue, +LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue, TP_PROTO(struct inode *inode), TP_ARGS(inode), @@ -585,7 +516,7 @@ TRACE_EVENT(writeback_sb_inodes_requeue, #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -DECLARE_EVENT_CLASS(writeback_congest_waited_template, +LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template, TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), @@ -606,14 +537,14 @@ DECLARE_EVENT_CLASS(writeback_congest_waited_template, __entry->usec_delayed) ) -DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait, +LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait, TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), TP_ARGS(usec_timeout, usec_delayed) ) -DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, +LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested, TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), @@ -622,7 +553,7 @@ DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) -DECLARE_EVENT_CLASS(writeback_single_inode_template, +LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template, TP_PROTO(struct inode *inode, struct writeback_control *wbc, @@ -665,7 +596,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) -DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_requeue, +LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue, TP_PROTO(struct inode *inode, struct writeback_control *wbc, unsigned long nr_to_write), @@ -673,7 +604,7 @@ DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_requeue, ) #endif -DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, +LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode, TP_PROTO(struct inode *inode, struct writeback_control *wbc, unsigned long nr_to_write), @@ -681,7 +612,7 @@ DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, ) #endif -#endif /* _TRACE_WRITEBACK_H */ +#endif /* LTTNG_TRACE_WRITEBACK_H */ /* This part must be outside protection */ #include "../../../probes/define_trace.h"