aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2012-04-10 12:24:53 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2012-04-10 12:24:53 -0400
commitce75da68ec7f4b8a8ea5e66459d0828633af67fe (patch)
tree9912c75d7984ee6e620edc5f32fe6aca88ee04f9
parent7c67b2cdcd779525a88a9f7173c6d628a98c01c5 (diff)
containers: now working with real task systems
-rw-r--r--rt-graph.c21
-rw-r--r--rt-graph.h6
-rw-r--r--rt-plot-container.c10
-rw-r--r--rt-plot-container.h2
-rw-r--r--rt-plot-cpu.c4
-rw-r--r--rt-plot-task.c18
-rw-r--r--rt-plot-vcpu.c74
-rw-r--r--rt-plot-vtask.c98
-rw-r--r--rt-plot.c15
-rw-r--r--rt-plot.h8
-rw-r--r--trace-graph.c2
11 files changed, 132 insertions, 126 deletions
diff --git a/rt-graph.c b/rt-graph.c
index 3a5949c..74a6aab 100644
--- a/rt-graph.c
+++ b/rt-graph.c
@@ -255,7 +255,7 @@ int rt_graph_check_task_param(struct graph_info *ginfo,
255 if (id == rtg_info->task_param_id) { 255 if (id == rtg_info->task_param_id) {
256 LOAD_INT(rtg_info, record, param, pid, pid); 256 LOAD_INT(rtg_info, record, param, pid, pid);
257 LOAD_LONG(rtg_info, record, param, wcet, &wcet); 257 LOAD_LONG(rtg_info, record, param, wcet, &wcet);
258 LOAD_LONG(rtg_info, record, param, wcet, &period); 258 LOAD_LONG(rtg_info, record, param, period, &period);
259 259
260 ret = 1; 260 ret = 1;
261 dprintf(3, "Read task_param record for task %d (%llu, %llu)\n", 261 dprintf(3, "Read task_param record for task %d (%llu, %llu)\n",
@@ -433,6 +433,7 @@ int rt_graph_check_task_completion(struct graph_info *ginfo,
433 if (id == rtg_info->task_completion_id) { 433 if (id == rtg_info->task_completion_id) {
434 LOAD_INT(rtg_info, record, completion, pid, pid); 434 LOAD_INT(rtg_info, record, completion, pid, pid);
435 LOAD_INT(rtg_info, record, completion, job, job); 435 LOAD_INT(rtg_info, record, completion, job, job);
436 *ts = get_rts(ginfo, record);
436 437
437 ret = 1; 438 ret = 1;
438 dprintf(3, "Read task_completion (%d) record for job %d:%d " 439 dprintf(3, "Read task_completion (%d) record for job %d:%d "
@@ -618,7 +619,8 @@ int rt_graph_check_server_param(struct graph_info *ginfo, struct record *record,
618 */ 619 */
619int rt_graph_check_server_switch_to(struct graph_info *ginfo, 620int rt_graph_check_server_switch_to(struct graph_info *ginfo,
620 struct record *record, 621 struct record *record,
621 gint *sid, gint *job, gint *tid, 622 gint *sid, gint *job,
623 gint *tid, gint *tjob,
622 unsigned long long *ts) 624 unsigned long long *ts)
623{ 625{
624 struct rt_graph_info *rtg_info = &ginfo->rtg_info; 626 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
@@ -637,6 +639,7 @@ int rt_graph_check_server_switch_to(struct graph_info *ginfo,
637 STORE_FIELD(rtg_info, event, sswitch_to, sid); 639 STORE_FIELD(rtg_info, event, sswitch_to, sid);
638 STORE_FIELD(rtg_info, event, sswitch_to, job); 640 STORE_FIELD(rtg_info, event, sswitch_to, job);
639 STORE_FIELD(rtg_info, event, sswitch_to, tid); 641 STORE_FIELD(rtg_info, event, sswitch_to, tid);
642 STORE_FIELD(rtg_info, event, sswitch_to, tjob);
640 } 643 }
641 644
642 id = pevent_data_type(pevent, record); 645 id = pevent_data_type(pevent, record);
@@ -644,9 +647,10 @@ int rt_graph_check_server_switch_to(struct graph_info *ginfo,
644 LOAD_INT(rtg_info, record, sswitch_to, sid, sid); 647 LOAD_INT(rtg_info, record, sswitch_to, sid, sid);
645 LOAD_INT(rtg_info, record, sswitch_to, job, job); 648 LOAD_INT(rtg_info, record, sswitch_to, job, job);
646 LOAD_INT(rtg_info, record, sswitch_to, tid, tid); 649 LOAD_INT(rtg_info, record, sswitch_to, tid, tid);
650 LOAD_INT(rtg_info, record, sswitch_to, tjob, tjob);
647 *ts = get_rts(ginfo, record); 651 *ts = get_rts(ginfo, record);
648 652
649 dprintf(3, "Read server_switch_to(job(%d, %d)): %d", 653 dprintf(3, "Read server_switch_to(job(%d, %d)): %d\n",
650 *sid, *job, *tid); 654 *sid, *job, *tid);
651 ret = 1; 655 ret = 1;
652 } 656 }
@@ -660,7 +664,8 @@ int rt_graph_check_server_switch_to(struct graph_info *ginfo,
660 */ 664 */
661int rt_graph_check_server_switch_away(struct graph_info *ginfo, 665int rt_graph_check_server_switch_away(struct graph_info *ginfo,
662 struct record *record, 666 struct record *record,
663 gint *sid, gint *job, gint *tid, 667 gint *sid, gint *job,
668 gint *tid, gint *tjob,
664 unsigned long long *ts) 669 unsigned long long *ts)
665{ 670{
666 struct rt_graph_info *rtg_info = &ginfo->rtg_info; 671 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
@@ -679,6 +684,7 @@ int rt_graph_check_server_switch_away(struct graph_info *ginfo,
679 STORE_FIELD(rtg_info, event, sswitch_away, sid); 684 STORE_FIELD(rtg_info, event, sswitch_away, sid);
680 STORE_FIELD(rtg_info, event, sswitch_away, job); 685 STORE_FIELD(rtg_info, event, sswitch_away, job);
681 STORE_FIELD(rtg_info, event, sswitch_away, tid); 686 STORE_FIELD(rtg_info, event, sswitch_away, tid);
687 STORE_FIELD(rtg_info, event, sswitch_away, tjob);
682 } 688 }
683 689
684 id = pevent_data_type(pevent, record); 690 id = pevent_data_type(pevent, record);
@@ -686,10 +692,11 @@ int rt_graph_check_server_switch_away(struct graph_info *ginfo,
686 LOAD_INT(rtg_info, record, sswitch_away, sid, sid); 692 LOAD_INT(rtg_info, record, sswitch_away, sid, sid);
687 LOAD_INT(rtg_info, record, sswitch_away, job, job); 693 LOAD_INT(rtg_info, record, sswitch_away, job, job);
688 LOAD_INT(rtg_info, record, sswitch_away, tid, tid); 694 LOAD_INT(rtg_info, record, sswitch_away, tid, tid);
695 LOAD_INT(rtg_info, record, sswitch_away, tjob, tjob);
689 *ts = get_rts(ginfo, record); 696 *ts = get_rts(ginfo, record);
690 697
691 698
692 dprintf(3, "Read server_switch_away(job(%d, %d)): %d", 699 dprintf(3, "Read server_switch_away(job(%d, %d)): %d\n",
693 *sid, *job, *tid); 700 *sid, *job, *tid);
694 ret = 1; 701 ret = 1;
695 } 702 }
@@ -719,7 +726,7 @@ int rt_graph_check_server_release(struct graph_info *ginfo,
719 if (!event) 726 if (!event)
720 goto out; 727 goto out;
721 rtg_info->server_release_id = event->id; 728 rtg_info->server_release_id = event->id;
722 dprintf(2, "Found server_switch_away id %d\n", event->id); 729 dprintf(2, "Found server_release id %d\n", event->id);
723 STORE_FIELD(rtg_info, event, srelease, sid); 730 STORE_FIELD(rtg_info, event, srelease, sid);
724 STORE_FIELD(rtg_info, event, srelease, job); 731 STORE_FIELD(rtg_info, event, srelease, job);
725 STORE_FIELD(rtg_info, event, srelease, release); 732 STORE_FIELD(rtg_info, event, srelease, release);
@@ -762,7 +769,7 @@ int rt_graph_check_server_completion(struct graph_info *ginfo,
762 if (!event) 769 if (!event)
763 goto out; 770 goto out;
764 rtg_info->server_completion_id = event->id; 771 rtg_info->server_completion_id = event->id;
765 dprintf(2, "Found server_switch_away id %d\n", event->id); 772 dprintf(2, "Found server_completion id %d\n", event->id);
766 STORE_FIELD(rtg_info, event, scompletion, sid); 773 STORE_FIELD(rtg_info, event, scompletion, sid);
767 STORE_FIELD(rtg_info, event, scompletion, job); 774 STORE_FIELD(rtg_info, event, scompletion, job);
768 } 775 }
diff --git a/rt-graph.h b/rt-graph.h
index c44cf5b..853ffc6 100644
--- a/rt-graph.h
+++ b/rt-graph.h
@@ -76,11 +76,13 @@ struct rt_graph_info {
76 struct format_field *sswitch_to_sid_field; 76 struct format_field *sswitch_to_sid_field;
77 struct format_field *sswitch_to_job_field; 77 struct format_field *sswitch_to_job_field;
78 struct format_field *sswitch_to_tid_field; 78 struct format_field *sswitch_to_tid_field;
79 struct format_field *sswitch_to_tjob_field;
79 80
80 gint server_switch_away_id; 81 gint server_switch_away_id;
81 struct format_field *sswitch_away_sid_field; 82 struct format_field *sswitch_away_sid_field;
82 struct format_field *sswitch_away_job_field; 83 struct format_field *sswitch_away_job_field;
83 struct format_field *sswitch_away_tid_field; 84 struct format_field *sswitch_away_tid_field;
85 struct format_field *sswitch_away_tjob_field;
84 86
85 gint server_release_id; 87 gint server_release_id;
86 struct format_field *srelease_sid_field; 88 struct format_field *srelease_sid_field;
@@ -180,11 +182,11 @@ int rt_graph_check_server_param(struct graph_info *ginfo, struct record *record,
180 unsigned long long *period); 182 unsigned long long *period);
181int rt_graph_check_server_switch_to(struct graph_info *ginfo, 183int rt_graph_check_server_switch_to(struct graph_info *ginfo,
182 struct record *record, 184 struct record *record,
183 gint *sid, gint *job, gint *tid, 185 gint *sid, gint *job, gint *tid, gint *tjob,
184 unsigned long long *when); 186 unsigned long long *when);
185int rt_graph_check_server_switch_away(struct graph_info *ginfo, 187int rt_graph_check_server_switch_away(struct graph_info *ginfo,
186 struct record *record, 188 struct record *record,
187 gint *sid, gint *job, gint *tid, 189 gint *sid, gint *job, gint *tid, gint *tjob,
188 unsigned long long *when); 190 unsigned long long *when);
189int rt_graph_check_server_release(struct graph_info *ginfo, 191int rt_graph_check_server_release(struct graph_info *ginfo,
190 struct record *record, 192 struct record *record,
diff --git a/rt-plot-container.c b/rt-plot-container.c
index 97e9fd8..cb814fa 100644
--- a/rt-plot-container.c
+++ b/rt-plot-container.c
@@ -26,11 +26,11 @@ int get_server_info(struct graph_info *ginfo, struct rt_plot_common *rt,
26 int match_sid, unsigned long long time, 26 int match_sid, unsigned long long time,
27 unsigned long long *out_release, 27 unsigned long long *out_release,
28 unsigned long long *out_deadline, 28 unsigned long long *out_deadline,
29 int *out_job, int *out_tid, 29 int *out_job, int *out_tid, int *out_tjob,
30 struct record **out_record) 30 struct record **out_record)
31{ 31{
32 struct record *record; 32 struct record *record;
33 int sid, job, tid, match, next_cpu, is_running = 0; 33 int sid, job, tid, tjob, match, next_cpu, is_running = 0;
34 unsigned long long when, max_ts; 34 unsigned long long when, max_ts;
35 35
36 *out_record = find_rt_record(ginfo, rt, time); 36 *out_record = find_rt_record(ginfo, rt, time);
@@ -55,10 +55,11 @@ int get_server_info(struct graph_info *ginfo, struct rt_plot_common *rt,
55 break; 55 break;
56 56
57 match = rt_graph_check_server_switch_away(ginfo, record, 57 match = rt_graph_check_server_switch_away(ginfo, record,
58 &sid, &job, &tid, 58 &sid, &job, &tid, &tjob,
59 &when); 59 &when);
60 if (match && sid == match_sid) { 60 if (match && sid == match_sid) {
61 *out_tid = tid; 61 *out_tid = tid;
62 *out_tjob = tjob;
62 is_running = 1; 63 is_running = 1;
63 break; 64 break;
64 } 65 }
@@ -88,8 +89,9 @@ void rt_plot_container(struct graph_info *ginfo, int cid)
88 cont->plotted = TRUE; 89 cont->plotted = TRUE;
89 90
90 for (vlist = cont->vcpus; vlist; vlist = vlist->next) { 91 for (vlist = cont->vcpus; vlist; vlist = vlist->next) {
91 insert_vtask(ginfo, cont, vlist);
92 insert_vcpu(ginfo, cont, vlist); 92 insert_vcpu(ginfo, cont, vlist);
93 if (vlist->params.wcet && vlist->params.period)
94 insert_vtask(ginfo, cont, vlist);
93 } 95 }
94} 96}
95 97
diff --git a/rt-plot-container.h b/rt-plot-container.h
index cde5c2f..c96d6e9 100644
--- a/rt-plot-container.h
+++ b/rt-plot-container.h
@@ -17,6 +17,6 @@ int get_server_info(struct graph_info *ginfo,
17 struct rt_plot_common *rt, 17 struct rt_plot_common *rt,
18 int match_sid, unsigned long long time, 18 int match_sid, unsigned long long time,
19 unsigned long long *release, unsigned long long *deadline, 19 unsigned long long *release, unsigned long long *deadline,
20 int *job, int *tid, struct record **record); 20 int *job, int *tid, int *tjob, struct record **record);
21 21
22#endif 22#endif
diff --git a/rt-plot-cpu.c b/rt-plot-cpu.c
index ba380fb..cfc19c3 100644
--- a/rt-plot-cpu.c
+++ b/rt-plot-cpu.c
@@ -57,10 +57,6 @@ is_displayed(struct graph_info *ginfo, int eid)
57 struct rt_graph_info *rtg_info = &ginfo->rtg_info; 57 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
58 return (eid == rtg_info->switch_away_id || 58 return (eid == rtg_info->switch_away_id ||
59 eid == rtg_info->switch_to_id || 59 eid == rtg_info->switch_to_id ||
60 eid == rtg_info->task_completion_id ||
61 eid == rtg_info->task_block_id ||
62 eid == rtg_info->task_resume_id ||
63 eid == rtg_info->task_release_id ||
64 eid == ginfo->event_sched_switch_id); 60 eid == ginfo->event_sched_switch_id);
65} 61}
66 62
diff --git a/rt-plot-task.c b/rt-plot-task.c
index 94c60f1..63f4f20 100644
--- a/rt-plot-task.c
+++ b/rt-plot-task.c
@@ -3,7 +3,7 @@
3#include "trace-graph.h" 3#include "trace-graph.h"
4#include "trace-filter.h" 4#include "trace-filter.h"
5 5
6#define DEBUG_LEVEL 5 6#define DEBUG_LEVEL 4
7#if DEBUG_LEVEL > 0 7#if DEBUG_LEVEL > 0
8#define dprintf(l, x...) \ 8#define dprintf(l, x...) \
9 do { \ 9 do { \
@@ -237,9 +237,7 @@ static int try_block(struct graph_info *ginfo, struct rt_task_info *rtt_info,
237 dprintf(3, "Block for %d on %d at %llu\n", 237 dprintf(3, "Block for %d on %d at %llu\n",
238 pid, record->cpu, ts); 238 pid, record->cpu, ts);
239 ret = 1; 239 ret = 1;
240 } else { 240 }
241 dprintf(3, "%d does not match my pid %d\n", pid, rtt_info->pid);
242 }
243 return ret; 241 return ret;
244} 242}
245 243
@@ -259,9 +257,7 @@ static int try_resume(struct graph_info *ginfo, struct rt_task_info *rtt_info,
259 info->bstart = rtt_info->block_time; 257 info->bstart = rtt_info->block_time;
260 info->bend = ts; 258 info->bend = ts;
261 259
262 printf("drawing block\n");
263 if (lid) { 260 if (lid) {
264 printf("Adding label %s\n", rtt_info->block_label);
265 info->blabel = rtt_info->block_label; 261 info->blabel = rtt_info->block_label;
266 } 262 }
267 263
@@ -328,6 +324,7 @@ static int try_switch_to(struct graph_info *ginfo, struct rt_task_info *rtt_info
328 pid, job, record->cpu, ts); 324 pid, job, record->cpu, ts);
329 ret = 1; 325 ret = 1;
330 } 326 }
327
331 return ret; 328 return ret;
332} 329}
333 330
@@ -417,8 +414,6 @@ static int rt_task_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
417 struct rt_task_info *rtt_info = plot->private; 414 struct rt_task_info *rtt_info = plot->private;
418 int match; 415 int match;
419 416
420 dprintf(4,"%s\n", __FUNCTION__);
421
422 /* No more records, finish what we started */ 417 /* No more records, finish what we started */
423 if (!record) { 418 if (!record) {
424 do_plot_end(ginfo, rtt_info, info); 419 do_plot_end(ginfo, rtt_info, info);
@@ -443,8 +438,6 @@ static void rt_task_plot_start(struct graph_info *ginfo, struct graph_plot *plot
443 int i; 438 int i;
444 struct rt_task_info *rtt_info = plot->private; 439 struct rt_task_info *rtt_info = plot->private;
445 440
446 dprintf(4,"%s\n", __FUNCTION__);
447
448 rtt_info->run_time = time; 441 rtt_info->run_time = time;
449 rtt_info->block_time = time; 442 rtt_info->block_time = time;
450 rtt_info->run_cpu = NO_CPU; 443 rtt_info->run_cpu = NO_CPU;
@@ -454,14 +447,13 @@ static void rt_task_plot_start(struct graph_info *ginfo, struct graph_plot *plot
454 for (i = 0; i < 3; i++) 447 for (i = 0; i < 3; i++)
455 rtt_info->first_rels[i] = 0ULL; 448 rtt_info->first_rels[i] = 0ULL;
456 rtt_info->last_job = -1; 449 rtt_info->last_job = -1;
457 update_job(rtt_info, 0); 450 update_job(rtt_info, -1);
458 update_lid(rtt_info, 0); 451 update_lid(rtt_info, 0);
459} 452}
460 453
461static void rt_task_plot_destroy(struct graph_info *ginfo, struct graph_plot *plot) 454static void rt_task_plot_destroy(struct graph_info *ginfo, struct graph_plot *plot)
462{ 455{
463 struct rt_task_info *rtt_info = plot->private; 456 struct rt_task_info *rtt_info = plot->private;
464 dprintf(4,"%s\n", __FUNCTION__);
465 trace_graph_plot_remove_all_recs(ginfo, plot); 457 trace_graph_plot_remove_all_recs(ginfo, plot);
466 free(rtt_info->label); 458 free(rtt_info->label);
467 free(rtt_info); 459 free(rtt_info);
@@ -507,8 +499,6 @@ rt_task_plot_write_header(struct rt_plot_common *rt,
507 unsigned long long release, deadline; 499 unsigned long long release, deadline;
508 struct rt_task_info *rtt_info = (struct rt_task_info*)rt; 500 struct rt_task_info *rtt_info = (struct rt_task_info*)rt;
509 501
510 dprintf(4,"%s\n", __FUNCTION__);
511
512 found = get_time_info(ginfo, rtt_info, time, 502 found = get_time_info(ginfo, rtt_info, time,
513 &job, &release, &deadline, &record); 503 &job, &release, &deadline, &record);
514 if (!found) 504 if (!found)
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;
diff --git a/rt-plot-vtask.c b/rt-plot-vtask.c
index 5000873..91eeb19 100644
--- a/rt-plot-vtask.c
+++ b/rt-plot-vtask.c
@@ -32,18 +32,18 @@ static int
32try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, 32try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
33 struct record *record, struct plot_info *info) 33 struct record *record, struct plot_info *info)
34{ 34{
35 int job, sid, tid, match, ret = 0; 35 int job, sid, tid, tjob, match, ret = 0;
36 unsigned long long ts; 36 unsigned long long ts;
37 37
38 match = rt_graph_check_server_switch_away(ginfo, record, 38 match = rt_graph_check_server_switch_away(ginfo, record,
39 &sid, &job, 39 &sid, &job,
40 &tid, &ts); 40 &tid, &tjob, &ts);
41 if (match && sid == vcpu_info->sid) { 41 if (match && tid == vcpu_info->sid) {
42 /* update_job(vcpu_info, job); */ 42 update_job(vcpu_info, tjob);
43 43
44 if (vcpu_info->run_time < ts) { 44 if (vcpu_info->run_time && vcpu_info->run_time < ts) {
45 info->box = TRUE; 45 info->box = TRUE;
46 info->bcolor = hash_pid(sid); 46 info->bcolor = hash_cpu(sid - 1);
47 info->bfill = TRUE; 47 info->bfill = TRUE;
48 info->bstart = vcpu_info->run_time; 48 info->bstart = vcpu_info->run_time;
49 info->bend = ts; 49 info->bend = ts;
@@ -65,13 +65,13 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
65static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, 65static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
66 struct record *record, struct plot_info *info) 66 struct record *record, struct plot_info *info)
67{ 67{
68 int job, sid, tid, match, ret = 0; 68 int job, sid, tid, tjob, match, ret = 0;
69 unsigned long long ts; 69 unsigned long long ts;
70 70
71 match = rt_graph_check_server_switch_to(ginfo, record, 71 match = rt_graph_check_server_switch_to(ginfo, record,
72 &sid, &job, &tid, &ts); 72 &sid, &job, &tid, &tjob, &ts);
73 if (match && sid == vcpu_info->sid) { 73 if (match && tid == vcpu_info->sid) {
74 update_job(vcpu_info, job); 74 update_job(vcpu_info, tjob);
75 vcpu_info->run_time = ts; 75 vcpu_info->run_time = ts;
76 vcpu_info->run_cpu = record->cpu; 76 vcpu_info->run_cpu = record->cpu;
77 vcpu_info->run_tid = tid; 77 vcpu_info->run_tid = tid;
@@ -82,40 +82,40 @@ static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu
82 return ret; 82 return ret;
83} 83}
84 84
85static int try_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, 85/* static int try_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, */
86 struct record *record, struct plot_info *info) 86/* struct record *record, struct plot_info *info) */
87{ 87/* { */
88 int job, pid, match, ret = 0; 88/* int job, pid, match, ret = 0; */
89 unsigned long long ts; 89/* unsigned long long ts; */
90 90
91 match = rt_graph_check_switch_to(ginfo, record, &pid, &job, &ts); 91/* match = rt_graph_check_switch_to(ginfo, record, &pid, &job, &ts); */
92 if (match && pid && pid == vcpu_info->run_tid && vcpu_info->run_time) { 92/* if (match && pid && pid == vcpu_info->run_tid && vcpu_info->run_time) { */
93 info->line = TRUE; 93/* info->line = TRUE; */
94 info->lcolor = hash_pid(pid); 94/* info->lcolor = hash_pid(pid); */
95 ret = 1; 95/* ret = 1; */
96 } 96/* } */
97 return ret; 97/* return ret; */
98} 98/* } */
99 99
100static int try_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, 100/* static int try_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, */
101 struct record *record, struct plot_info *info) 101/* struct record *record, struct plot_info *info) */
102{ 102/* { */
103 int job, pid, match, ret = 0; 103/* int job, pid, match, ret = 0; */
104 unsigned long long ts; 104/* unsigned long long ts; */
105 105
106 match = rt_graph_check_switch_away(ginfo, record, &pid, &job, &ts); 106/* match = rt_graph_check_switch_away(ginfo, record, &pid, &job, &ts); */
107 if (match && pid && pid == vcpu_info->run_tid) { 107/* if (match && pid && pid == vcpu_info->run_tid) { */
108 info->line = TRUE; 108/* info->line = TRUE; */
109 info->lcolor = hash_pid(pid); 109/* info->lcolor = hash_pid(pid); */
110 ret = 1; 110/* ret = 1; */
111 } 111/* } */
112 return ret; 112/* return ret; */
113} 113/* } */
114 114
115static void do_plot_end(struct graph_info *ginfo, struct vcpu_info *vcpu_info, 115static void do_plot_end(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
116 struct plot_info *info) 116 struct plot_info *info)
117{ 117{
118 int tid, job, is_running; 118 int tid, job, is_running, tjob;
119 unsigned long long deadline, release; 119 unsigned long long deadline, release;
120 struct record *record; 120 struct record *record;
121 121
@@ -135,7 +135,7 @@ static void do_plot_end(struct graph_info *ginfo, struct vcpu_info *vcpu_info,
135 vcpu_info->sid, 135 vcpu_info->sid,
136 ginfo->view_end_time, 136 ginfo->view_end_time,
137 &release, &deadline, 137 &release, &deadline,
138 &job, &tid, &record); 138 &job, &tid, &tjob, &record);
139 if (is_running) { 139 if (is_running) {
140 update_job(vcpu_info, job); 140 update_job(vcpu_info, job);
141 info->box = TRUE; 141 info->box = TRUE;
@@ -164,9 +164,9 @@ static int rt_vtask_plot_event(struct graph_info *ginfo, struct graph_plot *plot
164 /* vcpu_try_block(ginfo, vcpu_info, record, info) || */ 164 /* vcpu_try_block(ginfo, vcpu_info, record, info) || */
165 /* vcpu_try_resume(ginfo, vcpu_info, record, info) || */ 165 /* vcpu_try_resume(ginfo, vcpu_info, record, info) || */
166 vcpu_try_release(ginfo, vcpu_info, record, info) || 166 vcpu_try_release(ginfo, vcpu_info, record, info) ||
167 vcpu_try_completion(ginfo, vcpu_info, record, info) || 167 vcpu_try_completion(ginfo, vcpu_info, record, info);
168 try_switch_to(ginfo, vcpu_info, record, info) || 168 /* try_switch_to(ginfo, vcpu_info, record, info) || */
169 try_switch_away(ginfo, vcpu_info, record, info); 169 /* try_switch_away(ginfo, vcpu_info, record, info); */
170 return match; 170 return match;
171} 171}
172 172
@@ -186,7 +186,6 @@ void insert_vtask(struct graph_info *ginfo, struct cont_list *cont,
186 struct graph_plot *plot; 186 struct graph_plot *plot;
187 struct vcpu_info *vtask; 187 struct vcpu_info *vtask;
188 char *label; 188 char *label;
189 int len;
190 189
191 vtask = malloc_or_die(sizeof(*vtask)); 190 vtask = malloc_or_die(sizeof(*vtask));
192 vtask->sid = vcpu_info->sid; 191 vtask->sid = vcpu_info->sid;
@@ -197,13 +196,8 @@ void insert_vtask(struct graph_info *ginfo, struct cont_list *cont,
197 vtask->common.is_drawn = rt_vcpu_plot_is_drawn; 196 vtask->common.is_drawn = rt_vcpu_plot_is_drawn;
198 vtask->common.write_header = rt_vcpu_plot_write_header; 197 vtask->common.write_header = rt_vcpu_plot_write_header;
199 198
200 199 label = malloc_or_die(1);
201 len = strlen(cont->name) + 100; 200 snprintf(label, 2, " ");
202 label = malloc_or_die(len);
203 snprintf(label, len, "%s - %d\n(%1.1f, %1.1f)",
204 cont->name, -vtask->sid,
205 nano_as_milli(vcpu_info->params.wcet),
206 nano_as_milli(vcpu_info->params.period));
207 201
208 plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_SERVER_TASK, 202 plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_SERVER_TASK,
209 TIME_TYPE_RT, &rt_vtask_cb, vtask); 203 TIME_TYPE_RT, &rt_vtask_cb, vtask);
diff --git a/rt-plot.c b/rt-plot.c
index 36682a4..37506ba 100644
--- a/rt-plot.c
+++ b/rt-plot.c
@@ -287,8 +287,9 @@ set_cpu_to_rts(struct graph_info *ginfo, unsigned long long rt_target, int cpu)
287 */ 287 */
288 do { 288 do {
289 seek_time = seek_time - 1.5 * (rts - rt_target); 289 seek_time = seek_time - 1.5 * (rts - rt_target);
290 last_rts = rts;
290 rts = next_rts(ginfo, cpu, seek_time); 291 rts = next_rts(ginfo, cpu, seek_time);
291 } while (rts > rt_target); 292 } while (rts > rt_target && rts != last_rts);
292 } 293 }
293 294
294 /* Get to first record at or after time */ 295 /* Get to first record at or after time */
@@ -368,11 +369,11 @@ int is_task_running(struct graph_info *ginfo,
368 * Returns release record and @out_job, @out_release, and @out_deadline if a 369 * Returns release record and @out_job, @out_release, and @out_deadline if a
369 * release was found for @tid before @time. 370 * release was found for @tid before @time.
370 */ 371 */
371struct record* get_previous_release(struct graph_info *ginfo, int match_tid, 372void get_previous_release(struct graph_info *ginfo, int match_tid,
372 unsigned long long time, 373 unsigned long long time,
373 int *out_job, 374 int *out_job,
374 unsigned long long *out_release, 375 unsigned long long *out_release,
375 unsigned long long *out_deadline) 376 unsigned long long *out_deadline)
376{ 377{
377 int tid, cpu, match, job; 378 int tid, cpu, match, job;
378 unsigned long long release, deadline, min_ts; 379 unsigned long long release, deadline, min_ts;
@@ -424,5 +425,5 @@ struct record* get_previous_release(struct graph_info *ginfo, int match_tid,
424 loop_end: 425 loop_end:
425 free_record(last_rec); 426 free_record(last_rec);
426 } 427 }
427 return ret; 428 free_record(ret);
428} 429}
diff --git a/rt-plot.h b/rt-plot.h
index 1b04547..e84bbf9 100644
--- a/rt-plot.h
+++ b/rt-plot.h
@@ -60,9 +60,9 @@ void set_cpus_to_rts(struct graph_info *ginfo,
60int is_task_running(struct graph_info *ginfo, 60int is_task_running(struct graph_info *ginfo,
61 unsigned long long time, 61 unsigned long long time,
62 int pid); 62 int pid);
63struct record* get_previous_release(struct graph_info *ginfo, int tid, 63void get_previous_release(struct graph_info *ginfo, int tid,
64 unsigned long long time, int *job, 64 unsigned long long time, int *job,
65 unsigned long long *release, 65 unsigned long long *release,
66 unsigned long long *deadline); 66 unsigned long long *deadline);
67 67
68#endif 68#endif
diff --git a/trace-graph.c b/trace-graph.c
index b20aabe..1ce3d47 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -55,7 +55,7 @@
55#define PLOT_GIVE 2 55#define PLOT_GIVE 2
56#define PLOT_BEGIN 80 56#define PLOT_BEGIN 80
57#define PLOT_SEP 50 57#define PLOT_SEP 50
58#define MAX_TRI_TIME 1000000 58#define MAX_TRI_TIME 10000000
59#define PLOT_LINE(plot) (PLOT_SEP * (plot) + PLOT_BEGIN + PLOT_SIZE) 59#define PLOT_LINE(plot) (PLOT_SEP * (plot) + PLOT_BEGIN + PLOT_SIZE)
60#define PLOT_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE * 2) 60#define PLOT_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE * 2)
61#define PLOT_BOX_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE) 61#define PLOT_BOX_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE)