-
Notifications
You must be signed in to change notification settings - Fork 1
/
rt-graph.h
244 lines (205 loc) · 6.95 KB
/
rt-graph.h
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#ifndef _RT_GRAPH_H
#define _RT_GRAPH_H
#include <gtk/gtk.h>
#include "task-list.h"
#include "trace-cmd.h"
#include "rt-plot.h"
#include "rt-plot-task.h"
#include "rt-plot-cpu.h"
#include "rt-plot-container.h"
#define LLABEL 30
#define SEARCH_PERIODS 5
#define NO_CPU -1
#define RT_TS_FIELD "__rt_ts"
#define TS_HASH_SIZE 12
#define CONT_HASH_SIZE 12
struct ts_list;
struct vcpu_list;
struct rt_graph_info {
/* For ignoring records before system release */
gboolean clean_records;
long long start_time;
long long end_time;
gdouble start_offset;
gdouble duration;
/* List of all real-time tasks */
struct task_list *tasks[TASK_HASH_SIZE];
/* List of all real-time containers */
struct cont_list *containers[CONT_HASH_SIZE];
/* Cache of event fields so that they don't need to be located
* during each access.
*/
gint task_param_id;
struct format_field *param_pid_field;
struct format_field *param_wcet_field;
struct format_field *param_period_field;
gint switch_to_id;
struct format_field *switch_to_pid_field;
struct format_field *switch_to_job_field;
gint switch_away_id;
struct format_field *switch_away_pid_field;
struct format_field *switch_away_job_field;
gint task_release_id;
struct format_field *release_pid_field;
struct format_field *release_job_field;
struct format_field *release_release_field;
struct format_field *release_deadline_field;
gint task_completion_id;
struct format_field *completion_pid_field;
struct format_field *completion_job_field;
gint task_block_id;
struct format_field *block_pid_field;
struct format_field *block_lid_field;
gint task_resume_id;
struct format_field *resume_pid_field;
struct format_field *resume_lid_field;
gint sys_release_id;
struct format_field *sys_release_rel_field;
gint container_param_id;
struct format_field *cparam_cid_field;
struct format_field *cparam_name_field;
gint server_param_id;
struct format_field *sparam_sid_field;
struct format_field *sparam_cid_field;
struct format_field *sparam_wcet_field;
struct format_field *sparam_period_field;
gint server_switch_to_id;
struct format_field *sswitch_to_sid_field;
struct format_field *sswitch_to_job_field;
struct format_field *sswitch_to_tid_field;
struct format_field *sswitch_to_tjob_field;
struct format_field *sswitch_to_cpu_field;
gint server_switch_away_id;
struct format_field *sswitch_away_sid_field;
struct format_field *sswitch_away_job_field;
struct format_field *sswitch_away_tid_field;
struct format_field *sswitch_away_tjob_field;
struct format_field *sswitch_away_cpu_field;
gint server_release_id;
struct format_field *srelease_sid_field;
struct format_field *srelease_job_field;
struct format_field *srelease_release_field;
struct format_field *srelease_deadline_field;
gint server_completion_id;
struct format_field *scompletion_sid_field;
struct format_field *scompletion_job_field;
gint server_block_id;
struct format_field *sblock_sid_field;
gint server_resume_id;
struct format_field *sresume_sid_field;
/* Cache of ts fields for non-litmus events */
struct ts_list *events[TS_HASH_SIZE];
/* Used to calculate maximum search times */
unsigned long long max_period;
};
/*
* A list of cached time-stamp fields
*/
struct ts_list {
struct ts_list *next;
gint eid;
struct format_field *ts_field;
};
/*
* Per-task real-time data
*/
struct rt_task_params {
unsigned long long wcet;
unsigned long long period;
};
/*
* A list of servers
*/
struct vcpu_list {
struct vcpu_list *next;
gint sid;
struct rt_task_params params;
};
/*
* A list of containers
*/
struct cont_list {
struct cont_list *next;
gint cid;
gboolean plotted;
const char* name;
struct vcpu_list *vcpus;
};
/* Event parsers */
int rt_graph_check_any(struct graph_info *ginfo, struct record *record,
gint *pid, gint *eid, unsigned long long *ts);
int rt_graph_check_task_param(struct graph_info *ginfo,
struct record *record, gint *pid,
unsigned long long *wcet,
unsigned long long *period);
int rt_graph_check_switch_to(struct graph_info *ginfo,
struct record *record, gint *pid, gint *job,
unsigned long long *when);
int rt_graph_check_switch_away(struct graph_info *ginfo,
struct record *record, gint *pid, gint *job,
unsigned long long *when);
int rt_graph_check_task_release(struct graph_info *ginfo,
struct record *record, gint *pid, gint *job,
unsigned long long *release,
unsigned long long *deadline);
int rt_graph_check_task_completion(struct graph_info *ginfo,
struct record *record, gint *pid, gint *job,
unsigned long long *when);
int rt_graph_check_task_block(struct graph_info *ginfo,
struct record *record, gint *pid, gint *lid,
unsigned long long *when);
int rt_graph_check_task_resume(struct graph_info *ginfo, struct record *record,
gint *pid, gint *lid, unsigned long long *when);
int rt_graph_check_container_param(struct graph_info *ginfo,
struct record *record,
gint *cid, char **name);
int rt_graph_check_server_param(struct graph_info *ginfo, struct record *record,
gint *sid, gint *cid,
unsigned long long *wcet,
unsigned long long *period);
int rt_graph_check_server_switch_to(struct graph_info *ginfo,
struct record *record,
gint *sid, gint *job, gint *tid, gint *tjob, gint *cpu,
unsigned long long *when);
int rt_graph_check_server_switch_away(struct graph_info *ginfo,
struct record *record,
gint *sid, gint *job, gint *tid, gint *tjob, gint *cpu,
unsigned long long *when);
int rt_graph_check_server_release(struct graph_info *ginfo,
struct record *record,
gint *sid, gint *job,
unsigned long long *release,
unsigned long long *deadline);
int rt_graph_check_server_completion(struct graph_info *ginfo,
struct record *record,
gint *sid, gint *job,
unsigned long long *when);
int rt_graph_check_server_block(struct graph_info *ginfo,
struct record *record, gint *pid,
unsigned long long *when);
int rt_graph_check_server_resume(struct graph_info *ginfo, struct record *record,
gint *pid, unsigned long long *when);
int rt_graph_check_sys_release(struct graph_info *ginfo, struct record *record,
unsigned long long *when);
void init_rt_event_cache(struct rt_graph_info *rtinfo);
unsigned long long get_rts(struct graph_info *ginfo,
struct record *record);
/* Other */
struct cont_list* find_container(struct cont_list **conts, gint cid, gint key);
static inline void nano_to_milli(unsigned long long time,
unsigned long long *msec,
unsigned long long *nsec)
{
*msec = time / 1000000ULL;
*nsec = time % 1000000ULL;
}
static inline float nano_as_milli(unsigned long long time)
{
return (float)time / 1000000ULL;
}
static inline int get_container_key(gint cid)
{
return trace_hash(cid) % CONT_HASH_SIZE;
}
#define max_rt_search(ginfo) (SEARCH_PERIODS*ginfo->rtg_info.max_period)
#endif