aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-09-24 17:13:29 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-09-24 17:13:29 -0400
commit4f4d1a3992af845d0751962759aceb44e0050e22 (patch)
tree9f11620c5d5b0b2a0e058c2657508d274ecae4c4 /src
parent59e67e78312843793f299dbd9554afe09c23cad8 (diff)
API for basic display of sched_trace data
Diffstat (limited to 'src')
-rw-r--r--src/sched_trace.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/sched_trace.c b/src/sched_trace.c
index 17d3d06..9f532f3 100644
--- a/src/sched_trace.c
+++ b/src/sched_trace.c
@@ -45,3 +45,42 @@ static int map_trace(const char *name, void **start, void **end, size_t *size)
45 *end = *start + *size; 45 *end = *start + *size;
46 return ret; 46 return ret;
47} 47}
48
49static const char* event_names[] = {
50 "INVALID",
51 "NAME",
52 "PARAM",
53 "RELEASE",
54 "ASSIGNED",
55 "SWITCH_TO",
56 "SWITCH_FROM",
57 "COMPLETION",
58 "BLOCK",
59 "RESUME",
60 "INVALID"
61};
62
63#define ST_INVALID (ST_RESUME + 1)
64
65const char* event2name(unsigned int id)
66{
67 if (id >= ST_INVALID)
68 id = ST_INVALID;
69 return event_names[id];
70}
71
72void print_header(struct st_trace_header* hdr)
73{
74 printf("%-14s on CPU %u for %5u/%5u",
75 event2name(hdr->type),
76 hdr->cpu, hdr->pid, hdr->job);
77}
78
79void print_all(struct st_event_record *rec, unsigned int count)
80{
81 unsigned int i;
82 for (i = 0; i < count; i++) {
83 print_header(&rec[i].hdr);
84 printf("\n");
85 }
86}