diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-11-27 06:30:52 -0500 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-11-27 06:30:52 -0500 |
| commit | a9d8499bbdfc69b24b65d38c370616a4f79e6b1c (patch) | |
| tree | b4a3fb904d3d50391671d158bf5e40ef69d84c6c /native | |
| parent | 01251da14f0d3fb2bf4ed2299a70998ff3aa5a1f (diff) | |
Add bound_demand() to TaskSet
This corresponds to h(t) in Zhang and Burns (2009)'s QPA paper.
Diffstat (limited to 'native')
| -rw-r--r-- | native/include/tasks.h | 1 | ||||
| -rw-r--r-- | native/src/tasks.cpp | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/native/include/tasks.h b/native/include/tasks.h index dbba8d1..0aafa98 100644 --- a/native/include/tasks.h +++ b/native/include/tasks.h | |||
| @@ -176,6 +176,7 @@ class TaskSet | |||
| 176 | void get_density(fractional_t &density) const; | 176 | void get_density(fractional_t &density) const; |
| 177 | void get_max_density(fractional_t &max_density) const; | 177 | void get_max_density(fractional_t &max_density) const; |
| 178 | 178 | ||
| 179 | void bound_demand(const integral_t &time, integral_t &demand) const; | ||
| 179 | void approx_load(fractional_t &load, const fractional_t &epsilon = 0.1) const; | 180 | void approx_load(fractional_t &load, const fractional_t &epsilon = 0.1) const; |
| 180 | 181 | ||
| 181 | /* wrapper for Python access */ | 182 | /* wrapper for Python access */ |
diff --git a/native/src/tasks.cpp b/native/src/tasks.cpp index 1d784bf..0d0624c 100644 --- a/native/src/tasks.cpp +++ b/native/src/tasks.cpp | |||
| @@ -152,6 +152,17 @@ unsigned long TaskSet::k_for_epsilon(unsigned int idx, | |||
| 152 | return (unsigned long) ceil(std::max(0.0, bound.get_d())); | 152 | return (unsigned long) ceil(std::max(0.0, bound.get_d())); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | void TaskSet::bound_demand(const integral_t &time, integral_t &demand) const | ||
| 156 | { | ||
| 157 | integral_t task_demand; | ||
| 158 | demand = 0; | ||
| 159 | for (unsigned int i = 0; i < tasks.size(); i++) | ||
| 160 | { | ||
| 161 | tasks[i].bound_demand(time, task_demand); | ||
| 162 | demand += task_demand; | ||
| 163 | } | ||
| 164 | } | ||
| 165 | |||
| 155 | void TaskSet::approx_load(fractional_t &load, const fractional_t &epsilon) const | 166 | void TaskSet::approx_load(fractional_t &load, const fractional_t &epsilon) const |
| 156 | { | 167 | { |
| 157 | fractional_t density; | 168 | fractional_t density; |
