diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-01-26 17:47:49 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-01-26 17:47:49 -0500 |
commit | 7dbc4a842d3bcfa755ba82cae46171d0098d4c2c (patch) | |
tree | a7166306cb4503e4288ef8c729be415767fe22c0 | |
parent | d11808b5c6b032de4284281ed2ff77ae697a4ebd (diff) |
Added support for tracing arbitrary actions.wip-events
-rw-r--r-- | include/litmus/sched_trace.h | 25 | ||||
-rw-r--r-- | litmus/sched_task_trace.c | 14 |
2 files changed, 34 insertions, 5 deletions
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index a5f73736f7e8..f7b2189374b2 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h | |||
@@ -34,7 +34,7 @@ struct st_release_data { /* A job is was/is going to be released. */ | |||
34 | struct st_assigned_data { /* A job was asigned to a CPU. */ | 34 | struct st_assigned_data { /* A job was asigned to a CPU. */ |
35 | u64 when; | 35 | u64 when; |
36 | u8 target; /* Where should it execute? */ | 36 | u8 target; /* Where should it execute? */ |
37 | u8 __unused[3]; | 37 | u8 __unused[7]; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct st_switch_to_data { /* A process was switched to on a given CPU. */ | 40 | struct st_switch_to_data { /* A process was switched to on a given CPU. */ |
@@ -54,7 +54,7 @@ struct st_completion_data { /* A job completed. */ | |||
54 | * next task automatically; set to 0 otherwise. | 54 | * next task automatically; set to 0 otherwise. |
55 | */ | 55 | */ |
56 | u8 __uflags:7; | 56 | u8 __uflags:7; |
57 | u8 __unused[3]; | 57 | u8 __unused[7]; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct st_block_data { /* A task blocks. */ | 60 | struct st_block_data { /* A task blocks. */ |
@@ -67,6 +67,12 @@ struct st_resume_data { /* A task resumes. */ | |||
67 | u64 __unused; | 67 | u64 __unused; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct st_action_data { | ||
71 | u64 when; | ||
72 | u8 action; | ||
73 | u8 __unused[7]; | ||
74 | }; | ||
75 | |||
70 | struct st_sys_release_data { | 76 | struct st_sys_release_data { |
71 | u64 when; | 77 | u64 when; |
72 | u64 release; | 78 | u64 release; |
@@ -85,7 +91,8 @@ typedef enum { | |||
85 | ST_COMPLETION, | 91 | ST_COMPLETION, |
86 | ST_BLOCK, | 92 | ST_BLOCK, |
87 | ST_RESUME, | 93 | ST_RESUME, |
88 | ST_SYS_RELEASE, | 94 | ST_ACTION, |
95 | ST_SYS_RELEASE | ||
89 | } st_event_record_type_t; | 96 | } st_event_record_type_t; |
90 | 97 | ||
91 | struct st_event_record { | 98 | struct st_event_record { |
@@ -102,8 +109,8 @@ struct st_event_record { | |||
102 | DATA(completion); | 109 | DATA(completion); |
103 | DATA(block); | 110 | DATA(block); |
104 | DATA(resume); | 111 | DATA(resume); |
112 | DATA(action); | ||
105 | DATA(sys_release); | 113 | DATA(sys_release); |
106 | |||
107 | } data; | 114 | } data; |
108 | }; | 115 | }; |
109 | 116 | ||
@@ -140,8 +147,12 @@ feather_callback void do_sched_trace_task_block(unsigned long id, | |||
140 | struct task_struct* task); | 147 | struct task_struct* task); |
141 | feather_callback void do_sched_trace_task_resume(unsigned long id, | 148 | feather_callback void do_sched_trace_task_resume(unsigned long id, |
142 | struct task_struct* task); | 149 | struct task_struct* task); |
150 | feather_callback void do_sched_trace_action(unsigned long id, | ||
151 | struct task_struct* task, | ||
152 | unsigned long action); | ||
143 | feather_callback void do_sched_trace_sys_release(unsigned long id, | 153 | feather_callback void do_sched_trace_sys_release(unsigned long id, |
144 | lt_t* start); | 154 | lt_t* start); |
155 | |||
145 | #endif | 156 | #endif |
146 | 157 | ||
147 | #else | 158 | #else |
@@ -172,9 +183,13 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, | |||
172 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 7, do_sched_trace_task_block, t) | 183 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 7, do_sched_trace_task_block, t) |
173 | #define sched_trace_task_resume(t) \ | 184 | #define sched_trace_task_resume(t) \ |
174 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 8, do_sched_trace_task_resume, t) | 185 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 8, do_sched_trace_task_resume, t) |
186 | #define sched_trace_action(t, action) \ | ||
187 | SCHED_TRACE2(SCHED_TRACE_BASE_ID + 9, do_sched_trace_action, t, \ | ||
188 | (unsigned long) action); | ||
175 | /* when is a pointer, it does not need an explicit cast to unsigned long */ | 189 | /* when is a pointer, it does not need an explicit cast to unsigned long */ |
176 | #define sched_trace_sys_release(when) \ | 190 | #define sched_trace_sys_release(when) \ |
177 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 9, do_sched_trace_sys_release, when) | 191 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 10, do_sched_trace_sys_release, when) |
192 | |||
178 | 193 | ||
179 | #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ | 194 | #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ |
180 | 195 | ||
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c index a15b25d21a89..bd490054f183 100644 --- a/litmus/sched_task_trace.c +++ b/litmus/sched_task_trace.c | |||
@@ -224,3 +224,17 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, | |||
224 | put_record(rec); | 224 | put_record(rec); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | |||
228 | feather_callback void do_sched_trace_action(unsigned long id, | ||
229 | unsigned long _task, | ||
230 | unsigned long action) | ||
231 | { | ||
232 | struct task_struct *t = (struct task_struct*) _task; | ||
233 | struct st_event_record* rec = get_record(ST_ACTION, t); | ||
234 | |||
235 | if (rec) { | ||
236 | rec->data.action.when = now(); | ||
237 | rec->data.action.action = action; | ||
238 | put_record(rec); | ||
239 | } | ||
240 | } | ||