aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-10-28 12:49:49 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-10-28 12:49:49 -0400
commit61c4835ed40d6a168ada3f62c7cc11420b5e3f39 (patch)
tree045f22a9af514898dfe15b76659627ea5d5d18d3 /src
parent4a8b806b5f13df589a4800051b84f062efc2951d (diff)
add some detail to st_dump output
Diffstat (limited to 'src')
-rw-r--r--src/sched_trace.c61
1 files changed, 55 insertions, 6 deletions
diff --git a/src/sched_trace.c b/src/sched_trace.c
index 9f532f3..330ed27 100644
--- a/src/sched_trace.c
+++ b/src/sched_trace.c
@@ -62,6 +62,7 @@ static const char* event_names[] = {
62 62
63#define ST_INVALID (ST_RESUME + 1) 63#define ST_INVALID (ST_RESUME + 1)
64 64
65
65const char* event2name(unsigned int id) 66const char* event2name(unsigned int id)
66{ 67{
67 if (id >= ST_INVALID) 68 if (id >= ST_INVALID)
@@ -71,16 +72,64 @@ const char* event2name(unsigned int id)
71 72
72void print_header(struct st_trace_header* hdr) 73void print_header(struct st_trace_header* hdr)
73{ 74{
74 printf("%-14s on CPU %u for %5u/%5u", 75 printf("%-14s %5u/%-5u on CPU%3u ",
75 event2name(hdr->type), 76 event2name(hdr->type),
76 hdr->cpu, hdr->pid, hdr->job); 77 hdr->pid, hdr->job,
78 hdr->cpu);
79}
80
81typedef void (*print_t)(struct st_event_record* rec);
82
83static void print_nothing(struct st_event_record* _)
84{
85}
86
87static void print_name(struct st_event_record* rec)
88{
89 /* terminate in all cases */
90 rec->data.name.cmd[ST_NAME_LEN - 1] = 0;
91 printf("%s", rec->data.name.cmd);
92}
93
94static void print_param(struct st_event_record* rec)
95{
96 printf("T=(cost:%6.2fms, period:%6.2fms, phase:%6.2fms), part=%d",
97 rec->data.param.wcet / 1000000.0,
98 rec->data.param.period / 1000000.0,
99 rec->data.param.phase / 1000000.0,\
100 rec->data.param.partition);
77} 101}
78 102
103static print_t print_detail[] = {
104 print_nothing,
105 print_name,
106 print_param,
107 print_nothing,
108 print_nothing,
109 print_nothing,
110 print_nothing,
111 print_nothing,
112 print_nothing,
113 print_nothing,
114 print_nothing
115};
116
117void print_event(struct st_event_record *rec)
118{
119 unsigned int id = rec->hdr.type;
120
121 if (id >= ST_INVALID)
122 id = ST_INVALID;
123 print_header(&rec->hdr);
124 print_detail[id](rec);
125 printf("\n");
126 return event_names[id];
127}
128
129
79void print_all(struct st_event_record *rec, unsigned int count) 130void print_all(struct st_event_record *rec, unsigned int count)
80{ 131{
81 unsigned int i; 132 unsigned int i;
82 for (i = 0; i < count; i++) { 133 for (i = 0; i < count; i++)
83 print_header(&rec[i].hdr); 134 print_event(&rec[i]);
84 printf("\n");
85 }
86} 135}