aboutsummaryrefslogtreecommitdiffstats
path: root/rt-plot-vcpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'rt-plot-vcpu.c')
-rw-r--r--rt-plot-vcpu.c74
1 files changed, 44 insertions, 30 deletions
diff --git a/rt-plot-vcpu.c b/rt-plot-vcpu.c
index f327f57..0867ff7 100644
--- a/rt-plot-vcpu.c
+++ b/rt-plot-vcpu.c
@@ -19,6 +19,7 @@ static void update_tid(struct vcpu_info *info, int tid)
19 if (tid != info->run_tid) { 19 if (tid != info->run_tid) {
20 info->run_tid = tid; 20 info->run_tid = tid;
21 snprintf(info->label, LLABEL, "%d", tid); 21 snprintf(info->label, LLABEL, "%d", tid);
22 printf("Upated label to %s\n", info->label);
22 } 23 }
23} 24}
24 25
@@ -26,16 +27,16 @@ static int
26try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, 27try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
27 struct record *record, struct plot_info *info) 28 struct record *record, struct plot_info *info)
28{ 29{
29 int job, sid, tid, match, ret = 0; 30 int job, sid, tid, tjob, match, ret = 0;
30 unsigned long long ts; 31 unsigned long long ts;
31 32
32 match = rt_graph_check_server_switch_away(ginfo, record, 33 match = rt_graph_check_server_switch_away(ginfo, record,
33 &sid, &job, 34 &sid, &job,
34 &tid, &ts); 35 &tid, &tjob, &ts);
35 if (match && sid == vcpu_info->sid) { 36 if (match && sid == vcpu_info->sid) {
36 update_tid(vcpu_info, tid); 37 update_tid(vcpu_info, tid);
37 38
38 if (vcpu_info->run_time < ts) { 39 if (vcpu_info->run_time && vcpu_info->run_time < ts) {
39 info->box = TRUE; 40 info->box = TRUE;
40 info->bcolor = hash_pid(tid); 41 info->bcolor = hash_pid(tid);
41 info->bfill = vcpu_info->running; 42 info->bfill = vcpu_info->running;
@@ -48,7 +49,7 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
48 tid, sid, job, ts); 49 tid, sid, job, ts);
49 vcpu_info->run_time = 0ULL; 50 vcpu_info->run_time = 0ULL;
50 vcpu_info->run_cpu = NO_CPU; 51 vcpu_info->run_cpu = NO_CPU;
51 vcpu_info->run_tid = 0; 52 vcpu_info->run_tid = -1;
52 vcpu_info->running = FALSE; 53 vcpu_info->running = FALSE;
53 54
54 ret = 1; 55 ret = 1;
@@ -60,11 +61,11 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
60static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, 61static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
61 struct record *record, struct plot_info *info) 62 struct record *record, struct plot_info *info)
62{ 63{
63 int job, sid, tid, match, ret = 0; 64 int job, sid, tid, tjob, match, ret = 0;
64 unsigned long long ts; 65 unsigned long long ts;
65 66
66 match = rt_graph_check_server_switch_to(ginfo, record, 67 match = rt_graph_check_server_switch_to(ginfo, record,
67 &sid, &job, &tid, &ts); 68 &sid, &job, &tid, &tjob, &ts);
68 if (match && sid == vcpu_info->sid) { 69 if (match && sid == vcpu_info->sid) {
69 update_tid(vcpu_info, tid); 70 update_tid(vcpu_info, tid);
70 vcpu_info->run_time = ts; 71 vcpu_info->run_time = ts;
@@ -111,12 +112,14 @@ static int try_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info
111 if (match && pid && pid == vcpu_info->run_tid && vcpu_info->running) { 112 if (match && pid && pid == vcpu_info->run_tid && vcpu_info->running) {
112 vcpu_info->running = FALSE; 113 vcpu_info->running = FALSE;
113 114
114 info->box = TRUE; 115 if (vcpu_info->run_time && vcpu_info->run_time < ts) {
115 info->bcolor = hash_pid(pid); 116 info->box = TRUE;
116 info->bfill = TRUE; 117 info->bcolor = hash_pid(pid);
117 info->bstart = vcpu_info->run_time; 118 info->bfill = TRUE;
118 info->bend = ts; 119 info->bstart = vcpu_info->run_time;
119 info->blabel = vcpu_info->label; 120 info->bend = ts;
121 info->blabel = vcpu_info->label;
122 }
120 123
121 vcpu_info->run_time = ts; 124 vcpu_info->run_time = ts;
122 ret = 1; 125 ret = 1;
@@ -127,7 +130,7 @@ static int try_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info
127static void do_plot_end(struct graph_info *ginfo, struct vcpu_info *vcpu_info, 130static void do_plot_end(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
128 struct plot_info *info) 131 struct plot_info *info)
129{ 132{
130 int tid, job, is_running; 133 int tid, job, tjob, is_running;
131 unsigned long long deadline, release; 134 unsigned long long deadline, release;
132 struct record *record; 135 struct record *record;
133 136
@@ -147,7 +150,7 @@ static void do_plot_end(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
147 vcpu_info->sid, 150 vcpu_info->sid,
148 ginfo->view_end_time, 151 ginfo->view_end_time,
149 &release, &deadline, 152 &release, &deadline,
150 &job, &tid, &record); 153 &job, &tid, &tjob, &record);
151 if (is_running) { 154 if (is_running) {
152 update_tid(vcpu_info, tid); 155 update_tid(vcpu_info, tid);
153 info->box = TRUE; 156 info->box = TRUE;
@@ -175,8 +178,8 @@ static int rt_vcpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
175 try_server_switch_to(ginfo, vcpu_info, record, info) || 178 try_server_switch_to(ginfo, vcpu_info, record, info) ||
176 /* vcpu_try_block(ginfo, vcpu_info, record, info) || */ 179 /* vcpu_try_block(ginfo, vcpu_info, record, info) || */
177 /* vcpu_try_resume(ginfo, vcpu_info, record, info) || */ 180 /* vcpu_try_resume(ginfo, vcpu_info, record, info) || */
178 vcpu_try_release(ginfo, vcpu_info, record, info) || 181 /* vcpu_try_release(ginfo, vcpu_info, record, info) || */
179 vcpu_try_completion(ginfo, vcpu_info, record, info) || 182 /* vcpu_try_completion(ginfo, vcpu_info, record, info) || */
180 try_switch_to(ginfo, vcpu_info, record, info) || 183 try_switch_to(ginfo, vcpu_info, record, info) ||
181 try_switch_away(ginfo, vcpu_info, record, info); 184 try_switch_away(ginfo, vcpu_info, record, info);
182 return match; 185 return match;
@@ -199,6 +202,7 @@ void insert_vcpu(struct graph_info *ginfo, struct cont_list *cont,
199 struct graph_plot *plot; 202 struct graph_plot *plot;
200 struct vcpu_info *vcpu; 203 struct vcpu_info *vcpu;
201 char *label; 204 char *label;
205 int len;
202 206
203 vcpu = malloc_or_die(sizeof(*vcpu)); 207 vcpu = malloc_or_die(sizeof(*vcpu));
204 vcpu->sid = vcpu_info->sid; 208 vcpu->sid = vcpu_info->sid;
@@ -211,8 +215,19 @@ void insert_vcpu(struct graph_info *ginfo, struct cont_list *cont,
211 215
212 g_assert(cont); 216 g_assert(cont);
213 217
214 label = malloc_or_die(1); 218
215 snprintf(label, 2, " "); 219 len = strlen(cont->name) + 100;
220 label = malloc_or_die(len);
221
222 if (vcpu_info->params.wcet)
223 snprintf(label, len, "%s - %d\nServer %d\n(%1.1f, %1.1f)",
224 cont->name, cont->cid, vcpu_info->sid,
225 nano_as_milli(vcpu_info->params.wcet),
226 nano_as_milli(vcpu_info->params.period));
227 else
228 snprintf(label, len, "%s - %d\nServer %d",
229 cont->name, cont->cid, vcpu_info->sid);
230
216 plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_SERVER_CPU, 231 plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_SERVER_CPU,
217 TIME_TYPE_RT, &rt_vcpu_cb, vcpu); 232 TIME_TYPE_RT, &rt_vcpu_cb, vcpu);
218 trace_graph_plot_add_all_recs(ginfo, plot); 233 trace_graph_plot_add_all_recs(ginfo, plot);
@@ -231,15 +246,14 @@ void rt_vcpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot,
231 vcpu_info->run_time = time; 246 vcpu_info->run_time = time;
232 vcpu_info->block_time = time; 247 vcpu_info->block_time = time;
233 vcpu_info->run_cpu = NO_CPU; 248 vcpu_info->run_cpu = NO_CPU;
234 vcpu_info->run_tid = 0; 249 vcpu_info->run_tid = -1;
235 vcpu_info->block_cpu = NO_CPU; 250 vcpu_info->block_cpu = NO_CPU;
236 vcpu_info->fresh = FALSE; 251 vcpu_info->fresh = FALSE;
237 252
238 vcpu_info->fresh = TRUE; 253 vcpu_info->fresh = TRUE;
239 vcpu_info->running = FALSE; 254 vcpu_info->running = FALSE;
240 vcpu_info->last_job = -1; 255 vcpu_info->last_job = -1;
241 256 update_tid(vcpu_info, 0);
242 vcpu_info->run_tid = 0;
243} 257}
244 258
245/** 259/**
@@ -265,10 +279,10 @@ int rt_vcpu_plot_record_matches(struct rt_plot_common *rt,
265 unsigned long long dull; 279 unsigned long long dull;
266 280
267#define ARG ginfo, record, &sid 281#define ARG ginfo, record, &sid
268 match = rt_graph_check_server_switch_to(ARG, &dint, &dint, &dull) || 282 match = rt_graph_check_server_switch_to(ARG, &dint, &dint, &dint, &dull) ||
269 rt_graph_check_server_switch_away(ARG, &dint, &dint, &dull) || 283 rt_graph_check_server_switch_away(ARG, &dint, &dint, &dint, &dull);
270 rt_graph_check_server_completion(ARG, &dint, &dull) || 284 /* rt_graph_check_server_completion(ARG, &dint, &dull) || */
271 rt_graph_check_server_release(ARG, &dint, &dull, &dull); 285 /* rt_graph_check_server_release(ARG, &dint, &dull, &dull); */
272 /* rt_graph_check_server_block(ARG, &dull) || */ 286 /* rt_graph_check_server_block(ARG, &dull) || */
273 /* rt_graph_check_server_resume(ARG, &dull); */ 287 /* rt_graph_check_server_resume(ARG, &dull); */
274#undef ARG 288#undef ARG
@@ -300,19 +314,19 @@ rt_vcpu_plot_write_header(struct rt_plot_common *rt,
300 struct trace_seq *s, 314 struct trace_seq *s,
301 unsigned long long time) 315 unsigned long long time)
302{ 316{
303 int is_running, job, tid; 317 int is_running, job, tid, tjob;
304 unsigned long long release, deadline; 318 unsigned long long release, deadline;
305 struct vcpu_info *vcpu_info = (struct vcpu_info*)rt; 319 struct vcpu_info *vcpu_info = (struct vcpu_info*)rt;
306 struct record *record; 320 struct record *record;
307 321
308 is_running = get_server_info(ginfo, rt, vcpu_info->sid, time, 322 is_running = get_server_info(ginfo, rt, vcpu_info->sid, time,
309 &release, &deadline, 323 &release, &deadline,
310 &job, &tid, &record); 324 &job, &tid, &tjob, &record);
311 325
312 trace_seq_printf(s, "%s-%d\n%d", vcpu_info->cont->name, 326 trace_seq_printf(s, "%s\nServer: %d:%d\n", vcpu_info->cont->name,
313 vcpu_info->sid, job); 327 vcpu_info->sid, job);
314 if (is_running) { 328 if (is_running) {
315 trace_seq_printf(s, " - %d", tid); 329 trace_seq_printf(s, "Running: %d:%d", tid, tjob);
316 } 330 }
317 trace_seq_putc(s, '\n'); 331 trace_seq_putc(s, '\n');
318 return record; 332 return record;