trace_osnoise.c (ca712e47054678c5ce93a0e0f686353ad5561195) trace_osnoise.c (cae16f2c2e11c60c888715f4d98c12740683d6a2)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * OS Noise Tracer: computes the OS Noise suffered by a running thread.
4 * Timerlat Tracer: measures the wakeup latency of a timer triggered IRQ and thread.
5 *
6 * Based on "hwlat_detector" tracer by:
7 * Copyright (C) 2008-2009 Jon Masters, Red Hat, Inc. <jcm@redhat.com>
8 * Copyright (C) 2013-2016 Steven Rostedt, Red Hat, Inc. <srostedt@redhat.com>

--- 145 unchanged lines hidden (view full) ---

154 found = 1;
155 break;
156 }
157 }
158
159 if (!found)
160 return;
161
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * OS Noise Tracer: computes the OS Noise suffered by a running thread.
4 * Timerlat Tracer: measures the wakeup latency of a timer triggered IRQ and thread.
5 *
6 * Based on "hwlat_detector" tracer by:
7 * Copyright (C) 2008-2009 Jon Masters, Red Hat, Inc. <jcm@redhat.com>
8 * Copyright (C) 2013-2016 Steven Rostedt, Red Hat, Inc. <srostedt@redhat.com>

--- 145 unchanged lines hidden (view full) ---

154 found = 1;
155 break;
156 }
157 }
158
159 if (!found)
160 return;
161
162 kvfree_rcu(inst);
162 kvfree_rcu_mightsleep(inst);
163}
164
165/*
166 * NMI runtime info.
167 */
168struct osn_nmi {
169 u64 count;
170 u64 delta_start;

--- 41 unchanged lines hidden (view full) ---

212 struct osn_softirq softirq;
213 struct osn_thread thread;
214 local_t int_counter;
215};
216
217/*
218 * Per-cpu runtime information.
219 */
163}
164
165/*
166 * NMI runtime info.
167 */
168struct osn_nmi {
169 u64 count;
170 u64 delta_start;

--- 41 unchanged lines hidden (view full) ---

212 struct osn_softirq softirq;
213 struct osn_thread thread;
214 local_t int_counter;
215};
216
217/*
218 * Per-cpu runtime information.
219 */
220static DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
220DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
221
222/*
223 * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU
224 */
225static inline struct osnoise_variables *this_cpu_osn_var(void)
226{
227 return this_cpu_ptr(&per_cpu_osnoise_var);
228}

--- 6 unchanged lines hidden (view full) ---

235 struct task_struct *kthread;
236 struct hrtimer timer;
237 u64 rel_period;
238 u64 abs_period;
239 bool tracing_thread;
240 u64 count;
241};
242
221
222/*
223 * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU
224 */
225static inline struct osnoise_variables *this_cpu_osn_var(void)
226{
227 return this_cpu_ptr(&per_cpu_osnoise_var);
228}

--- 6 unchanged lines hidden (view full) ---

235 struct task_struct *kthread;
236 struct hrtimer timer;
237 u64 rel_period;
238 u64 abs_period;
239 bool tracing_thread;
240 u64 count;
241};
242
243static DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
243DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
244
245/*
246 * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU
247 */
248static inline struct timerlat_variables *this_cpu_tmr_var(void)
249{
250 return this_cpu_ptr(&per_cpu_timerlat_var);
251}

--- 75 unchanged lines hidden (view full) ---

327 unsigned int seqnum; /* unique sequence */
328 int context; /* timer context */
329};
330#endif
331
332/*
333 * Protect the interface.
334 */
244
245/*
246 * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU
247 */
248static inline struct timerlat_variables *this_cpu_tmr_var(void)
249{
250 return this_cpu_ptr(&per_cpu_timerlat_var);
251}

--- 75 unchanged lines hidden (view full) ---

327 unsigned int seqnum; /* unique sequence */
328 int context; /* timer context */
329};
330#endif
331
332/*
333 * Protect the interface.
334 */
335static struct mutex interface_lock;
335struct mutex interface_lock;
336
337/*
338 * Tracer data.
339 */
340static struct osnoise_data {
341 u64 sample_period; /* total sampling period */
342 u64 sample_runtime; /* active sampling portion of period */
343 u64 stop_tracing; /* stop trace in the internal operation (loop/irq) */

--- 1890 unchanged lines hidden (view full) ---

2234 .val = &osnoise_data.print_stack,
2235 .max = NULL,
2236 .min = NULL,
2237};
2238
2239/*
2240 * osnoise/timerlat_period: min 100 us, max 1 s
2241 */
336
337/*
338 * Tracer data.
339 */
340static struct osnoise_data {
341 u64 sample_period; /* total sampling period */
342 u64 sample_runtime; /* active sampling portion of period */
343 u64 stop_tracing; /* stop trace in the internal operation (loop/irq) */

--- 1890 unchanged lines hidden (view full) ---

2234 .val = &osnoise_data.print_stack,
2235 .max = NULL,
2236 .min = NULL,
2237};
2238
2239/*
2240 * osnoise/timerlat_period: min 100 us, max 1 s
2241 */
2242static u64 timerlat_min_period = 100;
2243static u64 timerlat_max_period = 1000000;
2242u64 timerlat_min_period = 100;
2243u64 timerlat_max_period = 1000000;
2244static struct trace_min_max_param timerlat_period = {
2245 .lock = &interface_lock,
2246 .val = &osnoise_data.timerlat_period,
2247 .max = &timerlat_max_period,
2248 .min = &timerlat_min_period,
2249};
2250#endif
2251

--- 415 unchanged lines hidden ---
2244static struct trace_min_max_param timerlat_period = {
2245 .lock = &interface_lock,
2246 .val = &osnoise_data.timerlat_period,
2247 .max = &timerlat_max_period,
2248 .min = &timerlat_min_period,
2249};
2250#endif
2251

--- 415 unchanged lines hidden ---