Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|---|
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM osnoise |
| 4 | |
| 5 | #if !defined(_OSNOISE_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | |
| 7 | #ifndef _OSNOISE_TRACE_H |
| 8 | #define _OSNOISE_TRACE_H |
| 9 | /* |
| 10 | * osnoise sample structure definition. Used to store the statistics of a |
| 11 | * sample run. |
| 12 | */ |
| 13 | struct osnoise_sample { |
| 14 | u64 runtime; /* runtime */ |
| 15 | u64 noise; /* noise */ |
| 16 | u64 max_sample; /* max single noise sample */ |
| 17 | int hw_count; /* # HW (incl. hypervisor) interference */ |
| 18 | int nmi_count; /* # NMIs during this sample */ |
| 19 | int irq_count; /* # IRQs during this sample */ |
| 20 | int softirq_count; /* # softirqs during this sample */ |
| 21 | int thread_count; /* # threads during this sample */ |
| 22 | }; |
| 23 | |
| 24 | #ifdef CONFIG_TIMERLAT_TRACER |
| 25 | /* |
| 26 | * timerlat sample structure definition. Used to store the statistics of |
| 27 | * a sample run. |
| 28 | */ |
| 29 | struct timerlat_sample { |
| 30 | u64 timer_latency; /* timer_latency */ |
| 31 | unsigned int seqnum; /* unique sequence */ |
| 32 | int context; /* timer context */ |
| 33 | }; |
| 34 | #endif // CONFIG_TIMERLAT_TRACER |
| 35 | #endif // _OSNOISE_TRACE_H |
| 36 | |
| 37 | #include <linux/tracepoint.h> |
| 38 | TRACE_EVENT(osnoise_sample, |
| 39 | |
| 40 | TP_PROTO(struct osnoise_sample *s), |
| 41 | |
| 42 | TP_ARGS(s), |
| 43 | |
| 44 | TP_STRUCT__entry( |
| 45 | __field( u64, runtime ) |
| 46 | __field( u64, noise ) |
| 47 | __field( u64, max_sample ) |
| 48 | __field( int, hw_count ) |
| 49 | __field( int, irq_count ) |
| 50 | __field( int, nmi_count ) |
| 51 | __field( int, softirq_count ) |
| 52 | __field( int, thread_count ) |
| 53 | ), |
| 54 | |
| 55 | TP_fast_assign( |
| 56 | __entry->runtime = s->runtime; |
| 57 | __entry->noise = s->noise; |
| 58 | __entry->max_sample = s->max_sample; |
| 59 | __entry->hw_count = s->hw_count; |
| 60 | __entry->irq_count = s->irq_count; |
| 61 | __entry->nmi_count = s->nmi_count; |
| 62 | __entry->softirq_count = s->softirq_count; |
| 63 | __entry->thread_count = s->thread_count; |
| 64 | ), |
| 65 | |
| 66 | TP_printk("runtime=%llu noise=%llu max_sample=%llu hw_count=%d" |
| 67 | " irq_count=%d nmi_count=%d softirq_count=%d" |
| 68 | " thread_count=%d", |
| 69 | __entry->runtime, |
| 70 | __entry->noise, |
| 71 | __entry->max_sample, |
| 72 | __entry->hw_count, |
| 73 | __entry->irq_count, |
| 74 | __entry->nmi_count, |
| 75 | __entry->softirq_count, |
| 76 | __entry->thread_count) |
| 77 | ); |
| 78 | |
| 79 | #ifdef CONFIG_TIMERLAT_TRACER |
| 80 | TRACE_EVENT(timerlat_sample, |
| 81 | |
| 82 | TP_PROTO(struct timerlat_sample *s), |
| 83 | |
| 84 | TP_ARGS(s), |
| 85 | |
| 86 | TP_STRUCT__entry( |
| 87 | __field( u64, timer_latency ) |
| 88 | __field( unsigned int, seqnum ) |
| 89 | __field( int, context ) |
| 90 | ), |
| 91 | |
| 92 | TP_fast_assign( |
| 93 | __entry->timer_latency = s->timer_latency; |
| 94 | __entry->seqnum = s->seqnum; |
| 95 | __entry->context = s->context; |
| 96 | ), |
| 97 | |
| 98 | TP_printk("timer_latency=%llu seqnum=%u context=%d", |
| 99 | __entry->timer_latency, |
| 100 | __entry->seqnum, |
| 101 | __entry->context) |
| 102 | ); |
| 103 | #endif // CONFIG_TIMERLAT_TRACER |
| 104 | |
| 105 | TRACE_EVENT(thread_noise, |
| 106 | |
| 107 | TP_PROTO(struct task_struct *t, u64 start, u64 duration), |
| 108 | |
| 109 | TP_ARGS(t, start, duration), |
| 110 | |
| 111 | TP_STRUCT__entry( |
| 112 | __array( char, comm, TASK_COMM_LEN) |
| 113 | __field( u64, start ) |
| 114 | __field( u64, duration) |
| 115 | __field( pid_t, pid ) |
| 116 | ), |
| 117 | |
| 118 | TP_fast_assign( |
| 119 | memcpy(__entry->comm, t->comm, TASK_COMM_LEN); |
| 120 | __entry->pid = t->pid; |
| 121 | __entry->start = start; |
| 122 | __entry->duration = duration; |
| 123 | ), |
| 124 | |
| 125 | TP_printk("%8s:%d start %llu.%09u duration %llu ns", |
| 126 | __entry->comm, |
| 127 | __entry->pid, |
| 128 | __print_ns_to_secs(__entry->start), |
| 129 | __print_ns_without_secs(__entry->start), |
| 130 | __entry->duration) |
| 131 | ); |
| 132 | |
| 133 | TRACE_EVENT(softirq_noise, |
| 134 | |
| 135 | TP_PROTO(int vector, u64 start, u64 duration), |
| 136 | |
| 137 | TP_ARGS(vector, start, duration), |
| 138 | |
| 139 | TP_STRUCT__entry( |
| 140 | __field( u64, start ) |
| 141 | __field( u64, duration) |
| 142 | __field( int, vector ) |
| 143 | ), |
| 144 | |
| 145 | TP_fast_assign( |
| 146 | __entry->vector = vector; |
| 147 | __entry->start = start; |
| 148 | __entry->duration = duration; |
| 149 | ), |
| 150 | |
| 151 | TP_printk("%8s:%d start %llu.%09u duration %llu ns", |
| 152 | show_softirq_name(__entry->vector), |
| 153 | __entry->vector, |
| 154 | __print_ns_to_secs(__entry->start), |
| 155 | __print_ns_without_secs(__entry->start), |
| 156 | __entry->duration) |
| 157 | ); |
| 158 | |
| 159 | TRACE_EVENT(irq_noise, |
| 160 | |
| 161 | TP_PROTO(int vector, const char *desc, u64 start, u64 duration), |
| 162 | |
| 163 | TP_ARGS(vector, desc, start, duration), |
| 164 | |
| 165 | TP_STRUCT__entry( |
| 166 | __field( u64, start ) |
| 167 | __field( u64, duration) |
| 168 | __string( desc, desc ) |
| 169 | __field( int, vector ) |
| 170 | |
| 171 | ), |
| 172 | |
| 173 | TP_fast_assign( |
| 174 | __assign_str(desc); |
| 175 | __entry->vector = vector; |
| 176 | __entry->start = start; |
| 177 | __entry->duration = duration; |
| 178 | ), |
| 179 | |
| 180 | TP_printk("%s:%d start %llu.%09u duration %llu ns", |
| 181 | __get_str(desc), |
| 182 | __entry->vector, |
| 183 | __print_ns_to_secs(__entry->start), |
| 184 | __print_ns_without_secs(__entry->start), |
| 185 | __entry->duration) |
| 186 | ); |
| 187 | |
| 188 | TRACE_EVENT(nmi_noise, |
| 189 | |
| 190 | TP_PROTO(u64 start, u64 duration), |
| 191 | |
| 192 | TP_ARGS(start, duration), |
| 193 | |
| 194 | TP_STRUCT__entry( |
| 195 | __field( u64, start ) |
| 196 | __field( u64, duration) |
| 197 | ), |
| 198 | |
| 199 | TP_fast_assign( |
| 200 | __entry->start = start; |
| 201 | __entry->duration = duration; |
| 202 | ), |
| 203 | |
| 204 | TP_printk("start %llu.%09u duration %llu ns", |
| 205 | __print_ns_to_secs(__entry->start), |
| 206 | __print_ns_without_secs(__entry->start), |
| 207 | __entry->duration) |
| 208 | ); |
| 209 | |
| 210 | TRACE_EVENT(sample_threshold, |
| 211 | |
| 212 | TP_PROTO(u64 start, u64 duration, u64 interference), |
| 213 | |
| 214 | TP_ARGS(start, duration, interference), |
| 215 | |
| 216 | TP_STRUCT__entry( |
| 217 | __field( u64, start ) |
| 218 | __field( u64, duration) |
| 219 | __field( u64, interference) |
| 220 | ), |
| 221 | |
| 222 | TP_fast_assign( |
| 223 | __entry->start = start; |
| 224 | __entry->duration = duration; |
| 225 | __entry->interference = interference; |
| 226 | ), |
| 227 | |
| 228 | TP_printk("start %llu.%09u duration %llu ns interference %llu", |
| 229 | __print_ns_to_secs(__entry->start), |
| 230 | __print_ns_without_secs(__entry->start), |
| 231 | __entry->duration, |
| 232 | __entry->interference) |
| 233 | ); |
| 234 | |
| 235 | #endif /* _TRACE_OSNOISE_H */ |
| 236 | |
| 237 | /* This part must be outside protection */ |
| 238 | #include <trace/define_trace.h> |
| 239 |
Warning: This file is not a C or C++ file. It does not have highlighting.
