xref: /linux/include/trace/events/osnoise.h (revision 24bce201d79807b668bf9d9e0aca801c5c0d5f78)
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 #define _OSNOISE_TRACE_H
7 
8 #include <linux/tracepoint.h>
9 TRACE_EVENT(thread_noise,
10 
11 	TP_PROTO(struct task_struct *t, u64 start, u64 duration),
12 
13 	TP_ARGS(t, start, duration),
14 
15 	TP_STRUCT__entry(
16 		__array(	char,		comm,	TASK_COMM_LEN)
17 		__field(	u64,		start	)
18 		__field(	u64,		duration)
19 		__field(	pid_t,		pid	)
20 	),
21 
22 	TP_fast_assign(
23 		memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
24 		__entry->pid = t->pid;
25 		__entry->start = start;
26 		__entry->duration = duration;
27 	),
28 
29 	TP_printk("%8s:%d start %llu.%09u duration %llu ns",
30 		__entry->comm,
31 		__entry->pid,
32 		__print_ns_to_secs(__entry->start),
33 		__print_ns_without_secs(__entry->start),
34 		__entry->duration)
35 );
36 
37 TRACE_EVENT(softirq_noise,
38 
39 	TP_PROTO(int vector, u64 start, u64 duration),
40 
41 	TP_ARGS(vector, start, duration),
42 
43 	TP_STRUCT__entry(
44 		__field(	u64,		start	)
45 		__field(	u64,		duration)
46 		__field(	int,		vector	)
47 	),
48 
49 	TP_fast_assign(
50 		__entry->vector = vector;
51 		__entry->start = start;
52 		__entry->duration = duration;
53 	),
54 
55 	TP_printk("%8s:%d start %llu.%09u duration %llu ns",
56 		show_softirq_name(__entry->vector),
57 		__entry->vector,
58 		__print_ns_to_secs(__entry->start),
59 		__print_ns_without_secs(__entry->start),
60 		__entry->duration)
61 );
62 
63 TRACE_EVENT(irq_noise,
64 
65 	TP_PROTO(int vector, const char *desc, u64 start, u64 duration),
66 
67 	TP_ARGS(vector, desc, start, duration),
68 
69 	TP_STRUCT__entry(
70 		__field(	u64,		start	)
71 		__field(	u64,		duration)
72 		__string(	desc,		desc    )
73 		__field(	int,		vector	)
74 
75 	),
76 
77 	TP_fast_assign(
78 		__assign_str(desc, desc);
79 		__entry->vector = vector;
80 		__entry->start = start;
81 		__entry->duration = duration;
82 	),
83 
84 	TP_printk("%s:%d start %llu.%09u duration %llu ns",
85 		__get_str(desc),
86 		__entry->vector,
87 		__print_ns_to_secs(__entry->start),
88 		__print_ns_without_secs(__entry->start),
89 		__entry->duration)
90 );
91 
92 TRACE_EVENT(nmi_noise,
93 
94 	TP_PROTO(u64 start, u64 duration),
95 
96 	TP_ARGS(start, duration),
97 
98 	TP_STRUCT__entry(
99 		__field(	u64,		start	)
100 		__field(	u64,		duration)
101 	),
102 
103 	TP_fast_assign(
104 		__entry->start = start;
105 		__entry->duration = duration;
106 	),
107 
108 	TP_printk("start %llu.%09u duration %llu ns",
109 		__print_ns_to_secs(__entry->start),
110 		__print_ns_without_secs(__entry->start),
111 		__entry->duration)
112 );
113 
114 TRACE_EVENT(sample_threshold,
115 
116 	TP_PROTO(u64 start, u64 duration, u64 interference),
117 
118 	TP_ARGS(start, duration, interference),
119 
120 	TP_STRUCT__entry(
121 		__field(	u64,		start	)
122 		__field(	u64,		duration)
123 		__field(	u64,		interference)
124 	),
125 
126 	TP_fast_assign(
127 		__entry->start = start;
128 		__entry->duration = duration;
129 		__entry->interference = interference;
130 	),
131 
132 	TP_printk("start %llu.%09u duration %llu ns interference %llu",
133 		__print_ns_to_secs(__entry->start),
134 		__print_ns_without_secs(__entry->start),
135 		__entry->duration,
136 		__entry->interference)
137 );
138 
139 #endif /* _TRACE_OSNOISE_H */
140 
141 /* This part must be outside protection */
142 #include <trace/define_trace.h>
143