| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 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_tried=%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_regions, bool do_trace), |
| 82 |
|
| 83 |
TP_ARGS(context_idx, scheme_idx, target_idx, r, nr_regions, do_trace), |
| 84 |
|
| 85 |
TP_CONDITION(do_trace), |
| 86 |
|
| 87 |
TP_STRUCT__entry( |
| 88 |
__field(unsigned int, context_idx) |
| 89 |
__field(unsigned int, scheme_idx) |
| 90 |
__field(unsigned long, target_idx) |
| 91 |
__field(unsigned long, start) |
| 92 |
__field(unsigned long, end) |
| 93 |
__field(unsigned int, nr_accesses) |
| 94 |
__field(unsigned int, age) |
| 95 |
__field(unsigned int, nr_regions) |
| 96 |
), |
| 97 |
|
| 98 |
TP_fast_assign( |
| 99 |
__entry->context_idx = context_idx; |
| 100 |
__entry->scheme_idx = scheme_idx; |
| 101 |
__entry->target_idx = target_idx; |
| 102 |
__entry->start = r->ar.start; |
| 103 |
__entry->end = r->ar.end; |
| 104 |
__entry->nr_accesses = r->nr_accesses_bp / 10000; |
| 105 |
__entry->age = r->age; |
| 106 |
__entry->nr_regions = nr_regions; |
| 107 |
), |
| 108 |
|
| 109 |
TP_printk("ctx_idx=%u scheme_idx=%u target_idx=%lu nr_regions=%u %lu-%lu: %u %u", |
| 110 |
__entry->context_idx, __entry->scheme_idx, |
| 111 |
__entry->target_idx, __entry->nr_regions, |
| 112 |
__entry->start, __entry->end, |
| 113 |
__entry->nr_accesses, __entry->age) |
| 114 |
); |
| 115 |
|
| 116 |
TRACE_EVENT(damon_monitor_intervals_tune, |
| 117 |
|
| 118 |
TP_PROTO(unsigned long sample_us), |
| 119 |
|
| 120 |
TP_ARGS(sample_us), |
| 121 |
|
| 122 |
TP_STRUCT__entry( |
| 123 |
__field(unsigned long, sample_us) |
| 124 |
), |
| 125 |
|
| 126 |
TP_fast_assign( |
| 127 |
__entry->sample_us = sample_us; |
| 128 |
), |
| 129 |
|
| 130 |
TP_printk("sample_us=%lu", __entry->sample_us) |
| 131 |
); |
| 132 |
|
| 133 |
TRACE_EVENT(damon_aggregated, |
| 134 |
|
| 135 |
TP_PROTO(unsigned int target_id, struct damon_region *r, |
| 136 |
unsigned int nr_regions), |
| 137 |
|
| 138 |
TP_ARGS(target_id, r, nr_regions), |
| 139 |
|
| 140 |
TP_STRUCT__entry( |
| 141 |
__field(unsigned long, target_id) |
| 142 |
__field(unsigned int, nr_regions) |
| 143 |
__field(unsigned long, start) |
| 144 |
__field(unsigned long, end) |
| 145 |
__field(unsigned int, nr_accesses) |
| 146 |
__field(unsigned int, age) |
| 147 |
), |
| 148 |
|
| 149 |
TP_fast_assign( |
| 150 |
__entry->target_id = target_id; |
| 151 |
__entry->nr_regions = nr_regions; |
| 152 |
__entry->start = r->ar.start; |
| 153 |
__entry->end = r->ar.end; |
| 154 |
__entry->nr_accesses = r->nr_accesses; |
| 155 |
__entry->age = r->age; |
| 156 |
), |
| 157 |
|
| 158 |
TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u %u", |
| 159 |
__entry->target_id, __entry->nr_regions, |
| 160 |
__entry->start, __entry->end, |
| 161 |
__entry->nr_accesses, __entry->age) |
| 162 |
); |
| 163 |
|
| 164 |
#endif /* _TRACE_DAMON_H */ |
| 165 |
|
| 166 |
/* This part must be outside protection */ |
| 167 |
#include <trace/define_trace.h> |