xref: /linux/tools/tracing/rtla/src/timerlat.h (revision 03d745b9843560ab89a796d0d9311bed5c6df6d6)
1 // SPDX-License-Identifier: GPL-2.0
2 #pragma once
3 
4 #include "osnoise.h"
5 
6 /*
7  * Define timerlat tracing mode.
8  *
9  * There are three tracing modes:
10  * - tracefs-only, used when BPF is unavailable.
11  * - BPF-only, used when BPF is available and neither trace saving nor
12  * auto-analysis are enabled.
13  * - mixed mode, used when BPF is available and either trace saving or
14  * auto-analysis is enabled (which rely on sample collection through
15  * tracefs).
16  */
17 enum timerlat_tracing_mode {
18 	TRACING_MODE_BPF,
19 	TRACING_MODE_TRACEFS,
20 	TRACING_MODE_MIXED,
21 };
22 
23 struct timerlat_params {
24 	struct common_params	common;
25 	long long		timerlat_period_us;
26 	long long		print_stack;
27 	int			dma_latency;
28 	bool			no_aa;
29 	bool			dump_tasks;
30 	int			deepest_idle_state;
31 	enum timerlat_tracing_mode mode;
32 	const char		*bpf_action_program;
33 	enum stack_format	stack_format;
34 	bool			timerlat_align;
35 	unsigned long long	timerlat_align_us;
36 };
37 
38 #define to_timerlat_params(ptr) container_of(ptr, struct timerlat_params, common)
39 
40 int timerlat_apply_config(struct osnoise_tool *tool, struct timerlat_params *params);
41 int timerlat_main(int argc, char *argv[]);
42 int timerlat_enable(struct osnoise_tool *tool);
43 void timerlat_analyze(struct osnoise_tool *tool, bool stopped);
44 void timerlat_free(struct osnoise_tool *tool);
45