diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-03-12 13:13:22 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-03-12 13:42:34 -0400 |
commit | 0e71f86251307a37161cf3de2704a59882e25258 (patch) | |
tree | f6f28c6c1f9ff2edc68b64c164575728aa349bba /src | |
parent | fccb957780cf9685539b1d0717a5193248b30e48 (diff) |
Change convenience API routines.
The sproadic_*() macros have become unwieldy. This patch
replaces those convenience macros for global, clustered,
and partitioned scheduling. A part of this API change
is the explicit use of nanosecond time-values. Prior APIs
have used lt_t (litmus time), which had an implied time
scale of nanoseconds.
/bin apps and test suite also updated to use revised API.
Modifications to the test suite are mostly centered around
using nanoseconds instead of milliseconds.
Diffstat (limited to 'src')
-rw-r--r-- | src/litmus.c | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/src/litmus.c b/src/litmus.c index 09f9dc6..93a1c7f 100644 --- a/src/litmus.c +++ b/src/litmus.c | |||
@@ -119,42 +119,50 @@ task_class_t str2class(const char* str) | |||
119 | 119 | ||
120 | #define NS_PER_MS 1000000 | 120 | #define NS_PER_MS 1000000 |
121 | 121 | ||
122 | int sporadic_task(lt_t e, lt_t p, lt_t phase, | 122 | int sporadic_global(lt_t e_ns, lt_t p_ns) |
123 | int cluster, int cluster_size, unsigned int priority, | ||
124 | task_class_t cls, | ||
125 | budget_policy_t budget_policy, int set_cpu_set) | ||
126 | { | 123 | { |
127 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, | 124 | struct rt_task param; |
128 | cluster, cluster_size, priority, cls, | 125 | |
129 | budget_policy, set_cpu_set); | 126 | init_rt_task_param(¶m); |
127 | param.exec_cost = e_ns; | ||
128 | param.period = p_ns; | ||
129 | |||
130 | return set_rt_task_param(gettid(), ¶m); | ||
130 | } | 131 | } |
131 | 132 | ||
132 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, | 133 | int sporadic_partitioned(lt_t e_ns, lt_t p_ns, int partition) |
133 | int cluster, int cluster_size, unsigned int priority, | ||
134 | task_class_t cls, | ||
135 | budget_policy_t budget_policy, int migrate) | ||
136 | { | 134 | { |
135 | int ret; | ||
137 | struct rt_task param; | 136 | struct rt_task param; |
137 | |||
138 | ret = be_migrate_to_partition(partition); | ||
139 | check("be_migrate_to_partition()"); | ||
140 | if (ret != 0) | ||
141 | return ret; | ||
142 | |||
143 | init_rt_task_param(¶m); | ||
144 | param.exec_cost = e_ns; | ||
145 | param.period = p_ns; | ||
146 | param.cpu = partition_to_cpu(partition); | ||
147 | |||
148 | return set_rt_task_param(gettid(), ¶m); | ||
149 | } | ||
150 | |||
151 | int sporadic_clustered(lt_t e_ns, lt_t p_ns, int cluster, int cluster_size) | ||
152 | { | ||
138 | int ret; | 153 | int ret; |
154 | struct rt_task param; | ||
155 | |||
156 | ret = be_migrate_to_cluster(cluster, cluster_size); | ||
157 | check("be_migrate_to_cluster()"); | ||
158 | if (ret != 0) | ||
159 | return ret; | ||
160 | |||
161 | init_rt_task_param(¶m); | ||
162 | param.exec_cost = e_ns; | ||
163 | param.period = p_ns; | ||
164 | param.cpu = cluster_to_first_cpu(cluster, cluster_size); | ||
139 | 165 | ||
140 | /* Zero out first --- this is helpful when we add plugin-specific | ||
141 | * parameters during development. | ||
142 | */ | ||
143 | memset(¶m, 0, sizeof(param)); | ||
144 | |||
145 | param.exec_cost = e; | ||
146 | param.period = p; | ||
147 | param.relative_deadline = p; /* implicit deadline */ | ||
148 | param.cpu = cluster_to_first_cpu(cluster, cluster_size); | ||
149 | param.cls = cls; | ||
150 | param.phase = phase; | ||
151 | param.budget_policy = budget_policy; | ||
152 | param.priority = priority; | ||
153 | |||
154 | if (migrate) { | ||
155 | ret = be_migrate_to_cluster(cluster, cluster_size); | ||
156 | check("migrate to cluster"); | ||
157 | } | ||
158 | return set_rt_task_param(gettid(), ¶m); | 166 | return set_rt_task_param(gettid(), ¶m); |
159 | } | 167 | } |
160 | 168 | ||