xref: /linux/tools/tracing/rtla/src/osnoise.h (revision 5ddc4497508a628b6c18653a0d5208edc6228aaf)
1 // SPDX-License-Identifier: GPL-2.0
2 #pragma once
3 
4 #include "common.h"
5 
6 enum osnoise_mode {
7 	MODE_OSNOISE = 0,
8 	MODE_HWNOISE
9 };
10 
11 struct osnoise_params {
12 	struct common_params	common;
13 	unsigned long long	runtime;
14 	unsigned long long	period;
15 	long long		threshold;
16 	enum osnoise_mode	mode;
17 };
18 
19 #define to_osnoise_params(ptr) container_of(ptr, struct osnoise_params, common)
20 
21 struct osnoise_context *osnoise_context_alloc(void);
22 int osnoise_get_context(struct osnoise_context *context);
23 void osnoise_put_context(struct osnoise_context *context);
24 
25 int osnoise_set_runtime_period(struct osnoise_context *context,
26 			       long long runtime,
27 			       long long period);
28 void osnoise_restore_runtime_period(struct osnoise_context *context);
29 
30 void osnoise_report_invalid_events(struct osnoise_tool *tool);
31 void osnoise_report_missed_events(struct osnoise_tool *tool);
32 int osnoise_apply_config(struct osnoise_tool *tool, struct osnoise_params *params);
33 
34 int osnoise_enable(struct osnoise_tool *tool);
35 int osnoise_main(int argc, char **argv);
36 int hwnoise_main(int argc, char **argv);
37 
38 int osnoise_init_ipi_filters(struct osnoise_tool *tool,
39 			     struct common_params *params,
40 			     bool *filters_enabled);
41 
42 extern struct tool_ops timerlat_top_ops, timerlat_hist_ops;
43 extern struct tool_ops osnoise_top_ops, osnoise_hist_ops;
44 
45 int run_tool(struct tool_ops *ops, int argc, char *argv[]);
46