| 1 |
|
| 2 | #undef TRACE_SYSTEM
|
| 3 | #define TRACE_SYSTEM damon
|
| 4 |
|
| 5 | #if !defined(_TRACE_DAMON_H) || defined(TRACE_HEADER_MULTI_READ)
|
| 6 | #define _TRACE_DAMON_H
|
| 7 |
|
| 8 | #include <linux/damon.h>
|
| 9 | #include <linux/types.h>
|
| 10 | #include <linux/tracepoint.h>
|
| 11 |
|
| 12 | TRACE_EVENT(damos_stat_after_apply_interval,
|
| 13 |
|
| 14 | TP_PROTO(unsigned int context_idx, unsigned int scheme_idx,
|
| 15 | struct damos_stat *stat),
|
| 16 |
|
| 17 | TP_ARGS(context_idx, scheme_idx, stat),
|
| 18 |
|
| 19 | TP_STRUCT__entry(
|
| 20 | __field(unsigned int, context_idx)
|
| 21 | __field(unsigned int, scheme_idx)
|
| 22 | __field(unsigned long, nr_tried)
|
| 23 | __field(unsigned long, sz_tried)
|
| 24 | __field(unsigned long, nr_applied)
|
| 25 | __field(unsigned long, sz_applied)
|
| 26 | __field(unsigned long, sz_ops_filter_passed)
|
| 27 | __field(unsigned long, qt_exceeds)
|
| 28 | __field(unsigned long, nr_snapshots)
|
| 29 | ),
|
| 30 |
|
| 31 | TP_fast_assign(
|
| 32 | __entry->context_idx = context_idx;
|
| 33 | __entry->scheme_idx = scheme_idx;
|
| 34 | __entry->nr_tried = stat->nr_tried;
|
| 35 | __entry->sz_tried = stat->sz_tried;
|
| 36 | __entry->nr_applied = stat->nr_applied;
|
| 37 | __entry->sz_applied = stat->sz_applied;
|
| 38 | __entry->sz_ops_filter_passed = stat->sz_ops_filter_passed;
|
| 39 | __entry->qt_exceeds = stat->qt_exceeds;
|
| 40 | __entry->nr_snapshots = stat->nr_snapshots;
|
| 41 | ),
|
| 42 |
|
| 43 | TP_printk("ctx_idx=%u scheme_idx=%u nr_tried=%lu sz_tried=%lu "
|
| 44 | "nr_applied=%lu sz_applied=%lu sz_ops_filter_passed=%lu "
|
| 45 | "qt_exceeds=%lu nr_snapshots=%lu",
|
| 46 | __entry->context_idx, __entry->scheme_idx,
|
| 47 | __entry->nr_tried, __entry->sz_tried,
|
| 48 | __entry->nr_applied, __entry->sz_applied,
|
| 49 | __entry->sz_ops_filter_passed, __entry->qt_exceeds,
|
| 50 | __entry->nr_snapshots)
|
| 51 | );
|
| 52 |
|
| 53 | TRACE_EVENT(damos_esz,
|
| 54 |
|
| 55 | TP_PROTO(unsigned int context_idx, unsigned int scheme_idx,
|
| 56 | unsigned long esz),
|
| 57 |
|
| 58 | TP_ARGS(context_idx, scheme_idx, esz),
|
| 59 |
|
| 60 | TP_STRUCT__entry(
|
| 61 | __field(unsigned int, context_idx)
|
| 62 | __field(unsigned int, scheme_idx)
|
| 63 | __field(unsigned long, esz)
|
| 64 | ),
|
| 65 |
|
| 66 | TP_fast_assign(
|
| 67 | __entry->context_idx = context_idx;
|
| 68 | __entry->scheme_idx = scheme_idx;
|
| 69 | __entry->esz = esz;
|
| 70 | ),
|
| 71 |
|
| 72 | TP_printk("ctx_idx=%u scheme_idx=%u esz=%lu",
|
| 73 | __entry->context_idx, __entry->scheme_idx,
|
| 74 | __entry->esz)
|
| 75 | );
|
| 76 |
|
| 77 | TRACE_EVENT_CONDITION(damos_before_apply,
|
| 78 |
|
| 79 | TP_PROTO(unsigned int context_idx, unsigned int scheme_idx,
|
| 80 | unsigned int target_idx, struct damon_region *r,
|
| 81 | unsigned int nr_accesses, unsigned int nr_regions,
|
| 82 | bool do_trace),
|
| 83 |
|
| 84 | TP_ARGS(context_idx, scheme_idx, target_idx, r, nr_accesses,
|
| 85 | nr_regions, do_trace),
|
| 86 |
|
| 87 | TP_CONDITION(do_trace),
|
| 88 |
|
| 89 | TP_STRUCT__entry(
|
| 90 | __field(unsigned int, context_idx)
|
| 91 | __field(unsigned int, scheme_idx)
|
| 92 | __field(unsigned long, target_idx)
|
| 93 | __field(unsigned long, start)
|
| 94 | __field(unsigned long, end)
|
| 95 | __field(unsigned int, nr_accesses)
|
| 96 | __field(unsigned int, age)
|
| 97 | __field(unsigned int, nr_regions)
|
| 98 | ),
|
| 99 |
|
| 100 | TP_fast_assign(
|
| 101 | __entry->context_idx = context_idx;
|
| 102 | __entry->scheme_idx = scheme_idx;
|
| 103 | __entry->target_idx = target_idx;
|
| 104 | __entry->start = r->ar.start;
|
| 105 | __entry->end = r->ar.end;
|
| 106 | __entry->nr_accesses = nr_accesses;
|
| 107 | __entry->age = r->age;
|
| 108 | __entry->nr_regions = nr_regions;
|
| 109 | ),
|
| 110 |
|
| 111 | TP_printk("ctx_idx=%u scheme_idx=%u target_idx=%lu nr_regions=%u %lu-%lu: %u %u",
|
| 112 | __entry->context_idx, __entry->scheme_idx,
|
| 113 | __entry->target_idx, __entry->nr_regions,
|
| 114 | __entry->start, __entry->end,
|
| 115 | __entry->nr_accesses, __entry->age)
|
| 116 | );
|
| 117 |
|
| 118 | TRACE_EVENT(damon_monitor_intervals_tune,
|
| 119 |
|
| 120 | TP_PROTO(unsigned long sample_us),
|
| 121 |
|
| 122 | TP_ARGS(sample_us),
|
| 123 |
|
| 124 | TP_STRUCT__entry(
|
| 125 | __field(unsigned long, sample_us)
|
| 126 | ),
|
| 127 |
|
| 128 | TP_fast_assign(
|
| 129 | __entry->sample_us = sample_us;
|
| 130 | ),
|
| 131 |
|
| 132 | TP_printk("sample_us=%lu", __entry->sample_us)
|
| 133 | );
|
| 134 |
|
| 135 | TRACE_EVENT_CONDITION(damon_region_aggregated,
|
| 136 |
|
| 137 | TP_PROTO(unsigned int target_id, struct damon_region *r,
|
| 138 | unsigned int nr_regions, unsigned int nr_probes),
|
| 139 |
|
| 140 | TP_ARGS(target_id, r, nr_regions, nr_probes),
|
| 141 |
|
| 142 | TP_CONDITION(nr_probes > 0),
|
| 143 |
|
| 144 | TP_STRUCT__entry(
|
| 145 | __field(unsigned long, target_id)
|
| 146 | __field(unsigned long, start)
|
| 147 | __field(unsigned long, end)
|
| 148 | __field(unsigned int, nr_regions)
|
| 149 | __field(unsigned int, nr_accesses)
|
| 150 | __field(unsigned int, age)
|
| 151 | __dynamic_array(unsigned char, probe_hits, nr_probes)
|
| 152 | ),
|
| 153 |
|
| 154 | TP_fast_assign(
|
| 155 | __entry->target_id = target_id;
|
| 156 | __entry->start = r->ar.start;
|
| 157 | __entry->end = r->ar.end;
|
| 158 | __entry->nr_regions = nr_regions;
|
| 159 | __entry->nr_accesses = r->nr_accesses;
|
| 160 | __entry->age = r->age;
|
| 161 | memcpy(__get_dynamic_array(probe_hits), r->probe_hits,
|
| 162 | sizeof(*r->probe_hits) * nr_probes);
|
| 163 | ),
|
| 164 |
|
| 165 | TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u %u probe_hits=%s",
|
| 166 | __entry->target_id, __entry->nr_regions,
|
| 167 | __entry->start, __entry->end,
|
| 168 | __entry->nr_accesses, __entry->age,
|
| 169 | __print_hex(__get_dynamic_array(probe_hits),
|
| 170 | __get_dynamic_array_len(probe_hits)))
|
| 171 | );
|
| 172 |
|
| 173 | TRACE_EVENT(damon_aggregated,
|
| 174 |
|
| 175 | TP_PROTO(unsigned int target_id, struct damon_region *r,
|
| 176 | unsigned int nr_regions),
|
| 177 |
|
| 178 | TP_ARGS(target_id, r, nr_regions),
|
| 179 |
|
| 180 | TP_STRUCT__entry(
|
| 181 | __field(unsigned long, target_id)
|
| 182 | __field(unsigned int, nr_regions)
|
| 183 | __field(unsigned long, start)
|
| 184 | __field(unsigned long, end)
|
| 185 | __field(unsigned int, nr_accesses)
|
| 186 | __field(unsigned int, age)
|
| 187 | ),
|
| 188 |
|
| 189 | TP_fast_assign(
|
| 190 | __entry->target_id = target_id;
|
| 191 | __entry->nr_regions = nr_regions;
|
| 192 | __entry->start = r->ar.start;
|
| 193 | __entry->end = r->ar.end;
|
| 194 | __entry->nr_accesses = r->nr_accesses;
|
| 195 | __entry->age = r->age;
|
| 196 | ),
|
| 197 |
|
| 198 | TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u %u",
|
| 199 | __entry->target_id, __entry->nr_regions,
|
| 200 | __entry->start, __entry->end,
|
| 201 | __entry->nr_accesses, __entry->age)
|
| 202 | );
|
| 203 |
|
| 204 | #endif
|
| 205 |
|
| 206 |
|
| 207 | #include <trace/define_trace.h>
|