diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-04-11 11:00:35 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-04-11 11:00:35 -0400 |
commit | 7f5bca0f5d1c1bfc56c83e248360720ef45c842a (patch) | |
tree | 542dc955de70f2d573de50848680046f923029e0 /native/src/edf | |
parent | 20f6bc1e25b366c55fb95fb084ded37407042071 (diff) |
Rename time types used in C++ schedulablity analysis
integral_t == integral time units
fractional_t == fractions of integral time units
This is hopefully less of an eyesore than mpq_class and mpz_class.
Diffstat (limited to 'native/src/edf')
-rw-r--r-- | native/src/edf/baker.cpp | 12 | ||||
-rw-r--r-- | native/src/edf/baruah.cpp | 76 | ||||
-rw-r--r-- | native/src/edf/bcl.cpp | 8 | ||||
-rw-r--r-- | native/src/edf/bcl_iterative.cpp | 8 | ||||
-rw-r--r-- | native/src/edf/ffdbf.cpp | 68 | ||||
-rw-r--r-- | native/src/edf/gedf.cpp | 2 | ||||
-rw-r--r-- | native/src/edf/gfb.cpp | 2 | ||||
-rw-r--r-- | native/src/edf/load.cpp | 4 | ||||
-rw-r--r-- | native/src/edf/rta.cpp | 16 |
9 files changed, 98 insertions, 98 deletions
diff --git a/native/src/edf/baker.cpp b/native/src/edf/baker.cpp index ca2b8cc..3d13b2c 100644 --- a/native/src/edf/baker.cpp +++ b/native/src/edf/baker.cpp | |||
@@ -8,10 +8,10 @@ | |||
8 | using namespace std; | 8 | using namespace std; |
9 | 9 | ||
10 | void BakerGedf::beta(const Task &t_i, const Task &t_k, | 10 | void BakerGedf::beta(const Task &t_i, const Task &t_k, |
11 | const mpq_class &lambda_k, | 11 | const fractional_t &lambda_k, |
12 | mpq_class &beta_i) | 12 | fractional_t &beta_i) |
13 | { | 13 | { |
14 | mpq_class u_i; | 14 | fractional_t u_i; |
15 | 15 | ||
16 | // XXX: possible improvement would be to pre-compute u_i | 16 | // XXX: possible improvement would be to pre-compute u_i |
17 | // instead of incurring quadratic u_i computations. | 17 | // instead of incurring quadratic u_i computations. |
@@ -24,7 +24,7 @@ void BakerGedf::beta(const Task &t_i, const Task &t_k, | |||
24 | 24 | ||
25 | if (lambda_k < u_i) | 25 | if (lambda_k < u_i) |
26 | { | 26 | { |
27 | mpq_class tmp = t_i.get_wcet(); | 27 | fractional_t tmp = t_i.get_wcet(); |
28 | tmp -= lambda_k * t_i.get_period(); | 28 | tmp -= lambda_k * t_i.get_period(); |
29 | tmp /= t_k.get_deadline(); | 29 | tmp /= t_k.get_deadline(); |
30 | beta_i += tmp; | 30 | beta_i += tmp; |
@@ -33,8 +33,8 @@ void BakerGedf::beta(const Task &t_i, const Task &t_k, | |||
33 | 33 | ||
34 | bool BakerGedf::is_task_schedulable(unsigned int k, const TaskSet &ts) | 34 | bool BakerGedf::is_task_schedulable(unsigned int k, const TaskSet &ts) |
35 | { | 35 | { |
36 | mpq_class lambda, bound, beta_i, beta_sum = 0; | 36 | fractional_t lambda, bound, beta_i, beta_sum = 0; |
37 | mpq_class one = 1; | 37 | fractional_t one = 1; |
38 | 38 | ||
39 | ts[k].get_density(lambda); | 39 | ts[k].get_density(lambda); |
40 | 40 | ||
diff --git a/native/src/edf/baruah.cpp b/native/src/edf/baruah.cpp index 1b82baa..d2699e5 100644 --- a/native/src/edf/baruah.cpp +++ b/native/src/edf/baruah.cpp | |||
@@ -18,8 +18,8 @@ const double BaruahGedf::MAX_RUNTIME = 5.0; /* seconds */ | |||
18 | 18 | ||
19 | 19 | ||
20 | static void demand_bound_function(const Task &tsk, | 20 | static void demand_bound_function(const Task &tsk, |
21 | const mpz_class &t, | 21 | const integral_t &t, |
22 | mpz_class &db) | 22 | integral_t &db) |
23 | { | 23 | { |
24 | db = t; | 24 | db = t; |
25 | db -= tsk.get_deadline(); | 25 | db -= tsk.get_deadline(); |
@@ -36,7 +36,7 @@ static void demand_bound_function(const Task &tsk, | |||
36 | class DBFPointsOfChange | 36 | class DBFPointsOfChange |
37 | { | 37 | { |
38 | private: | 38 | private: |
39 | mpz_class cur; | 39 | integral_t cur; |
40 | unsigned long pi; // period | 40 | unsigned long pi; // period |
41 | 41 | ||
42 | public: | 42 | public: |
@@ -56,7 +56,7 @@ public: | |||
56 | next(); | 56 | next(); |
57 | } | 57 | } |
58 | 58 | ||
59 | const mpz_class& get_cur() const | 59 | const integral_t& get_cur() const |
60 | { | 60 | { |
61 | return cur; | 61 | return cur; |
62 | } | 62 | } |
@@ -84,11 +84,11 @@ class AllDBFPointsOfChange | |||
84 | private: | 84 | private: |
85 | DBFPointsOfChange *dbf; | 85 | DBFPointsOfChange *dbf; |
86 | DBFQueue queue; | 86 | DBFQueue queue; |
87 | mpz_class last; | 87 | integral_t last; |
88 | mpz_class *upper_bound; | 88 | integral_t *upper_bound; |
89 | 89 | ||
90 | public: | 90 | public: |
91 | void init(const TaskSet &ts, int k, mpz_class* bound) | 91 | void init(const TaskSet &ts, int k, integral_t* bound) |
92 | { | 92 | { |
93 | last = -1; | 93 | last = -1; |
94 | dbf = new DBFPointsOfChange[ts.get_task_count()]; | 94 | dbf = new DBFPointsOfChange[ts.get_task_count()]; |
@@ -105,7 +105,7 @@ public: | |||
105 | delete[] dbf; | 105 | delete[] dbf; |
106 | } | 106 | } |
107 | 107 | ||
108 | bool get_next(mpz_class &t) | 108 | bool get_next(integral_t &t) |
109 | { | 109 | { |
110 | if (last > *upper_bound) | 110 | if (last > *upper_bound) |
111 | return false; | 111 | return false; |
@@ -127,49 +127,49 @@ public: | |||
127 | 127 | ||
128 | static | 128 | static |
129 | void interval1(unsigned int i, unsigned int k, const TaskSet &ts, | 129 | void interval1(unsigned int i, unsigned int k, const TaskSet &ts, |
130 | const mpz_class &ilen, mpz_class &i1) | 130 | const integral_t &ilen, integral_t &i1) |
131 | { | 131 | { |
132 | mpz_class dbf, tmp; | 132 | integral_t dbf, tmp; |
133 | tmp = ilen + ts[k].get_deadline(); | 133 | tmp = ilen + ts[k].get_deadline(); |
134 | demand_bound_function(ts[i], tmp, dbf); | 134 | demand_bound_function(ts[i], tmp, dbf); |
135 | if (i == k) | 135 | if (i == k) |
136 | i1 = min(mpz_class(dbf - ts[k].get_wcet()), ilen); | 136 | i1 = min(integral_t(dbf - ts[k].get_wcet()), ilen); |
137 | else | 137 | else |
138 | i1 = min(dbf, | 138 | i1 = min(dbf, |
139 | mpz_class(ilen + ts[k].get_deadline() - | 139 | integral_t(ilen + ts[k].get_deadline() - |
140 | (ts[k].get_wcet() - 1))); | 140 | (ts[k].get_wcet() - 1))); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | static void demand_bound_function_prime(const Task &tsk, | 144 | static void demand_bound_function_prime(const Task &tsk, |
145 | const mpz_class &t, | 145 | const integral_t &t, |
146 | mpz_class &db) | 146 | integral_t &db) |
147 | // carry-in scenario | 147 | // carry-in scenario |
148 | { | 148 | { |
149 | db = t; | 149 | db = t; |
150 | db /= tsk.get_period(); | 150 | db /= tsk.get_period(); |
151 | db *= tsk.get_wcet(); | 151 | db *= tsk.get_wcet(); |
152 | db += min(mpz_class(tsk.get_wcet()), mpz_class(t % tsk.get_period())); | 152 | db += min(integral_t(tsk.get_wcet()), integral_t(t % tsk.get_period())); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void interval2(unsigned int i, unsigned int k, const TaskSet &ts, | 155 | static void interval2(unsigned int i, unsigned int k, const TaskSet &ts, |
156 | const mpz_class &ilen, mpz_class &i2) | 156 | const integral_t &ilen, integral_t &i2) |
157 | { | 157 | { |
158 | mpz_class dbf, tmp; | 158 | integral_t dbf, tmp; |
159 | 159 | ||
160 | tmp = ilen + ts[k].get_deadline(); | 160 | tmp = ilen + ts[k].get_deadline(); |
161 | demand_bound_function_prime(ts[i], tmp, dbf); | 161 | demand_bound_function_prime(ts[i], tmp, dbf); |
162 | if (i == k) | 162 | if (i == k) |
163 | i2 = min(mpz_class(dbf - ts[k].get_wcet()), ilen); | 163 | i2 = min(integral_t(dbf - ts[k].get_wcet()), ilen); |
164 | else | 164 | else |
165 | i2 = min(dbf, | 165 | i2 = min(dbf, |
166 | mpz_class(ilen + ts[k].get_deadline() - | 166 | integral_t(ilen + ts[k].get_deadline() - |
167 | (ts[k].get_wcet() - 1))); | 167 | (ts[k].get_wcet() - 1))); |
168 | } | 168 | } |
169 | 169 | ||
170 | class MPZComparator { | 170 | class MPZComparator { |
171 | public: | 171 | public: |
172 | bool operator() (mpz_class *a, mpz_class *b) | 172 | bool operator() (integral_t *a, integral_t *b) |
173 | { | 173 | { |
174 | return *b < *a; | 174 | return *b < *a; |
175 | } | 175 | } |
@@ -177,13 +177,13 @@ public: | |||
177 | 177 | ||
178 | bool BaruahGedf::is_task_schedulable(unsigned int k, | 178 | bool BaruahGedf::is_task_schedulable(unsigned int k, |
179 | const TaskSet &ts, | 179 | const TaskSet &ts, |
180 | const mpz_class &ilen, | 180 | const integral_t &ilen, |
181 | mpz_class &i1, | 181 | integral_t &i1, |
182 | mpz_class &sum, | 182 | integral_t &sum, |
183 | mpz_class *idiff, | 183 | integral_t *idiff, |
184 | mpz_class **ptr) | 184 | integral_t **ptr) |
185 | { | 185 | { |
186 | mpz_class bound; | 186 | integral_t bound; |
187 | sum = 0; | 187 | sum = 0; |
188 | 188 | ||
189 | for (unsigned int i = 0; i < ts.get_task_count(); i++) | 189 | for (unsigned int i = 0; i < ts.get_task_count(); i++) |
@@ -206,8 +206,8 @@ bool BaruahGedf::is_task_schedulable(unsigned int k, | |||
206 | } | 206 | } |
207 | 207 | ||
208 | void BaruahGedf::get_max_test_points(const TaskSet &ts, | 208 | void BaruahGedf::get_max_test_points(const TaskSet &ts, |
209 | mpq_class &m_minus_u, | 209 | fractional_t &m_minus_u, |
210 | mpz_class* maxp) | 210 | integral_t* maxp) |
211 | { | 211 | { |
212 | unsigned long* wcet = new unsigned long[ts.get_task_count()]; | 212 | unsigned long* wcet = new unsigned long[ts.get_task_count()]; |
213 | 213 | ||
@@ -216,8 +216,8 @@ void BaruahGedf::get_max_test_points(const TaskSet &ts, | |||
216 | 216 | ||
217 | sort(wcet, wcet + ts.get_task_count(), greater<unsigned long>()); | 217 | sort(wcet, wcet + ts.get_task_count(), greater<unsigned long>()); |
218 | 218 | ||
219 | mpq_class u, tdu_sum; | 219 | fractional_t u, tdu_sum; |
220 | mpz_class csigma, mc; | 220 | integral_t csigma, mc; |
221 | 221 | ||
222 | csigma = 0; | 222 | csigma = 0; |
223 | for (unsigned int i = 0; i < m - 1 && i < ts.get_task_count(); i++) | 223 | for (unsigned int i = 0; i < m - 1 && i < ts.get_task_count(); i++) |
@@ -256,7 +256,7 @@ bool BaruahGedf::is_schedulable(const TaskSet &ts, | |||
256 | return true; | 256 | return true; |
257 | } | 257 | } |
258 | 258 | ||
259 | mpq_class m_minus_u; | 259 | fractional_t m_minus_u; |
260 | ts.get_utilization(m_minus_u); | 260 | ts.get_utilization(m_minus_u); |
261 | m_minus_u *= -1; | 261 | m_minus_u *= -1; |
262 | m_minus_u += m; | 262 | m_minus_u += m; |
@@ -270,19 +270,19 @@ bool BaruahGedf::is_schedulable(const TaskSet &ts, | |||
270 | 270 | ||
271 | double start_time = get_cpu_usage(); | 271 | double start_time = get_cpu_usage(); |
272 | 272 | ||
273 | mpz_class i1, sum; | 273 | integral_t i1, sum; |
274 | mpz_class *max_test_point, *idiff; | 274 | integral_t *max_test_point, *idiff; |
275 | mpz_class** ptr; // indirect access to idiff | 275 | integral_t** ptr; // indirect access to idiff |
276 | 276 | ||
277 | idiff = new mpz_class[ts.get_task_count()]; | 277 | idiff = new integral_t[ts.get_task_count()]; |
278 | max_test_point = new mpz_class[ts.get_task_count()]; | 278 | max_test_point = new integral_t[ts.get_task_count()]; |
279 | ptr = new mpz_class*[ts.get_task_count()]; | 279 | ptr = new integral_t*[ts.get_task_count()]; |
280 | for (unsigned int i = 0; i < ts.get_task_count(); i++) | 280 | for (unsigned int i = 0; i < ts.get_task_count(); i++) |
281 | ptr[i] = idiff + i; | 281 | ptr[i] = idiff + i; |
282 | 282 | ||
283 | get_max_test_points(ts, m_minus_u, max_test_point); | 283 | get_max_test_points(ts, m_minus_u, max_test_point); |
284 | 284 | ||
285 | mpz_class ilen; | 285 | integral_t ilen; |
286 | bool point_in_range = true; | 286 | bool point_in_range = true; |
287 | bool schedulable = true; | 287 | bool schedulable = true; |
288 | 288 | ||
diff --git a/native/src/edf/bcl.cpp b/native/src/edf/bcl.cpp index 8cc25d9..d7fa721 100644 --- a/native/src/edf/bcl.cpp +++ b/native/src/edf/bcl.cpp | |||
@@ -15,11 +15,11 @@ unsigned long BCLGedf::max_jobs_contained(const Task &t_i, const Task &t_k) | |||
15 | return 1 + (t_k.get_deadline() - t_i.get_deadline()) / t_i.get_period(); | 15 | return 1 + (t_k.get_deadline() - t_i.get_deadline()) / t_i.get_period(); |
16 | } | 16 | } |
17 | 17 | ||
18 | void BCLGedf::beta(const Task &t_i, const Task &t_k, mpq_class &beta_i) | 18 | void BCLGedf::beta(const Task &t_i, const Task &t_k, fractional_t &beta_i) |
19 | { | 19 | { |
20 | unsigned long n = max_jobs_contained(t_i, t_k); | 20 | unsigned long n = max_jobs_contained(t_i, t_k); |
21 | 21 | ||
22 | mpz_class c_i, tmp; | 22 | integral_t c_i, tmp; |
23 | 23 | ||
24 | c_i = t_i.get_wcet(); | 24 | c_i = t_i.get_wcet(); |
25 | tmp = t_i.get_period(); | 25 | tmp = t_i.get_period(); |
@@ -38,8 +38,8 @@ void BCLGedf::beta(const Task &t_i, const Task &t_k, mpq_class &beta_i) | |||
38 | 38 | ||
39 | bool BCLGedf::is_task_schedulable(unsigned int k, const TaskSet &ts) | 39 | bool BCLGedf::is_task_schedulable(unsigned int k, const TaskSet &ts) |
40 | { | 40 | { |
41 | mpq_class beta_i, beta_sum = 0; | 41 | fractional_t beta_i, beta_sum = 0; |
42 | mpq_class lambda_term; | 42 | fractional_t lambda_term; |
43 | bool small_beta_exists = false; | 43 | bool small_beta_exists = false; |
44 | 44 | ||
45 | ts[k].get_density(lambda_term); | 45 | ts[k].get_density(lambda_term); |
diff --git a/native/src/edf/bcl_iterative.cpp b/native/src/edf/bcl_iterative.cpp index e70c0c4..b8e58ef 100644 --- a/native/src/edf/bcl_iterative.cpp +++ b/native/src/edf/bcl_iterative.cpp | |||
@@ -11,7 +11,7 @@ using namespace std; | |||
11 | static void interfering_workload(const Task &t_i, | 11 | static void interfering_workload(const Task &t_i, |
12 | const Task &t_k, | 12 | const Task &t_k, |
13 | unsigned long slack, | 13 | unsigned long slack, |
14 | mpz_class &inf) | 14 | integral_t &inf) |
15 | { | 15 | { |
16 | unsigned long njobs = t_k.get_deadline() / t_i.get_period(); | 16 | unsigned long njobs = t_k.get_deadline() / t_i.get_period(); |
17 | 17 | ||
@@ -30,9 +30,9 @@ bool BCLIterativeGedf::slack_update(unsigned int k, | |||
30 | unsigned long *slack, | 30 | unsigned long *slack, |
31 | bool &has_slack) | 31 | bool &has_slack) |
32 | { | 32 | { |
33 | mpz_class other_work = 0; | 33 | integral_t other_work = 0; |
34 | mpz_class inf; | 34 | integral_t inf; |
35 | mpz_class inf_bound = ts[k].get_deadline() - ts[k].get_wcet() + 1; | 35 | integral_t inf_bound = ts[k].get_deadline() - ts[k].get_wcet() + 1; |
36 | 36 | ||
37 | for (unsigned int i = 0; i < ts.get_task_count(); i++) | 37 | for (unsigned int i = 0; i < ts.get_task_count(); i++) |
38 | if (k != i) | 38 | if (k != i) |
diff --git a/native/src/edf/ffdbf.cpp b/native/src/edf/ffdbf.cpp index a28ea38..fa64b96 100644 --- a/native/src/edf/ffdbf.cpp +++ b/native/src/edf/ffdbf.cpp | |||
@@ -13,8 +13,8 @@ | |||
13 | 13 | ||
14 | using namespace std; | 14 | using namespace std; |
15 | 15 | ||
16 | static void get_q_r(const Task &t_i, const mpq_class &time, | 16 | static void get_q_r(const Task &t_i, const fractional_t &time, |
17 | mpz_class &q_i, mpq_class &r_i) | 17 | integral_t &q_i, fractional_t &r_i) |
18 | { | 18 | { |
19 | // compute q_i -- floor(time / period) | 19 | // compute q_i -- floor(time / period) |
20 | // r_i -- time % period | 20 | // r_i -- time % period |
@@ -26,18 +26,18 @@ static void get_q_r(const Task &t_i, const mpq_class &time, | |||
26 | r_i -= q_i * t_i.get_period(); | 26 | r_i -= q_i * t_i.get_period(); |
27 | } | 27 | } |
28 | 28 | ||
29 | static void compute_q_r(const TaskSet &ts, const mpq_class &time, | 29 | static void compute_q_r(const TaskSet &ts, const fractional_t &time, |
30 | mpz_class q[], mpq_class r[]) | 30 | integral_t q[], fractional_t r[]) |
31 | { | 31 | { |
32 | for (unsigned int i = 0; i < ts.get_task_count(); i++) | 32 | for (unsigned int i = 0; i < ts.get_task_count(); i++) |
33 | get_q_r(ts[i], time, q[i], r[i]); | 33 | get_q_r(ts[i], time, q[i], r[i]); |
34 | } | 34 | } |
35 | 35 | ||
36 | static void ffdbf(const Task &t_i, | 36 | static void ffdbf(const Task &t_i, |
37 | const mpq_class &time, const mpq_class &speed, | 37 | const fractional_t &time, const fractional_t &speed, |
38 | const mpz_class &q_i, const mpq_class &r_i, | 38 | const integral_t &q_i, const fractional_t &r_i, |
39 | mpq_class &demand, | 39 | fractional_t &demand, |
40 | mpq_class &tmp) | 40 | fractional_t &tmp) |
41 | { | 41 | { |
42 | /* this is the cost in all three cases */ | 42 | /* this is the cost in all three cases */ |
43 | demand += q_i * t_i.get_wcet(); | 43 | demand += q_i * t_i.get_wcet(); |
@@ -64,9 +64,9 @@ static void ffdbf(const Task &t_i, | |||
64 | } | 64 | } |
65 | 65 | ||
66 | static void ffdbf_ts(const TaskSet &ts, | 66 | static void ffdbf_ts(const TaskSet &ts, |
67 | const mpz_class q[], const mpq_class r[], | 67 | const integral_t q[], const fractional_t r[], |
68 | const mpq_class &time, const mpq_class &speed, | 68 | const fractional_t &time, const fractional_t &speed, |
69 | mpq_class &demand, mpq_class &tmp) | 69 | fractional_t &demand, fractional_t &tmp) |
70 | { | 70 | { |
71 | demand = 0; | 71 | demand = 0; |
72 | for (unsigned int i = 0; i < ts.get_task_count(); i++) | 72 | for (unsigned int i = 0; i < ts.get_task_count(); i++) |
@@ -77,15 +77,15 @@ static void ffdbf_ts(const TaskSet &ts, | |||
77 | class TestPoints | 77 | class TestPoints |
78 | { | 78 | { |
79 | private: | 79 | private: |
80 | mpq_class time; | 80 | fractional_t time; |
81 | mpq_class with_offset; | 81 | fractional_t with_offset; |
82 | unsigned long period; | 82 | unsigned long period; |
83 | bool first_point; | 83 | bool first_point; |
84 | 84 | ||
85 | public: | 85 | public: |
86 | void init(const Task& t_i, | 86 | void init(const Task& t_i, |
87 | const mpq_class& speed, | 87 | const fractional_t& speed, |
88 | const mpq_class& min_time) | 88 | const fractional_t& min_time) |
89 | { | 89 | { |
90 | period = t_i.get_period(); | 90 | period = t_i.get_period(); |
91 | with_offset = t_i.get_wcet() / speed; | 91 | with_offset = t_i.get_wcet() / speed; |
@@ -96,7 +96,7 @@ public: | |||
96 | time = min_time; | 96 | time = min_time; |
97 | time /= period; | 97 | time /= period; |
98 | // round down, i.e., floor() | 98 | // round down, i.e., floor() |
99 | mpq_truncate(time); | 99 | truncate_fraction(time); |
100 | time *= period; | 100 | time *= period; |
101 | time += t_i.get_deadline(); | 101 | time += t_i.get_deadline(); |
102 | 102 | ||
@@ -107,7 +107,7 @@ public: | |||
107 | next(); | 107 | next(); |
108 | } | 108 | } |
109 | 109 | ||
110 | const mpq_class& get_cur() const | 110 | const fractional_t& get_cur() const |
111 | { | 111 | { |
112 | if (first_point) | 112 | if (first_point) |
113 | return with_offset; | 113 | return with_offset; |
@@ -145,7 +145,7 @@ class AllTestPoints | |||
145 | private: | 145 | private: |
146 | TestPoints *pts; | 146 | TestPoints *pts; |
147 | TimeQueue queue; | 147 | TimeQueue queue; |
148 | mpq_class last; | 148 | fractional_t last; |
149 | TaskSet const &ts; | 149 | TaskSet const &ts; |
150 | 150 | ||
151 | public: | 151 | public: |
@@ -155,8 +155,8 @@ public: | |||
155 | pts = new TestPoints[ts.get_task_count()]; | 155 | pts = new TestPoints[ts.get_task_count()]; |
156 | } | 156 | } |
157 | 157 | ||
158 | void init(const mpq_class &speed, | 158 | void init(const fractional_t &speed, |
159 | const mpq_class &min_time) | 159 | const fractional_t &min_time) |
160 | { | 160 | { |
161 | last = -1; | 161 | last = -1; |
162 | // clean out queue | 162 | // clean out queue |
@@ -175,7 +175,7 @@ public: | |||
175 | delete[] pts; | 175 | delete[] pts; |
176 | } | 176 | } |
177 | 177 | ||
178 | void get_next(mpq_class &t) | 178 | void get_next(fractional_t &t) |
179 | { | 179 | { |
180 | TestPoints* pt; | 180 | TestPoints* pt; |
181 | do // avoid duplicates | 181 | do // avoid duplicates |
@@ -191,11 +191,11 @@ public: | |||
191 | }; | 191 | }; |
192 | 192 | ||
193 | bool FFDBFGedf::witness_condition(const TaskSet &ts, | 193 | bool FFDBFGedf::witness_condition(const TaskSet &ts, |
194 | const mpz_class q[], const mpq_class r[], | 194 | const integral_t q[], const fractional_t r[], |
195 | const mpq_class &time, | 195 | const fractional_t &time, |
196 | const mpq_class &speed) | 196 | const fractional_t &speed) |
197 | { | 197 | { |
198 | mpq_class demand, bound; | 198 | fractional_t demand, bound; |
199 | 199 | ||
200 | ffdbf_ts(ts, q, r, time, speed, demand, bound); | 200 | ffdbf_ts(ts, q, r, time, speed, demand, bound); |
201 | 201 | ||
@@ -223,12 +223,12 @@ bool FFDBFGedf::is_schedulable(const TaskSet &ts, | |||
223 | 223 | ||
224 | // allocate helpers | 224 | // allocate helpers |
225 | AllTestPoints testing_set(ts); | 225 | AllTestPoints testing_set(ts); |
226 | mpz_class *q = new mpz_class[ts.get_task_count()]; | 226 | integral_t *q = new integral_t[ts.get_task_count()]; |
227 | mpq_class *r = new mpq_class[ts.get_task_count()]; | 227 | fractional_t *r = new fractional_t[ts.get_task_count()]; |
228 | 228 | ||
229 | mpq_class sigma_bound; | 229 | fractional_t sigma_bound; |
230 | mpq_class time_bound; | 230 | fractional_t time_bound; |
231 | mpq_class tmp(1, epsilon_denom); | 231 | fractional_t tmp(1, epsilon_denom); |
232 | 232 | ||
233 | // compute sigma bound | 233 | // compute sigma bound |
234 | tmp = 1; | 234 | tmp = 1; |
@@ -237,7 +237,7 @@ bool FFDBFGedf::is_schedulable(const TaskSet &ts, | |||
237 | sigma_bound -= m; | 237 | sigma_bound -= m; |
238 | sigma_bound /= - ((int) (m - 1)); // neg. to flip sign | 238 | sigma_bound /= - ((int) (m - 1)); // neg. to flip sign |
239 | sigma_bound -= tmp; // epsilon | 239 | sigma_bound -= tmp; // epsilon |
240 | sigma_bound = min(sigma_bound, mpq_class(1)); | 240 | sigma_bound = min(sigma_bound, fractional_t(1)); |
241 | 241 | ||
242 | // compute time bound | 242 | // compute time bound |
243 | time_bound = 0; | 243 | time_bound = 0; |
@@ -245,8 +245,8 @@ bool FFDBFGedf::is_schedulable(const TaskSet &ts, | |||
245 | time_bound += ts[i].get_wcet(); | 245 | time_bound += ts[i].get_wcet(); |
246 | time_bound /= tmp; // epsilon | 246 | time_bound /= tmp; // epsilon |
247 | 247 | ||
248 | mpq_class t_cur; | 248 | fractional_t t_cur; |
249 | mpq_class sigma_cur, sigma_nxt; | 249 | fractional_t sigma_cur, sigma_nxt; |
250 | bool schedulable; | 250 | bool schedulable; |
251 | 251 | ||
252 | t_cur = 0; | 252 | t_cur = 0; |
@@ -258,7 +258,7 @@ bool FFDBFGedf::is_schedulable(const TaskSet &ts, | |||
258 | 258 | ||
259 | // setup brute force sigma value range | 259 | // setup brute force sigma value range |
260 | sigma_nxt = sigma_cur / sigma_step; | 260 | sigma_nxt = sigma_cur / sigma_step; |
261 | mpq_truncate(sigma_nxt); | 261 | truncate_fraction(sigma_nxt); |
262 | sigma_nxt += 1; | 262 | sigma_nxt += 1; |
263 | sigma_nxt *= sigma_step; | 263 | sigma_nxt *= sigma_step; |
264 | 264 | ||
diff --git a/native/src/edf/gedf.cpp b/native/src/edf/gedf.cpp index 35f1847..e2a6bec 100644 --- a/native/src/edf/gedf.cpp +++ b/native/src/edf/gedf.cpp | |||
@@ -26,7 +26,7 @@ bool GlobalEDF::is_schedulable(const TaskSet &ts, | |||
26 | // density bound on a uniprocessor. | 26 | // density bound on a uniprocessor. |
27 | if (m == 1) | 27 | if (m == 1) |
28 | { | 28 | { |
29 | mpq_class density; | 29 | fractional_t density; |
30 | ts.get_density(density); | 30 | ts.get_density(density); |
31 | if (density <= 1) | 31 | if (density <= 1) |
32 | return true; | 32 | return true; |
diff --git a/native/src/edf/gfb.cpp b/native/src/edf/gfb.cpp index 0aa90b8..822b97b 100644 --- a/native/src/edf/gfb.cpp +++ b/native/src/edf/gfb.cpp | |||
@@ -13,7 +13,7 @@ bool GFBGedf::is_schedulable(const TaskSet &ts, bool check_preconditions) | |||
13 | return false; | 13 | return false; |
14 | } | 14 | } |
15 | 15 | ||
16 | mpq_class total_density, max_density, bound; | 16 | fractional_t total_density, max_density, bound; |
17 | 17 | ||
18 | ts.get_density(total_density); | 18 | ts.get_density(total_density); |
19 | ts.get_max_density(max_density); | 19 | ts.get_max_density(max_density); |
diff --git a/native/src/edf/load.cpp b/native/src/edf/load.cpp index 38d3c55..db44d20 100644 --- a/native/src/edf/load.cpp +++ b/native/src/edf/load.cpp | |||
@@ -22,8 +22,8 @@ bool LoadGedf::is_schedulable(const TaskSet &ts, bool check_preconditions) | |||
22 | return false; | 22 | return false; |
23 | } | 23 | } |
24 | 24 | ||
25 | mpq_class load, max_density, mu, bound, cond1, cond2; | 25 | fractional_t load, max_density, mu, bound, cond1, cond2; |
26 | mpz_class mu_ceil; | 26 | integral_t mu_ceil; |
27 | 27 | ||
28 | // get the load of the task set | 28 | // get the load of the task set |
29 | ts.approx_load(load, epsilon); | 29 | ts.approx_load(load, epsilon); |
diff --git a/native/src/edf/rta.cpp b/native/src/edf/rta.cpp index 68eafa6..4114467 100644 --- a/native/src/edf/rta.cpp +++ b/native/src/edf/rta.cpp | |||
@@ -15,8 +15,8 @@ using namespace std; | |||
15 | static void rta_interfering_workload(const Task &t_i, | 15 | static void rta_interfering_workload(const Task &t_i, |
16 | unsigned long response_time, | 16 | unsigned long response_time, |
17 | unsigned long slack_i, | 17 | unsigned long slack_i, |
18 | mpz_class &inf, | 18 | integral_t &inf, |
19 | mpz_class &interval) | 19 | integral_t &interval) |
20 | { | 20 | { |
21 | interval = response_time; | 21 | interval = response_time; |
22 | interval += t_i.get_deadline() - t_i.get_wcet(); | 22 | interval += t_i.get_deadline() - t_i.get_wcet(); |
@@ -36,7 +36,7 @@ static void rta_interfering_workload(const Task &t_i, | |||
36 | static void edf_interfering_workload(const Task &t_i, | 36 | static void edf_interfering_workload(const Task &t_i, |
37 | const Task &t_k, | 37 | const Task &t_k, |
38 | unsigned long slack_i, | 38 | unsigned long slack_i, |
39 | mpz_class &inf) | 39 | integral_t &inf) |
40 | { | 40 | { |
41 | /* implicit floor in integer division */ | 41 | /* implicit floor in integer division */ |
42 | unsigned long njobs = t_k.get_deadline() / t_i.get_period(); | 42 | unsigned long njobs = t_k.get_deadline() / t_i.get_period(); |
@@ -56,11 +56,11 @@ bool RTAGedf::response_estimate(unsigned int k, | |||
56 | unsigned long response, | 56 | unsigned long response, |
57 | unsigned long &new_response) | 57 | unsigned long &new_response) |
58 | { | 58 | { |
59 | mpz_class other_work = 0; | 59 | integral_t other_work = 0; |
60 | mpz_class inf_edf; | 60 | integral_t inf_edf; |
61 | mpz_class inf_rta; | 61 | integral_t inf_rta; |
62 | mpz_class inf_bound = response - ts[k].get_wcet() + 1; | 62 | integral_t inf_bound = response - ts[k].get_wcet() + 1; |
63 | mpz_class tmp; | 63 | integral_t tmp; |
64 | 64 | ||
65 | for (unsigned int i = 0; i < ts.get_task_count(); i++) | 65 | for (unsigned int i = 0; i < ts.get_task_count(); i++) |
66 | if (k != i) | 66 | if (k != i) |