aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/base_mt_task.c10
-rw-r--r--bin/base_task.c10
-rw-r--r--bin/release_ts.c5
-rw-r--r--bin/rt_launch.c4
-rw-r--r--bin/rtspin.c27
-rw-r--r--include/litmus.h57
-rw-r--r--src/litmus.c66
-rw-r--r--tests/core_api.c5
-rw-r--r--tests/fdso.c2
-rw-r--r--tests/locks.c4
-rw-r--r--tests/pcp.c32
-rw-r--r--tests/sched.c11
12 files changed, 113 insertions, 120 deletions
diff --git a/bin/base_mt_task.c b/bin/base_mt_task.c
index 8090cc3..aec79a4 100644
--- a/bin/base_mt_task.c
+++ b/bin/base_mt_task.c
@@ -26,8 +26,6 @@
26#define RELATIVE_DEADLINE 100 26#define RELATIVE_DEADLINE 100
27#define EXEC_COST 10 27#define EXEC_COST 10
28 28
29#define NS_PER_MS 1e6
30
31/* Let's create 10 threads in the example, 29/* Let's create 10 threads in the example,
32 * for a total utilization of 1. 30 * for a total utilization of 1.
33 */ 31 */
@@ -129,10 +127,10 @@ void* rt_thread(void *tcontext)
129 struct rt_task param; 127 struct rt_task param;
130 128
131 /* Set up task parameters */ 129 /* Set up task parameters */
132 memset(&param, 0, sizeof(param)); 130 init_rt_task_param(&param);
133 param.exec_cost = EXEC_COST * NS_PER_MS; 131 param.exec_cost = ms2ns(EXEC_COST);
134 param.period = PERIOD * NS_PER_MS; 132 param.period = ms2ns(PERIOD);
135 param.relative_deadline = RELATIVE_DEADLINE * NS_PER_MS; 133 param.relative_deadline = ms2ns(RELATIVE_DEADLINE);
136 134
137 /* What to do in the case of budget overruns? */ 135 /* What to do in the case of budget overruns? */
138 param.budget_policy = NO_ENFORCEMENT; 136 param.budget_policy = NO_ENFORCEMENT;
diff --git a/bin/base_task.c b/bin/base_task.c
index df0c5a2..09edba9 100644
--- a/bin/base_task.c
+++ b/bin/base_task.c
@@ -30,8 +30,6 @@
30#define RELATIVE_DEADLINE 100 30#define RELATIVE_DEADLINE 100
31#define EXEC_COST 10 31#define EXEC_COST 10
32 32
33#define NS_PER_MS 1e6
34
35/* Catch errors. 33/* Catch errors.
36 */ 34 */
37#define CALL( exp ) do { \ 35#define CALL( exp ) do { \
@@ -69,10 +67,10 @@ int main(int argc, char** argv)
69 struct rt_task param; 67 struct rt_task param;
70 68
71 /* Setup task parameters */ 69 /* Setup task parameters */
72 memset(&param, 0, sizeof(param)); 70 init_rt_task_param(&param);
73 param.exec_cost = EXEC_COST * NS_PER_MS; 71 param.exec_cost = ms2ns(EXEC_COST);
74 param.period = PERIOD * NS_PER_MS; 72 param.period = ms2ns(PERIOD);
75 param.relative_deadline = RELATIVE_DEADLINE * NS_PER_MS; 73 param.relative_deadline = ms2ns(RELATIVE_DEADLINE);
76 74
77 /* What to do in the case of budget overruns? */ 75 /* What to do in the case of budget overruns? */
78 param.budget_policy = NO_ENFORCEMENT; 76 param.budget_policy = NO_ENFORCEMENT;
diff --git a/bin/release_ts.c b/bin/release_ts.c
index c2f6d4c..feca5ef 100644
--- a/bin/release_ts.c
+++ b/bin/release_ts.c
@@ -10,7 +10,6 @@
10#include "internal.h" 10#include "internal.h"
11 11
12#define OPTSTR "d:wf:" 12#define OPTSTR "d:wf:"
13#define NS_PER_MS 1000000
14 13
15#define LITMUS_STATS_FILE "/proc/litmus/stats" 14#define LITMUS_STATS_FILE "/proc/litmus/stats"
16 15
@@ -44,7 +43,7 @@ void wait_until_ready(int expected)
44int main(int argc, char** argv) 43int main(int argc, char** argv)
45{ 44{
46 int released; 45 int released;
47 lt_t delay = ms2lt(1000); 46 lt_t delay = ms2ns(1000);
48 int wait = 0; 47 int wait = 0;
49 int expected = 0; 48 int expected = 0;
50 int opt; 49 int opt;
@@ -52,7 +51,7 @@ int main(int argc, char** argv)
52 while ((opt = getopt(argc, argv, OPTSTR)) != -1) { 51 while ((opt = getopt(argc, argv, OPTSTR)) != -1) {
53 switch (opt) { 52 switch (opt) {
54 case 'd': 53 case 'd':
55 delay = ms2lt(atoi(optarg)); 54 delay = ms2ns(atoi(optarg));
56 break; 55 break;
57 case 'w': 56 case 'w':
58 wait = 1; 57 wait = 1;
diff --git a/bin/rt_launch.c b/bin/rt_launch.c
index ae68601..93f10d5 100644
--- a/bin/rt_launch.c
+++ b/bin/rt_launch.c
@@ -99,8 +99,8 @@ int main(int argc, char** argv)
99 99
100 if (argc - optind < 3) 100 if (argc - optind < 3)
101 usage("Arguments missing."); 101 usage("Arguments missing.");
102 wcet = ms2lt(atoi(argv[optind + 0])); 102 wcet = ms2ns(atoi(argv[optind + 0]));
103 period = ms2lt(atoi(argv[optind + 1])); 103 period = ms2ns(atoi(argv[optind + 1]));
104 if (wcet <= 0) 104 if (wcet <= 0)
105 usage("The worst-case execution time must be a " 105 usage("The worst-case execution time must be a "
106 "positive number."); 106 "positive number.");
diff --git a/bin/rtspin.c b/bin/rtspin.c
index b05c17c..167741d 100644
--- a/bin/rtspin.c
+++ b/bin/rtspin.c
@@ -185,7 +185,6 @@ static int job(double exec_time, double program_end, int lock_od, double cs_leng
185} 185}
186 186
187#define OPTSTR "p:z:c:wlveo:f:s:q:X:L:Q:" 187#define OPTSTR "p:z:c:wlveo:f:s:q:X:L:Q:"
188
189int main(int argc, char** argv) 188int main(int argc, char** argv)
190{ 189{
191 int ret; 190 int ret;
@@ -207,6 +206,7 @@ int main(int argc, char** argv)
207 double scale = 1.0; 206 double scale = 1.0;
208 task_class_t class = RT_CLASS_HARD; 207 task_class_t class = RT_CLASS_HARD;
209 int cur_job = 0, num_jobs = 0; 208 int cur_job = 0, num_jobs = 0;
209 struct rt_task param;
210 210
211 /* locking */ 211 /* locking */
212 int lock_od = -1; 212 int lock_od = -1;
@@ -308,8 +308,8 @@ int main(int argc, char** argv)
308 wcet_ms = atof(argv[optind + 0]); 308 wcet_ms = atof(argv[optind + 0]);
309 period_ms = atof(argv[optind + 1]); 309 period_ms = atof(argv[optind + 1]);
310 310
311 wcet = wcet_ms * __NS_PER_MS; 311 wcet = ms2ns(wcet_ms);
312 period = period_ms * __NS_PER_MS; 312 period = ms2ns(period_ms);
313 if (wcet <= 0) 313 if (wcet <= 0)
314 usage("The worst-case execution time must be a " 314 usage("The worst-case execution time must be a "
315 "positive number."); 315 "positive number.");
@@ -325,11 +325,22 @@ int main(int argc, char** argv)
325 else if (file && num_jobs > 1) 325 else if (file && num_jobs > 1)
326 duration += period_ms * 0.001 * (num_jobs - 1); 326 duration += period_ms * 0.001 * (num_jobs - 1);
327 327
328 ret = sporadic_task_ns(wcet, period, 0, cluster, cluster_size, 328 if (migrate) {
329 priority, class, 329 ret = be_migrate_to_cluster(cluster, cluster_size);
330 want_enforcement ? PRECISE_ENFORCEMENT 330 if (ret < 0)
331 : NO_ENFORCEMENT, 331 bail_out("could not migrate to target partition or cluster.");
332 migrate); 332 }
333
334 init_rt_task_param(&param);
335 param.exec_cost = wcet;
336 param.period = period;
337 param.priority = priority;
338 param.cls = class;
339 param.budget_policy = (want_enforcement) ?
340 PRECISE_ENFORCEMENT : NO_ENFORCEMENT;
341 if (migrate)
342 param.cpu = cluster_to_first_cpu(cluster, cluster_size);
343 ret = set_rt_task_param(gettid(), &param);
333 if (ret < 0) 344 if (ret < 0)
334 bail_out("could not setup rt task params"); 345 bail_out("could not setup rt task params");
335 346
diff --git a/include/litmus.h b/include/litmus.h
index 429e614..1009805 100644
--- a/include/litmus.h
+++ b/include/litmus.h
@@ -18,7 +18,6 @@ extern "C" {
18 18
19#include "migration.h" 19#include "migration.h"
20 20
21
22void init_rt_task_param(struct rt_task* param); 21void init_rt_task_param(struct rt_task* param);
23int set_rt_task_param(pid_t pid, struct rt_task* param); 22int set_rt_task_param(pid_t pid, struct rt_task* param);
24int get_rt_task_param(pid_t pid, struct rt_task* param); 23int get_rt_task_param(pid_t pid, struct rt_task* param);
@@ -30,40 +29,21 @@ int get_rt_task_param(pid_t pid, struct rt_task* param);
30int partition_to_cpu(int partition); 29int partition_to_cpu(int partition);
31int cluster_to_first_cpu(int cluster, int cluster_size); 30int cluster_to_first_cpu(int cluster, int cluster_size);
32 31
33/* setup helper */ 32/* Convenience functions for setting up real-time tasks.
34 33 * Default behaviors set by init_rt_task_params() used.
35/* Times are given in ms. The 'priority' parameter 34 * Also sets affinity masks for clustered/partitions
36 * is only relevant under fixed-priority scheduling (and 35 * functions. Time units in nanoseconds. */
37 * ignored by other plugins). The task_class_t parameter 36int sporadic_global(lt_t e_ns, lt_t p_ns);
38 * is ignored by most plugins. 37int sporadic_partitioned(lt_t e_ns, lt_t p_ns, int partition);
39 */ 38int sporadic_clustered(lt_t e_ns, lt_t p_ns, int cluster, int cluster_size);
40int sporadic_task( 39
41 lt_t e, lt_t p, lt_t phase, 40/* simple time unit conversion macros */
42 int cluster, int cluster_size, unsigned int priority, 41#define s2ns(s) ((s)*1000000000LL)
43 task_class_t cls, 42#define s2us(s) ((s)*1000000LL)
44 budget_policy_t budget_policy, int be_migrate); 43#define s2ms(s) ((s)*1000LL)
45 44#define ms2ns(ms) ((ms)*1000000LL)
46/* Times are given in ns. The 'priority' parameter 45#define ms2us(ms) ((ms)*1000LL)
47 * is only relevant under fixed-priority scheduling (and 46#define us2ns(us) ((us)*1000LL)
48 * ignored by other plugins). The task_class_t parameter
49 * is ignored by most plugins.
50 */
51int sporadic_task_ns(
52 lt_t e, lt_t p, lt_t phase,
53 int cluster, int cluster_size, unsigned int priority,
54 task_class_t cls,
55 budget_policy_t budget_policy, int be_migrate);
56
57/* Convenience macros. Budget enforcement off by default in these macros. */
58#define sporadic_global(e, p) \
59 sporadic_task(e, p, 0, 0, 0, LITMUS_LOWEST_PRIORITY, \
60 RT_CLASS_SOFT, NO_ENFORCEMENT, 0)
61#define sporadic_partitioned(e, p, partition) \
62 sporadic_task(e, p, 0, partition, 1, LITMUS_LOWEST_PRIORITY, \
63 RT_CLASS_SOFT, NO_ENFORCEMENT, 1)
64#define sporadic_clustered(e, p, cluster, cluster_size) \
65 sporadic_task(e, p, 0, cluster, cluster_size, LITMUS_LOWEST_PRIORITY, \
66 RT_CLASS_SOFT, NO_ENFORCEMENT, 1)
67 47
68/* file descriptor attached shared objects support */ 48/* file descriptor attached shared objects support */
69typedef enum { 49typedef enum {
@@ -140,13 +120,6 @@ int release_ts(lt_t *delay);
140int get_nr_ts_release_waiters(void); 120int get_nr_ts_release_waiters(void);
141int read_litmus_stats(int *ready, int *total); 121int read_litmus_stats(int *ready, int *total);
142 122
143#define __NS_PER_MS 1000000
144
145static inline lt_t ms2lt(unsigned long milliseconds)
146{
147 return __NS_PER_MS * milliseconds;
148}
149
150/* sleep for some number of nanoseconds */ 123/* sleep for some number of nanoseconds */
151int lt_sleep(lt_t timeout); 124int lt_sleep(lt_t timeout);
152 125
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
122int sporadic_task(lt_t e, lt_t p, lt_t phase, 122int 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(&param);
127 param.exec_cost = e_ns;
128 param.period = p_ns;
129
130 return set_rt_task_param(gettid(), &param);
130} 131}
131 132
132int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, 133int 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(&param);
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(), &param);
149}
150
151int 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(&param);
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(&param, 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(), &param); 166 return set_rt_task_param(gettid(), &param);
159} 167}
160 168
diff --git a/tests/core_api.c b/tests/core_api.c
index b57e278..fc4deb9 100644
--- a/tests/core_api.c
+++ b/tests/core_api.c
@@ -18,6 +18,7 @@ TESTCASE(set_rt_task_param_invalid_params, ALL,
18 "reject invalid rt_task values") 18 "reject invalid rt_task values")
19{ 19{
20 struct rt_task params; 20 struct rt_task params;
21 init_rt_task_param(&params);
21 params.cpu = 0; 22 params.cpu = 0;
22 params.period = 100; 23 params.period = 100;
23 params.relative_deadline = params.period; 24 params.relative_deadline = params.period;
@@ -53,6 +54,7 @@ TESTCASE(reject_bad_priorities, P_FP,
53 "reject invalid priorities") 54 "reject invalid priorities")
54{ 55{
55 struct rt_task params; 56 struct rt_task params;
57 init_rt_task_param(&params);
56 params.cpu = 0; 58 params.cpu = 0;
57 params.exec_cost = 10; 59 params.exec_cost = 10;
58 params.period = 100; 60 params.period = 100;
@@ -79,6 +81,7 @@ TESTCASE(accept_valid_priorities, P_FP,
79 "accept lowest and highest valid priorities") 81 "accept lowest and highest valid priorities")
80{ 82{
81 struct rt_task params; 83 struct rt_task params;
84 init_rt_task_param(&params);
82 params.cpu = 0; 85 params.cpu = 0;
83 params.exec_cost = 10; 86 params.exec_cost = 10;
84 params.period = 100; 87 params.period = 100;
@@ -120,7 +123,7 @@ TESTCASE(rt_fork_non_rt, LITMUS,
120 unsigned int pid, job_no; 123 unsigned int pid, job_no;
121 int status; 124 int status;
122 125
123 SYSCALL( sporadic_partitioned(10, 100, 0) ); 126 SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) );
124 SYSCALL( task_mode(LITMUS_RT_TASK) ); 127 SYSCALL( task_mode(LITMUS_RT_TASK) );
125 128
126 pid = fork(); 129 pid = fork();
diff --git a/tests/fdso.c b/tests/fdso.c
index fda343f..570ea4a 100644
--- a/tests/fdso.c
+++ b/tests/fdso.c
@@ -66,7 +66,7 @@ TESTCASE(not_inherit_od, GSN_EDF | PSN_EDF,
66 ASSERT( pid != -1 ); 66 ASSERT( pid != -1 );
67 67
68 /* must be an RT task to lock at all */ 68 /* must be an RT task to lock at all */
69 SYSCALL( sporadic_partitioned(10, 100, 0) ); 69 SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) );
70 SYSCALL( task_mode(LITMUS_RT_TASK) ); 70 SYSCALL( task_mode(LITMUS_RT_TASK) );
71 71
72 if (pid == 0) { 72 if (pid == 0) {
diff --git a/tests/locks.c b/tests/locks.c
index 9a928b3..c3eba4e 100644
--- a/tests/locks.c
+++ b/tests/locks.c
@@ -53,7 +53,7 @@ TESTCASE(lock_srp, PSN_EDF | P_FP,
53 53
54 SYSCALL( fd = open(".srp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); 54 SYSCALL( fd = open(".srp_locks", O_RDONLY | O_CREAT, S_IRUSR) );
55 55
56 SYSCALL( sporadic_partitioned(10, 100, 0) ); 56 SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) );
57 SYSCALL( task_mode(LITMUS_RT_TASK) ); 57 SYSCALL( task_mode(LITMUS_RT_TASK) );
58 58
59 SYSCALL( od = open_srp_sem(fd, 0) ); 59 SYSCALL( od = open_srp_sem(fd, 0) );
@@ -85,7 +85,7 @@ TESTCASE(lock_fmlp, PSN_EDF | GSN_EDF | P_FP,
85 85
86 SYSCALL( fd = open(".fmlp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); 86 SYSCALL( fd = open(".fmlp_locks", O_RDONLY | O_CREAT, S_IRUSR) );
87 87
88 SYSCALL( sporadic_partitioned(10, 100, 0) ); 88 SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) );
89 SYSCALL( task_mode(LITMUS_RT_TASK) ); 89 SYSCALL( task_mode(LITMUS_RT_TASK) );
90 90
91 SYSCALL( od = open_fmlp_sem(fd, 0) ); 91 SYSCALL( od = open_fmlp_sem(fd, 0) );
diff --git a/tests/pcp.c b/tests/pcp.c
index cff4240..19009a3 100644
--- a/tests/pcp.c
+++ b/tests/pcp.c
@@ -15,7 +15,7 @@ TESTCASE(lock_pcp, P_FP,
15 15
16 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); 16 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) );
17 17
18 SYSCALL( sporadic_partitioned(10, 100, cpu) ); 18 SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), cpu) );
19 SYSCALL( task_mode(LITMUS_RT_TASK) ); 19 SYSCALL( task_mode(LITMUS_RT_TASK) );
20 20
21 SYSCALL( od = open_pcp_sem(fd, 0, cpu) ); 21 SYSCALL( od = open_pcp_sem(fd, 0, cpu) );
@@ -45,13 +45,14 @@ TESTCASE(pcp_inheritance, P_FP,
45 int fd, od, cpu = 0; 45 int fd, od, cpu = 0;
46 46
47 int child_hi, child_lo, child_middle, status, waiters; 47 int child_hi, child_lo, child_middle, status, waiters;
48 lt_t delay = ms2lt(100); 48 lt_t delay = ms2ns(100);
49 double start, stop; 49 double start, stop;
50 50
51 struct rt_task params; 51 struct rt_task params;
52 init_rt_task_param(&params);
52 params.cpu = 0; 53 params.cpu = 0;
53 params.exec_cost = ms2lt(10000); 54 params.exec_cost = ms2ns(10000);
54 params.period = ms2lt(100000); 55 params.period = ms2ns(100000);
55 params.relative_deadline = params.period; 56 params.relative_deadline = params.period;
56 params.phase = 0; 57 params.phase = 0;
57 params.cls = RT_CLASS_HARD; 58 params.cls = RT_CLASS_HARD;
@@ -82,7 +83,7 @@ TESTCASE(pcp_inheritance, P_FP,
82 83
83 child_middle = FORK_TASK( 84 child_middle = FORK_TASK(
84 params.priority = LITMUS_HIGHEST_PRIORITY + 1; 85 params.priority = LITMUS_HIGHEST_PRIORITY + 1;
85 params.phase = ms2lt(100); 86 params.phase = ms2ns(100);
86 87
87 SYSCALL( set_rt_task_param(gettid(), &params) ); 88 SYSCALL( set_rt_task_param(gettid(), &params) );
88 SYSCALL( be_migrate_to_cpu(params.cpu) ); 89 SYSCALL( be_migrate_to_cpu(params.cpu) );
@@ -99,7 +100,7 @@ TESTCASE(pcp_inheritance, P_FP,
99 100
100 child_hi = FORK_TASK( 101 child_hi = FORK_TASK(
101 params.priority = LITMUS_HIGHEST_PRIORITY; 102 params.priority = LITMUS_HIGHEST_PRIORITY;
102 params.phase = ms2lt(50); 103 params.phase = ms2ns(50);
103 104
104 SYSCALL( set_rt_task_param(gettid(), &params) ); 105 SYSCALL( set_rt_task_param(gettid(), &params) );
105 SYSCALL( be_migrate_to_cpu(params.cpu) ); 106 SYSCALL( be_migrate_to_cpu(params.cpu) );
@@ -150,13 +151,14 @@ TESTCASE(srp_ceiling_blocking, P_FP | PSN_EDF,
150 int fd, od; 151 int fd, od;
151 152
152 int child_hi, child_lo, child_middle, status, waiters; 153 int child_hi, child_lo, child_middle, status, waiters;
153 lt_t delay = ms2lt(100); 154 lt_t delay = ms2ns(100);
154 double start, stop; 155 double start, stop;
155 156
156 struct rt_task params; 157 struct rt_task params;
158 init_rt_task_param(&params);
157 params.cpu = 0; 159 params.cpu = 0;
158 params.exec_cost = ms2lt(10000); 160 params.exec_cost = ms2ns(10000);
159 params.period = ms2lt(100000); 161 params.period = ms2ns(100000);
160 params.relative_deadline = params.period; 162 params.relative_deadline = params.period;
161 params.phase = 0; 163 params.phase = 0;
162 params.cls = RT_CLASS_HARD; 164 params.cls = RT_CLASS_HARD;
@@ -185,8 +187,8 @@ TESTCASE(srp_ceiling_blocking, P_FP | PSN_EDF,
185 187
186 child_middle = FORK_TASK( 188 child_middle = FORK_TASK(
187 params.priority = LITMUS_HIGHEST_PRIORITY + 1; 189 params.priority = LITMUS_HIGHEST_PRIORITY + 1;
188 params.phase = ms2lt(100); 190 params.phase = ms2ns(100);
189 params.relative_deadline -= ms2lt(110); 191 params.relative_deadline -= ms2ns(110);
190 192
191 SYSCALL( set_rt_task_param(gettid(), &params) ); 193 SYSCALL( set_rt_task_param(gettid(), &params) );
192 SYSCALL( be_migrate_to_cpu(params.cpu) ); 194 SYSCALL( be_migrate_to_cpu(params.cpu) );
@@ -202,8 +204,8 @@ TESTCASE(srp_ceiling_blocking, P_FP | PSN_EDF,
202 204
203 child_hi = FORK_TASK( 205 child_hi = FORK_TASK(
204 params.priority = LITMUS_HIGHEST_PRIORITY; 206 params.priority = LITMUS_HIGHEST_PRIORITY;
205 params.phase = ms2lt(50); 207 params.phase = ms2ns(50);
206 params.relative_deadline -= ms2lt(200); 208 params.relative_deadline -= ms2ns(200);
207 209
208 SYSCALL( set_rt_task_param(gettid(), &params) ); 210 SYSCALL( set_rt_task_param(gettid(), &params) );
209 SYSCALL( be_migrate_to_cpu(params.cpu) ); 211 SYSCALL( be_migrate_to_cpu(params.cpu) );
@@ -252,7 +254,7 @@ TESTCASE(lock_dpcp, P_FP,
252 254
253 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); 255 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) );
254 256
255 SYSCALL( sporadic_partitioned(10, 100, 0) ); 257 SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) );
256 SYSCALL( task_mode(LITMUS_RT_TASK) ); 258 SYSCALL( task_mode(LITMUS_RT_TASK) );
257 259
258 SYSCALL( od = open_dpcp_sem(fd, 0, cpu) ); 260 SYSCALL( od = open_dpcp_sem(fd, 0, cpu) );
@@ -305,7 +307,7 @@ TESTCASE(lock_mpcp, P_FP,
305 307
306 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); 308 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) );
307 309
308 SYSCALL( sporadic_partitioned(10, 100, 0) ); 310 SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) );
309 SYSCALL( task_mode(LITMUS_RT_TASK) ); 311 SYSCALL( task_mode(LITMUS_RT_TASK) );
310 312
311 SYSCALL( od = open_mpcp_sem(fd, 0) ); 313 SYSCALL( od = open_mpcp_sem(fd, 0) );
diff --git a/tests/sched.c b/tests/sched.c
index 713fde2..6726b46 100644
--- a/tests/sched.c
+++ b/tests/sched.c
@@ -9,13 +9,14 @@ TESTCASE(preempt_on_resume, P_FP | PSN_EDF,
9 "preempt lower-priority task when a higher-priority task resumes") 9 "preempt lower-priority task when a higher-priority task resumes")
10{ 10{
11 int child_hi, child_lo, status, waiters; 11 int child_hi, child_lo, status, waiters;
12 lt_t delay = ms2lt(100); 12 lt_t delay = ms2ns(100);
13 double start, stop; 13 double start, stop;
14 14
15 struct rt_task params; 15 struct rt_task params;
16 init_rt_task_param(&params);
16 params.cpu = 0; 17 params.cpu = 0;
17 params.exec_cost = ms2lt(10000); 18 params.exec_cost = ms2ns(10000);
18 params.period = ms2lt(100000); 19 params.period = ms2ns(100000);
19 params.relative_deadline = params.period; 20 params.relative_deadline = params.period;
20 params.phase = 0; 21 params.phase = 0;
21 params.cls = RT_CLASS_HARD; 22 params.cls = RT_CLASS_HARD;
@@ -51,14 +52,14 @@ TESTCASE(preempt_on_resume, P_FP | PSN_EDF,
51 ; 52 ;
52 53
53 start = wctime(); 54 start = wctime();
54 SYSCALL( lt_sleep(ms2lt(100)) ); 55 SYSCALL( lt_sleep(ms2ns(100)) );
55 stop = wctime(); 56 stop = wctime();
56 57
57 SYSCALL( kill(child_lo, SIGUSR2) ); 58 SYSCALL( kill(child_lo, SIGUSR2) );
58 59
59 if (stop - start >= 0.2) 60 if (stop - start >= 0.2)
60 fprintf(stderr, "\nHi-prio delay = %fsec\n", 61 fprintf(stderr, "\nHi-prio delay = %fsec\n",
61 stop - start - (ms2lt(100) / 1E9)); 62 stop - start - (ms2ns(100) / (float)s2ns(1)));
62 63
63 /* Assert we woke up 'soonish' after the sleep. */ 64 /* Assert we woke up 'soonish' after the sleep. */
64 ASSERT( stop - start < 0.2 ); 65 ASSERT( stop - start < 0.2 );