1 // SPDX-License-Identifier: GPL-2.0 2 #include "actions.h" 3 #include "osnoise.h" 4 5 /* 6 * Define timerlat tracing mode. 7 * 8 * There are three tracing modes: 9 * - tracefs-only, used when BPF is unavailable. 10 * - BPF-only, used when BPF is available and neither trace saving nor 11 * auto-analysis are enabled. 12 * - mixed mode, used when BPF is available and either trace saving or 13 * auto-analysis is enabled (which rely on sample collection through 14 * tracefs). 15 */ 16 enum timerlat_tracing_mode { 17 TRACING_MODE_BPF, 18 TRACING_MODE_TRACEFS, 19 TRACING_MODE_MIXED, 20 }; 21 22 struct timerlat_params { 23 /* Common params */ 24 char *cpus; 25 cpu_set_t monitored_cpus; 26 char *cgroup_name; 27 unsigned long long runtime; 28 long long stop_us; 29 long long stop_total_us; 30 long long timerlat_period_us; 31 long long print_stack; 32 int sleep_time; 33 int output_divisor; 34 int duration; 35 int set_sched; 36 int dma_latency; 37 int no_aa; 38 int dump_tasks; 39 int cgroup; 40 int hk_cpus; 41 int user_workload; 42 int kernel_workload; 43 int user_data; 44 int warmup; 45 int buffer_size; 46 int deepest_idle_state; 47 cpu_set_t hk_cpu_set; 48 struct sched_attr sched_param; 49 struct trace_events *events; 50 enum timerlat_tracing_mode mode; 51 52 struct actions threshold_actions; 53 struct actions end_actions; 54 55 union { 56 struct { 57 /* top only */ 58 int quiet; 59 int aa_only; 60 int pretty_output; 61 }; 62 struct { 63 /* hist only */ 64 char no_irq; 65 char no_thread; 66 char no_header; 67 char no_summary; 68 char no_index; 69 char with_zeros; 70 int bucket_size; 71 int entries; 72 }; 73 }; 74 }; 75 76 int timerlat_apply_config(struct osnoise_tool *tool, struct timerlat_params *params); 77 78 int timerlat_hist_main(int argc, char *argv[]); 79 int timerlat_top_main(int argc, char *argv[]); 80 int timerlat_main(int argc, char *argv[]); 81