aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2009-04-14 23:13:30 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2009-04-14 23:25:06 -0400
commit715800e7610887ce87b5b6af61f9bddfdc29d97d (patch)
treec0c565eb2b0cf4ac0892848b2590154b0417c0cc /src
parentff0f490ff95fbe0ee4c9e5408e4eca84ab9ee770 (diff)
remove sched_trace stuff from liblitmus
Diffstat (limited to 'src')
-rw-r--r--src/sched_trace.c135
1 files changed, 0 insertions, 135 deletions
diff --git a/src/sched_trace.c b/src/sched_trace.c
deleted file mode 100644
index 464d75b..0000000
--- a/src/sched_trace.c
+++ /dev/null
@@ -1,135 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3
4
5#include <sys/types.h>
6#include <sys/stat.h>
7#include <sys/mman.h>
8#include <fcntl.h>
9#include <unistd.h>
10
11#include "litmus.h"
12#include "sched_trace.h"
13
14static const char* event_names[] = {
15 "INVALID",
16 "NAME",
17 "PARAM",
18 "RELEASE",
19 "ASSIGNED",
20 "SWITCH_TO",
21 "SWITCH_FROM",
22 "COMPLETION",
23 "BLOCK",
24 "RESUME",
25 "SYS_RELEASE",
26 "INVALID"
27};
28
29#define ST_INVALID (ST_SYS_RELEASE + 1)
30
31
32const char* event2name(unsigned int id)
33{
34 if (id >= ST_INVALID)
35 id = ST_INVALID;
36 return event_names[id];
37}
38
39
40u64 event_time(struct st_event_record* rec)
41{
42 u64 when;
43 switch (rec->hdr.type) {
44 /* the time stamp is encoded in the first payload u64 */
45 case ST_RELEASE:
46 case ST_ASSIGNED:
47 case ST_SWITCH_TO:
48 case ST_SWITCH_AWAY:
49 case ST_COMPLETION:
50 case ST_BLOCK:
51 case ST_RESUME:
52 case ST_SYS_RELEASE:
53 when = rec->data.raw[0];
54 break;
55 default:
56 /* stuff that doesn't have a time stamp should occur "early" */
57 when = 0;
58 break;
59 };
60 return when;
61}
62
63
64void print_header(struct st_trace_header* hdr)
65{
66 printf("%-14s %5u/%-5u on CPU%3u ",
67 event2name(hdr->type),
68 hdr->pid, hdr->job,
69 hdr->cpu);
70}
71
72typedef void (*print_t)(struct st_event_record* rec);
73
74static void print_nothing(struct st_event_record* _)
75{
76}
77
78static void print_raw(struct st_event_record* rec)
79{
80 printf(" type=%u", rec->hdr.type);
81}
82
83static void print_name(struct st_event_record* rec)
84{
85 /* terminate in all cases */
86 rec->data.name.cmd[ST_NAME_LEN - 1] = 0;
87 printf("%s", rec->data.name.cmd);
88}
89
90static void print_param(struct st_event_record* rec)
91{
92 printf("T=(cost:%6.2fms, period:%6.2fms, phase:%6.2fms), part=%d",
93 rec->data.param.wcet / 1000000.0,
94 rec->data.param.period / 1000000.0,
95 rec->data.param.phase / 1000000.0,\
96 rec->data.param.partition);
97}
98
99static void print_time_data2(struct st_event_record* rec)
100{
101 printf("%6.2fms", rec->data.raw[1] / 1000000.0);
102}
103
104static print_t print_detail[] = {
105 print_raw, /* invalid */
106 print_name, /* NAME */
107 print_param, /* PARAM */
108 print_time_data2, /* RELEASE */
109 print_nothing, /* ASSIGNED */
110 print_nothing, /* SWITCH_TO */
111 print_nothing, /* SWITCH_FROM */
112 print_nothing, /* COMPLETION */
113 print_nothing, /* BLOCK */
114 print_nothing, /* RESUME */
115 print_time_data2, /* SYS_RELEASE */
116 print_raw, /* invalid */
117};
118
119void print_event(struct st_event_record *rec)
120{
121 unsigned int id = rec->hdr.type;
122
123 if (id >= ST_INVALID)
124 id = ST_INVALID;
125 print_header(&rec->hdr);
126 print_detail[id](rec);
127 printf("\n");
128}
129
130void print_all(struct st_event_record *rec, unsigned int count)
131{
132 unsigned int i;
133 for (i = 0; i < count; i++)
134 print_event(&rec[i]);
135}