diff options
| author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-09-16 15:26:55 -0400 |
|---|---|---|
| committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-09-16 15:26:55 -0400 |
| commit | 2847cec47d8812ffe320b4ceb7fe7ea40965efe1 (patch) | |
| tree | b55308f09eba15b014b770ba5da0b616701c31d5 /include | |
| parent | 85396eb1ff28d4af26fd02c78fd7582cc5de6050 (diff) | |
sched_trace: provide new event record definitions
Each record is exactly 24 bytes (= three 64bit integers) long.
We accept possibly truncated fields in order to save some space.
Diffstat (limited to 'include')
| -rw-r--r-- | include/litmus/sched_trace.h | 116 |
1 files changed, 114 insertions, 2 deletions
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index 60dcbfb0ae..3be349a69b 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h | |||
| @@ -3,12 +3,111 @@ | |||
| 3 | #ifndef _LINUX_SCHED_TRACE_H_ | 3 | #ifndef _LINUX_SCHED_TRACE_H_ |
| 4 | #define _LINUX_SCHED_TRACE_H_ | 4 | #define _LINUX_SCHED_TRACE_H_ |
| 5 | 5 | ||
| 6 | /* all times in nanoseconds */ | ||
| 7 | |||
| 8 | struct st_trace_header { | ||
| 9 | u8 type; /* Of what type is this record? */ | ||
| 10 | u8 cpu; /* On which CPU was it recorded? */ | ||
| 11 | u16 pid; /* PID of the task. */ | ||
| 12 | u32 job; /* The job sequence number. */ | ||
| 13 | }; | ||
| 14 | |||
| 15 | struct st_name_data { | ||
| 16 | char cmd[16]; /* The name of the executable of this process. */ | ||
| 17 | }; | ||
| 18 | |||
| 19 | struct st_param_data { /* regular params */ | ||
| 20 | u32 wcet; | ||
| 21 | u32 period; | ||
| 22 | u32 phase; | ||
| 23 | u8 partition; | ||
| 24 | u8 __unused[3]; | ||
| 25 | }; | ||
| 26 | |||
| 27 | struct st_release_data { /* A job is was/is going to be released. */ | ||
| 28 | u64 release; /* What's the release time? */ | ||
| 29 | u64 deadline; /* By when must it finish? */ | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct st_assigned_data { /* A job was asigned to a CPU. */ | ||
| 33 | u64 when; | ||
| 34 | u8 target; /* Where should it execute? */ | ||
| 35 | u8 __unused[3]; | ||
| 36 | }; | ||
| 37 | |||
| 38 | struct st_switch_to_data { /* A process was switched to on a given CPU. */ | ||
| 39 | u64 when; /* When did this occur? */ | ||
| 40 | u32 exec_time; /* Time the current job has executed. */ | ||
| 41 | |||
| 42 | }; | ||
| 43 | |||
| 44 | struct st_switch_away_data { /* A process was switched away from on a given CPU. */ | ||
| 45 | u64 when; | ||
| 46 | u64 exec_time; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct st_completion_data { /* A job completed. */ | ||
| 50 | u64 when; | ||
| 51 | u8 forced:1; /* Set to 1 if job overran and kernel advanced to the | ||
| 52 | * next task automatically; set to 0 otherwise. | ||
| 53 | */ | ||
| 54 | u8 __uflags:7; | ||
| 55 | u8 __unused[3]; | ||
| 56 | }; | ||
| 57 | |||
| 58 | struct st_block_data { /* A task blocks. */ | ||
| 59 | u64 when; | ||
| 60 | u64 __unused; | ||
| 61 | }; | ||
| 62 | |||
| 63 | struct st_resume_data { /* A task resumes. */ | ||
| 64 | u64 when; | ||
| 65 | u64 __unused; | ||
| 66 | }; | ||
| 67 | |||
| 68 | |||
| 69 | #define DATA(x) struct st_ ## x ## _data x; | ||
| 70 | |||
| 71 | typedef enum { | ||
| 72 | ST_NAME = 1, /* Start at one, so that we can spot | ||
| 73 | * uninitialized records. */ | ||
| 74 | ST_PARAM, | ||
| 75 | ST_RELEASE, | ||
| 76 | ST_ASSIGNED, | ||
| 77 | ST_SWITCH_TO, | ||
| 78 | ST_SWITCH_AWAY, | ||
| 79 | ST_COMPLETION, | ||
| 80 | ST_BLOCK, | ||
| 81 | ST_RESUME | ||
| 82 | } st_event_record_type_t; | ||
| 83 | |||
| 84 | struct st_event_record { | ||
| 85 | struct st_trace_header hdr; | ||
| 86 | union { | ||
| 87 | u64 raw[2]; | ||
| 88 | |||
| 89 | DATA(name); | ||
| 90 | DATA(param); | ||
| 91 | DATA(release); | ||
| 92 | DATA(assigned); | ||
| 93 | DATA(switch_to); | ||
| 94 | DATA(switch_away); | ||
| 95 | DATA(completion); | ||
| 96 | DATA(block); | ||
| 97 | DATA(resume); | ||
| 98 | |||
| 99 | } data; | ||
| 100 | }; | ||
| 101 | |||
| 102 | #undef DATA | ||
| 103 | |||
| 104 | #ifdef __KERNEL__ | ||
| 105 | |||
| 6 | #include <linux/sched.h> | 106 | #include <linux/sched.h> |
| 7 | 107 | ||
| 8 | /* dummies, need to be re-implemented */ | 108 | /* dummies, need to be re-implemented */ |
| 9 | |||
| 10 | /* used in sched.c */ | 109 | /* used in sched.c */ |
| 11 | #define sched_trace_task_arrival(t) | 110 | #define sched_trace_task_arrival(t) |
| 12 | #define sched_trace_task_departure(t) | 111 | #define sched_trace_task_departure(t) |
| 13 | #define sched_trace_task_preemption(t, by) | 112 | #define sched_trace_task_preemption(t, by) |
| 14 | #define sched_trace_task_scheduled(t) | 113 | #define sched_trace_task_scheduled(t) |
| @@ -18,6 +117,18 @@ | |||
| 18 | #define sched_trace_job_completion(t) | 117 | #define sched_trace_job_completion(t) |
| 19 | 118 | ||
| 20 | 119 | ||
| 120 | |||
| 121 | #ifdef CONFIG_SCHED_TASK_TRACE | ||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | |||
| 126 | #else | ||
| 127 | |||
| 128 | |||
| 129 | #endif | ||
| 130 | |||
| 131 | |||
| 21 | #ifdef CONFIG_SCHED_DEBUG_TRACE | 132 | #ifdef CONFIG_SCHED_DEBUG_TRACE |
| 22 | void sched_trace_log_message(const char* fmt, ...); | 133 | void sched_trace_log_message(const char* fmt, ...); |
| 23 | 134 | ||
| @@ -27,5 +138,6 @@ void sched_trace_log_message(const char* fmt, ...); | |||
| 27 | 138 | ||
| 28 | #endif | 139 | #endif |
| 29 | 140 | ||
| 141 | #endif /* __KERNEL__ */ | ||
| 30 | 142 | ||
| 31 | #endif | 143 | #endif |
