Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM writeback |
| 3 | |
| 4 | #if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_WRITEBACK_H |
| 6 | |
| 7 | #include <linux/backing-dev.h> |
Randy Dunlap | 96dccab | 2010-07-19 16:49:17 -0700 | [diff] [blame] | 8 | #include <linux/device.h> |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 9 | #include <linux/writeback.h> |
| 10 | |
| 11 | struct wb_writeback_work; |
| 12 | |
| 13 | DECLARE_EVENT_CLASS(writeback_work_class, |
| 14 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), |
| 15 | TP_ARGS(bdi, work), |
| 16 | TP_STRUCT__entry( |
| 17 | __array(char, name, 32) |
| 18 | __field(long, nr_pages) |
| 19 | __field(dev_t, sb_dev) |
| 20 | __field(int, sync_mode) |
| 21 | __field(int, for_kupdate) |
| 22 | __field(int, range_cyclic) |
| 23 | __field(int, for_background) |
| 24 | ), |
| 25 | TP_fast_assign( |
| 26 | strncpy(__entry->name, dev_name(bdi->dev), 32); |
| 27 | __entry->nr_pages = work->nr_pages; |
| 28 | __entry->sb_dev = work->sb ? work->sb->s_dev : 0; |
| 29 | __entry->sync_mode = work->sync_mode; |
| 30 | __entry->for_kupdate = work->for_kupdate; |
| 31 | __entry->range_cyclic = work->range_cyclic; |
| 32 | __entry->for_background = work->for_background; |
| 33 | ), |
| 34 | TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " |
| 35 | "kupdate=%d range_cyclic=%d background=%d", |
| 36 | __entry->name, |
| 37 | MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), |
| 38 | __entry->nr_pages, |
| 39 | __entry->sync_mode, |
| 40 | __entry->for_kupdate, |
| 41 | __entry->range_cyclic, |
| 42 | __entry->for_background |
| 43 | ) |
| 44 | ); |
| 45 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ |
| 46 | DEFINE_EVENT(writeback_work_class, name, \ |
| 47 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ |
| 48 | TP_ARGS(bdi, work)) |
| 49 | DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread); |
| 50 | DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); |
| 51 | DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); |
| 52 | |
| 53 | TRACE_EVENT(writeback_pages_written, |
| 54 | TP_PROTO(long pages_written), |
| 55 | TP_ARGS(pages_written), |
| 56 | TP_STRUCT__entry( |
| 57 | __field(long, pages) |
| 58 | ), |
| 59 | TP_fast_assign( |
| 60 | __entry->pages = pages_written; |
| 61 | ), |
| 62 | TP_printk("%ld", __entry->pages) |
| 63 | ); |
| 64 | |
| 65 | DECLARE_EVENT_CLASS(writeback_class, |
| 66 | TP_PROTO(struct backing_dev_info *bdi), |
| 67 | TP_ARGS(bdi), |
| 68 | TP_STRUCT__entry( |
| 69 | __array(char, name, 32) |
| 70 | ), |
| 71 | TP_fast_assign( |
| 72 | strncpy(__entry->name, dev_name(bdi->dev), 32); |
| 73 | ), |
| 74 | TP_printk("bdi %s", |
| 75 | __entry->name |
| 76 | ) |
| 77 | ); |
| 78 | #define DEFINE_WRITEBACK_EVENT(name) \ |
| 79 | DEFINE_EVENT(writeback_class, name, \ |
| 80 | TP_PROTO(struct backing_dev_info *bdi), \ |
| 81 | TP_ARGS(bdi)) |
| 82 | |
| 83 | DEFINE_WRITEBACK_EVENT(writeback_nowork); |
Wu Fengguang | 71927e8 | 2011-01-13 15:45:46 -0800 | [diff] [blame] | 84 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); |
Artem Bityutskiy | 6033202 | 2010-07-25 14:29:24 +0300 | [diff] [blame] | 85 | DEFINE_WRITEBACK_EVENT(writeback_wake_thread); |
| 86 | DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 87 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); |
| 88 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); |
| 89 | DEFINE_WRITEBACK_EVENT(writeback_thread_start); |
| 90 | DEFINE_WRITEBACK_EVENT(writeback_thread_stop); |
| 91 | |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 92 | DECLARE_EVENT_CLASS(wbc_class, |
| 93 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
| 94 | TP_ARGS(wbc, bdi), |
| 95 | TP_STRUCT__entry( |
| 96 | __array(char, name, 32) |
| 97 | __field(long, nr_to_write) |
| 98 | __field(long, pages_skipped) |
| 99 | __field(int, sync_mode) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 100 | __field(int, for_kupdate) |
| 101 | __field(int, for_background) |
| 102 | __field(int, for_reclaim) |
| 103 | __field(int, range_cyclic) |
| 104 | __field(int, more_io) |
| 105 | __field(unsigned long, older_than_this) |
| 106 | __field(long, range_start) |
| 107 | __field(long, range_end) |
| 108 | ), |
| 109 | |
| 110 | TP_fast_assign( |
| 111 | strncpy(__entry->name, dev_name(bdi->dev), 32); |
| 112 | __entry->nr_to_write = wbc->nr_to_write; |
| 113 | __entry->pages_skipped = wbc->pages_skipped; |
| 114 | __entry->sync_mode = wbc->sync_mode; |
| 115 | __entry->for_kupdate = wbc->for_kupdate; |
| 116 | __entry->for_background = wbc->for_background; |
| 117 | __entry->for_reclaim = wbc->for_reclaim; |
| 118 | __entry->range_cyclic = wbc->range_cyclic; |
| 119 | __entry->more_io = wbc->more_io; |
| 120 | __entry->older_than_this = wbc->older_than_this ? |
| 121 | *wbc->older_than_this : 0; |
| 122 | __entry->range_start = (long)wbc->range_start; |
| 123 | __entry->range_end = (long)wbc->range_end; |
| 124 | ), |
| 125 | |
| 126 | TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " |
| 127 | "bgrd=%d reclm=%d cyclic=%d more=%d older=0x%lx " |
| 128 | "start=0x%lx end=0x%lx", |
| 129 | __entry->name, |
| 130 | __entry->nr_to_write, |
| 131 | __entry->pages_skipped, |
| 132 | __entry->sync_mode, |
| 133 | __entry->for_kupdate, |
| 134 | __entry->for_background, |
| 135 | __entry->for_reclaim, |
| 136 | __entry->range_cyclic, |
| 137 | __entry->more_io, |
| 138 | __entry->older_than_this, |
| 139 | __entry->range_start, |
| 140 | __entry->range_end) |
| 141 | ) |
| 142 | |
| 143 | #define DEFINE_WBC_EVENT(name) \ |
| 144 | DEFINE_EVENT(wbc_class, name, \ |
| 145 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ |
| 146 | TP_ARGS(wbc, bdi)) |
| 147 | DEFINE_WBC_EVENT(wbc_writeback_start); |
| 148 | DEFINE_WBC_EVENT(wbc_writeback_written); |
| 149 | DEFINE_WBC_EVENT(wbc_writeback_wait); |
| 150 | DEFINE_WBC_EVENT(wbc_balance_dirty_start); |
| 151 | DEFINE_WBC_EVENT(wbc_balance_dirty_written); |
| 152 | DEFINE_WBC_EVENT(wbc_balance_dirty_wait); |
Dave Chinner | 9e09438 | 2010-07-07 13:24:08 +1000 | [diff] [blame] | 153 | DEFINE_WBC_EVENT(wbc_writepage); |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 154 | |
Mel Gorman | 52bb919 | 2010-10-26 14:21:41 -0700 | [diff] [blame] | 155 | DECLARE_EVENT_CLASS(writeback_congest_waited_template, |
| 156 | |
| 157 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 158 | |
| 159 | TP_ARGS(usec_timeout, usec_delayed), |
| 160 | |
| 161 | TP_STRUCT__entry( |
| 162 | __field( unsigned int, usec_timeout ) |
| 163 | __field( unsigned int, usec_delayed ) |
| 164 | ), |
| 165 | |
| 166 | TP_fast_assign( |
| 167 | __entry->usec_timeout = usec_timeout; |
| 168 | __entry->usec_delayed = usec_delayed; |
| 169 | ), |
| 170 | |
| 171 | TP_printk("usec_timeout=%u usec_delayed=%u", |
| 172 | __entry->usec_timeout, |
| 173 | __entry->usec_delayed) |
| 174 | ); |
| 175 | |
| 176 | DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait, |
| 177 | |
| 178 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 179 | |
| 180 | TP_ARGS(usec_timeout, usec_delayed) |
| 181 | ); |
| 182 | |
Mel Gorman | 0e093d99 | 2010-10-26 14:21:45 -0700 | [diff] [blame] | 183 | DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, |
| 184 | |
| 185 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 186 | |
| 187 | TP_ARGS(usec_timeout, usec_delayed) |
| 188 | ); |
| 189 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 190 | #endif /* _TRACE_WRITEBACK_H */ |
| 191 | |
| 192 | /* This part must be outside protection */ |
| 193 | #include <trace/define_trace.h> |