X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Fwriteback.h;h=5525fed42e94cac7fb6f1df0c5789e317d6e8b5b;hb=59fecd6c4447460c6834d1da42c76c7016e5fbc3;hp=b3d55387c436a8ad7a137a1e0c2c05ac7c4ce089;hpb=b87700e318c27267890cbd6fb5e50b687279131b;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h index b3d55387..5525fed4 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( @@ -158,8 +99,14 @@ DECLARE_EVENT_CLASS(writeback_class, __entry->name ) ) +#undef DEFINE_WRITEBACK_EVENT #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) \ +LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \ TP_PROTO(struct backing_dev_info *bdi), \ TP_ARGS(bdi)) @@ -174,10 +121,12 @@ DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister) DEFINE_WRITEBACK_EVENT(writeback_thread_start) DEFINE_WRITEBACK_EVENT(writeback_thread_stop) #if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0)) -DEFINE_WRITEBACK_EVENT(balance_dirty_start) -DEFINE_WRITEBACK_EVENT(balance_dirty_wait) +DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start) +DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait) + +LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written, -TRACE_EVENT(balance_dirty_written, + writeback_balance_dirty_written, TP_PROTO(struct backing_dev_info *bdi, int written), @@ -200,7 +149,7 @@ TRACE_EVENT(balance_dirty_written, ) #endif -DECLARE_EVENT_CLASS(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( @@ -261,22 +210,23 @@ DECLARE_EVENT_CLASS(wbc_class, __entry->range_end) ) -#define DEFINE_WBC_EVENT(name) \ -DEFINE_EVENT(wbc_class, name, \ +#undef DEFINE_WBC_EVENT +#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) -DEFINE_WBC_EVENT(wbc_writeback_written) -DEFINE_WBC_EVENT(wbc_writeback_wait) -DEFINE_WBC_EVENT(wbc_balance_dirty_start) -DEFINE_WBC_EVENT(wbc_balance_dirty_written) -DEFINE_WBC_EVENT(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) +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, @@ -291,37 +241,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", @@ -333,7 +273,9 @@ TRACE_EVENT(writeback_queue_io, #endif ) -TRACE_EVENT(global_dirty_state, +LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, + + writeback_global_dirty_state, TP_PROTO(unsigned long background_thresh, unsigned long dirty_thresh @@ -384,7 +326,9 @@ TRACE_EVENT(global_dirty_state, #define KBps(x) ((x) << (PAGE_SHIFT - 10)) -TRACE_EVENT(bdi_dirty_ratelimit, +LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, + + writeback_bdi_dirty_ratelimit, TP_PROTO(struct backing_dev_info *bdi, unsigned long dirty_rate, @@ -427,7 +371,9 @@ TRACE_EVENT(bdi_dirty_ratelimit, ) ) -TRACE_EVENT(balance_dirty_pages, +LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages, + + writeback_balance_dirty_pages, TP_PROTO(struct backing_dev_info *bdi, unsigned long thresh, @@ -541,7 +487,7 @@ TRACE_EVENT(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), @@ -571,7 +517,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), @@ -592,14 +538,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), @@ -608,7 +554,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, @@ -651,7 +597,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), @@ -659,7 +605,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), @@ -667,7 +613,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"