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 /* 22 * *_INIT_VALs are also invalid values, they are used to 23 * communicate errors. 24 */ 25 #define OSNOISE_OPTION_INIT_VAL (-1) 26 #define OSNOISE_TIME_INIT_VAL (0) 27 28 struct osnoise_context *osnoise_context_alloc(void); 29 int osnoise_get_context(struct osnoise_context *context); 30 void osnoise_put_context(struct osnoise_context *context); 31 32 int osnoise_set_runtime_period(struct osnoise_context *context, 33 unsigned long long runtime, 34 unsigned long long period); 35 void osnoise_restore_runtime_period(struct osnoise_context *context); 36 37 int osnoise_set_stop_us(struct osnoise_context *context, 38 long long stop_us); 39 void osnoise_restore_stop_us(struct osnoise_context *context); 40 41 int osnoise_set_stop_total_us(struct osnoise_context *context, 42 long long stop_total_us); 43 void osnoise_restore_stop_total_us(struct osnoise_context *context); 44 45 int osnoise_set_timerlat_period_us(struct osnoise_context *context, 46 long long timerlat_period_us); 47 void osnoise_restore_timerlat_period_us(struct osnoise_context *context); 48 49 int osnoise_set_tracing_thresh(struct osnoise_context *context, 50 long long tracing_thresh); 51 void osnoise_restore_tracing_thresh(struct osnoise_context *context); 52 53 void osnoise_restore_print_stack(struct osnoise_context *context); 54 int osnoise_set_print_stack(struct osnoise_context *context, 55 long long print_stack); 56 57 int osnoise_set_irq_disable(struct osnoise_context *context, bool onoff); 58 void osnoise_report_missed_events(struct osnoise_tool *tool); 59 int osnoise_apply_config(struct osnoise_tool *tool, struct osnoise_params *params); 60 61 int osnoise_hist_main(int argc, char *argv[]); 62 int osnoise_top_main(int argc, char **argv); 63 int osnoise_enable(struct osnoise_tool *tool); 64 int osnoise_main(int argc, char **argv); 65 int hwnoise_main(int argc, char **argv); 66 67 extern struct tool_ops timerlat_top_ops, timerlat_hist_ops; 68 extern struct tool_ops osnoise_top_ops, osnoise_hist_ops; 69 70 int run_tool(struct tool_ops *ops, int argc, char *argv[]); 71 int hist_main_loop(struct osnoise_tool *tool); 72