diff options
Diffstat (limited to 'rt-plot-task.c')
-rw-r--r-- | rt-plot-task.c | 79 |
1 files changed, 56 insertions, 23 deletions
diff --git a/rt-plot-task.c b/rt-plot-task.c index de5d2a7..94c60f1 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
@@ -42,8 +42,8 @@ next_box_record(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
42 | #define ARG ginfo, record, &pid | 42 | #define ARG ginfo, record, &pid |
43 | match = rt_graph_check_switch_to(ARG, &dint, &dull) || | 43 | match = rt_graph_check_switch_to(ARG, &dint, &dull) || |
44 | rt_graph_check_switch_away(ARG, &dint, &dull) || | 44 | rt_graph_check_switch_away(ARG, &dint, &dull) || |
45 | rt_graph_check_task_block(ARG, &dull) || | 45 | rt_graph_check_task_block(ARG, &dint, &dull) || |
46 | rt_graph_check_task_resume(ARG, &dull); | 46 | rt_graph_check_task_resume(ARG, &dint, &dull); |
47 | #undef ARG | 47 | #undef ARG |
48 | eid = (match) ? pevent_data_type(pevent, record) : 0; | 48 | eid = (match) ? pevent_data_type(pevent, record) : 0; |
49 | 49 | ||
@@ -75,6 +75,19 @@ static int update_job(struct rt_task_info *rtt_info, int job) | |||
75 | return 1; | 75 | return 1; |
76 | } | 76 | } |
77 | 77 | ||
78 | static void update_lid(struct rt_task_info *rtt_info, int lid) | ||
79 | { | ||
80 | if (rtt_info->block_lid != lid) { | ||
81 | rtt_info->block_lid = lid; | ||
82 | |||
83 | if (lid) | ||
84 | snprintf(rtt_info->block_label, LLABEL, | ||
85 | "%d", rtt_info->block_lid); | ||
86 | else | ||
87 | snprintf(rtt_info->block_label, LLABEL, " "); | ||
88 | } | ||
89 | } | ||
90 | |||
78 | static int rt_task_plot_is_drawn(struct graph_info *ginfo, int eid) | 91 | static int rt_task_plot_is_drawn(struct graph_info *ginfo, int eid) |
79 | { | 92 | { |
80 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; | 93 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; |
@@ -82,8 +95,8 @@ static int rt_task_plot_is_drawn(struct graph_info *ginfo, int eid) | |||
82 | return (eid == rtg_info->switch_away_id || | 95 | return (eid == rtg_info->switch_away_id || |
83 | eid == rtg_info->switch_to_id || | 96 | eid == rtg_info->switch_to_id || |
84 | eid == rtg_info->task_completion_id || | 97 | eid == rtg_info->task_completion_id || |
85 | /* eid == rtg_info->task_block_id || */ | 98 | eid == rtg_info->task_block_id || |
86 | /* eid == rtg_info->task_resume_id || */ | 99 | eid == rtg_info->task_resume_id || |
87 | eid == rtg_info->task_release_id); | 100 | eid == rtg_info->task_release_id); |
88 | } | 101 | } |
89 | 102 | ||
@@ -208,14 +221,19 @@ static int try_completion(struct graph_info *ginfo, | |||
208 | static int try_block(struct graph_info *ginfo, struct rt_task_info *rtt_info, | 221 | static int try_block(struct graph_info *ginfo, struct rt_task_info *rtt_info, |
209 | struct record *record, struct plot_info *info) | 222 | struct record *record, struct plot_info *info) |
210 | { | 223 | { |
211 | int pid, match, ret = 0; | 224 | int pid, match, lid, ret = 0; |
212 | unsigned long long ts; | 225 | unsigned long long ts; |
213 | 226 | ||
214 | match = rt_graph_check_task_block(ginfo, record, &pid, &ts); | 227 | match = rt_graph_check_task_block(ginfo, record, &pid, &lid, &ts); |
215 | if (match && pid == rtt_info->pid) { | 228 | if (match && pid == rtt_info->pid) { |
216 | rtt_info->fresh = FALSE; | 229 | if (lid || !rtt_info->block_lid) { |
217 | rtt_info->block_time = ts; | 230 | update_lid(rtt_info, lid); |
218 | rtt_info->block_cpu = record->cpu; | 231 | rtt_info->fresh = FALSE; |
232 | rtt_info->block_time = ts; | ||
233 | rtt_info->block_cpu = record->cpu; | ||
234 | rtt_info->block_lid = lid; | ||
235 | } | ||
236 | |||
219 | dprintf(3, "Block for %d on %d at %llu\n", | 237 | dprintf(3, "Block for %d on %d at %llu\n", |
220 | pid, record->cpu, ts); | 238 | pid, record->cpu, ts); |
221 | ret = 1; | 239 | ret = 1; |
@@ -228,24 +246,34 @@ static int try_block(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
228 | static int try_resume(struct graph_info *ginfo, struct rt_task_info *rtt_info, | 246 | static int try_resume(struct graph_info *ginfo, struct rt_task_info *rtt_info, |
229 | struct record *record, struct plot_info *info) | 247 | struct record *record, struct plot_info *info) |
230 | { | 248 | { |
231 | int pid, match, ret = 0; | 249 | int pid, match, lid, ret = 0; |
232 | unsigned long long ts; | 250 | unsigned long long ts; |
233 | 251 | ||
234 | match = rt_graph_check_task_resume(ginfo, record, &pid, &ts); | 252 | match = rt_graph_check_task_resume(ginfo, record, &pid, &lid, &ts); |
235 | if (match && pid == rtt_info->pid) { | 253 | if (match && pid == rtt_info->pid) { |
236 | info->box = TRUE; | 254 | if (lid == rtt_info->block_lid) { |
237 | info->bcolor = 0x0; | 255 | info->box = TRUE; |
238 | info->bfill = TRUE; | 256 | info->bcolor = 0x0; |
239 | info->bthin = TRUE; | 257 | info->bfill = TRUE; |
240 | info->bstart = rtt_info->block_time; | 258 | info->bthin = TRUE; |
241 | info->bend = ts; | 259 | info->bstart = rtt_info->block_time; |
242 | rtt_info->fresh = FALSE; | 260 | info->bend = ts; |
261 | |||
262 | printf("drawing block\n"); | ||
263 | if (lid) { | ||
264 | printf("Adding label %s\n", rtt_info->block_label); | ||
265 | info->blabel = rtt_info->block_label; | ||
266 | } | ||
267 | |||
268 | rtt_info->block_lid = 0; | ||
269 | rtt_info->fresh = FALSE; | ||
270 | rtt_info->block_time = 0ULL; | ||
271 | rtt_info->block_cpu = NO_CPU; | ||
272 | |||
273 | } | ||
243 | 274 | ||
244 | rtt_info->block_time = 0ULL; | ||
245 | rtt_info->block_cpu = NO_CPU; | ||
246 | dprintf(3, "Resume for %d on %d at %llu\n", | 275 | dprintf(3, "Resume for %d on %d at %llu\n", |
247 | pid, record->cpu, ts); | 276 | pid, record->cpu, ts); |
248 | |||
249 | ret = 1; | 277 | ret = 1; |
250 | } | 278 | } |
251 | return ret; | 279 | return ret; |
@@ -335,6 +363,9 @@ static void do_plot_end(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
335 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; | 363 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; |
336 | int eid; | 364 | int eid; |
337 | 365 | ||
366 | if (ginfo->view_end_time == ginfo->end_time) | ||
367 | return; | ||
368 | |||
338 | if (rtt_info->run_time && rtt_info->run_cpu != NO_CPU) { | 369 | if (rtt_info->run_time && rtt_info->run_cpu != NO_CPU) { |
339 | /* A box was started, finish it */ | 370 | /* A box was started, finish it */ |
340 | info->box = TRUE; | 371 | info->box = TRUE; |
@@ -424,6 +455,7 @@ static void rt_task_plot_start(struct graph_info *ginfo, struct graph_plot *plot | |||
424 | rtt_info->first_rels[i] = 0ULL; | 455 | rtt_info->first_rels[i] = 0ULL; |
425 | rtt_info->last_job = -1; | 456 | rtt_info->last_job = -1; |
426 | update_job(rtt_info, 0); | 457 | update_job(rtt_info, 0); |
458 | update_lid(rtt_info, 0); | ||
427 | } | 459 | } |
428 | 460 | ||
429 | static void rt_task_plot_destroy(struct graph_info *ginfo, struct graph_plot *plot) | 461 | static void rt_task_plot_destroy(struct graph_info *ginfo, struct graph_plot *plot) |
@@ -455,8 +487,8 @@ rt_task_plot_record_matches(struct rt_plot_common *rt, | |||
455 | rt_graph_check_switch_away(ARG, &dint, &dull) || | 487 | rt_graph_check_switch_away(ARG, &dint, &dull) || |
456 | rt_graph_check_task_release(ARG, &dint, &dull, &dull) || | 488 | rt_graph_check_task_release(ARG, &dint, &dull, &dull) || |
457 | rt_graph_check_task_completion(ARG, &dint, &dull) || | 489 | rt_graph_check_task_completion(ARG, &dint, &dull) || |
458 | rt_graph_check_task_block(ARG, &dull) || | 490 | rt_graph_check_task_block(ARG, &dint, &dull) || |
459 | rt_graph_check_task_resume(ARG, &dull) || | 491 | rt_graph_check_task_resume(ARG, &dint, &dull) || |
460 | rt_graph_check_any(ARG, &dint, &dull); | 492 | rt_graph_check_any(ARG, &dint, &dull); |
461 | #undef ARG | 493 | #undef ARG |
462 | return pid == match_pid; | 494 | return pid == match_pid; |
@@ -617,6 +649,7 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos) | |||
617 | rtt_info = malloc_or_die(sizeof(*rtt_info)); | 649 | rtt_info = malloc_or_die(sizeof(*rtt_info)); |
618 | rtt_info->pid = pid; | 650 | rtt_info->pid = pid; |
619 | rtt_info->label = malloc_or_die(LLABEL); | 651 | rtt_info->label = malloc_or_die(LLABEL); |
652 | rtt_info->block_label = malloc_or_die(LLABEL); | ||
620 | rtt_info->wcet = params->wcet; | 653 | rtt_info->wcet = params->wcet; |
621 | rtt_info->period = params->period; | 654 | rtt_info->period = params->period; |
622 | 655 | ||