blob: 355f113a14a3647063eacf753d340cb566daa319 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
/* SPDX-License-Identifier: GPL-2.0 */
#pragma once
#include "actions.h"
#include "timerlat_u.h"
#include "trace.h"
#include "utils.h"
/*
* osnoise_context - read, store, write, restore osnoise configs.
*/
struct osnoise_context {
int flags;
int ref;
char *curr_cpus;
char *orig_cpus;
/* 0 as init value */
unsigned long long orig_runtime_us;
unsigned long long runtime_us;
/* 0 as init value */
unsigned long long orig_period_us;
unsigned long long period_us;
/* 0 as init value */
long long orig_timerlat_period_us;
long long timerlat_period_us;
/* 0 as init value */
long long orig_tracing_thresh;
long long tracing_thresh;
/* -1 as init value because 0 is disabled */
long long orig_stop_us;
long long stop_us;
/* -1 as init value because 0 is disabled */
long long orig_stop_total_us;
long long stop_total_us;
/* -1 as init value because 0 is disabled */
long long orig_print_stack;
long long print_stack;
/* -1 as init value because 0 is off */
int orig_opt_irq_disable;
int opt_irq_disable;
/* -1 as init value because 0 is off */
int orig_opt_workload;
int opt_workload;
};
extern struct trace_instance *trace_inst;
extern int stop_tracing;
struct hist_params {
char no_irq;
char no_thread;
char no_header;
char no_summary;
char no_index;
char with_zeros;
int bucket_size;
int entries;
};
/*
* common_params - Parameters shared between timerlat_params and osnoise_params
*/
struct common_params {
/* trace configuration */
char *cpus;
cpu_set_t monitored_cpus;
struct trace_events *events;
int buffer_size;
/* Timing parameters */
int warmup;
long long stop_us;
long long stop_total_us;
int sleep_time;
int duration;
/* Scheduling parameters */
int set_sched;
struct sched_attr sched_param;
int cgroup;
char *cgroup_name;
int hk_cpus;
cpu_set_t hk_cpu_set;
/* Other parameters */
struct hist_params hist;
int output_divisor;
int pretty_output;
int quiet;
int user_workload;
int kernel_workload;
int user_data;
int aa_only;
struct actions threshold_actions;
struct actions end_actions;
struct timerlat_u_params user;
};
struct tool_ops;
/*
* osnoise_tool - osnoise based tool definition.
*
* Only the "trace" and "context" fields are used for
* the additional trace instances (record and aa).
*/
struct osnoise_tool {
struct tool_ops *ops;
struct trace_instance trace;
struct osnoise_context *context;
void *data;
struct common_params *params;
time_t start_time;
struct osnoise_tool *record;
struct osnoise_tool *aa;
};
struct tool_ops {
const char *tracer;
const char *comm_prefix;
struct common_params *(*parse_args)(int argc, char *argv[]);
struct osnoise_tool *(*init_tool)(struct common_params *params);
int (*apply_config)(struct osnoise_tool *tool);
int (*enable)(struct osnoise_tool *tool);
int (*main)(struct osnoise_tool *tool);
void (*print_stats)(struct osnoise_tool *tool);
void (*analyze)(struct osnoise_tool *tool, bool stopped);
void (*free)(struct osnoise_tool *tool);
};
int osnoise_set_cpus(struct osnoise_context *context, char *cpus);
void osnoise_restore_cpus(struct osnoise_context *context);
int osnoise_set_workload(struct osnoise_context *context, bool onoff);
void osnoise_destroy_tool(struct osnoise_tool *top);
struct osnoise_tool *osnoise_init_tool(char *tool_name);
struct osnoise_tool *osnoise_init_trace_tool(const char *tracer);
bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *record);
int common_apply_config(struct osnoise_tool *tool, struct common_params *params);
int top_main_loop(struct osnoise_tool *tool);
int hist_main_loop(struct osnoise_tool *tool);
|