本文整理汇总了C++中TaskSet::get_max_density方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskSet::get_max_density方法的具体用法?C++ TaskSet::get_max_density怎么用?C++ TaskSet::get_max_density使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskSet
的用法示例。
在下文中一共展示了TaskSet::get_max_density方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_schedulable
bool GFBGedf::is_schedulable(const TaskSet &ts, bool check_preconditions)
{
if (check_preconditions)
{
if (!(ts.has_only_feasible_tasks()
&& ts.is_not_overutilized(m)
&& ts.has_only_constrained_deadlines()
&& ts.has_no_self_suspending_tasks()))
return false;
}
fractional_t total_density, max_density, bound;
ts.get_density(total_density);
ts.get_max_density(max_density);
bound = m - (m - 1) * max_density;
return total_density <= bound;
}
示例2: is_schedulable
bool FFDBFGedf::is_schedulable(const TaskSet &ts,
bool check_preconditions)
{
if (m < 2)
return false;
if (check_preconditions)
{
if (!(ts.has_only_feasible_tasks() &&
ts.is_not_overutilized(m) &&
ts.has_only_constrained_deadlines() &&
ts.has_no_self_suspending_tasks()))
return false;
}
// allocate helpers
AllTestPoints testing_set(ts);
integral_t *q = new integral_t[ts.get_task_count()];
fractional_t *r = new fractional_t[ts.get_task_count()];
fractional_t sigma_bound;
fractional_t time_bound;
fractional_t tmp(1, epsilon_denom);
// compute sigma bound
tmp = 1;
tmp /= epsilon_denom;
ts.get_utilization(sigma_bound);
sigma_bound -= m;
sigma_bound /= - ((int) (m - 1)); // neg. to flip sign
sigma_bound -= tmp; // epsilon
sigma_bound = min(sigma_bound, fractional_t(1));
// compute time bound
time_bound = 0;
for (unsigned int i = 0; i < ts.get_task_count(); i++)
time_bound += ts[i].get_wcet();
time_bound /= tmp; // epsilon
fractional_t t_cur;
fractional_t sigma_cur, sigma_nxt;
bool schedulable;
t_cur = 0;
schedulable = false;
// Start with minimum possible sigma value, then try
// multiples of sigma_step.
ts.get_max_density(sigma_cur);
// setup brute force sigma value range
sigma_nxt = sigma_cur / sigma_step;
truncate_fraction(sigma_nxt);
sigma_nxt += 1;
sigma_nxt *= sigma_step;
while (!schedulable &&
sigma_cur <= sigma_bound &&
t_cur <= time_bound)
{
testing_set.init(sigma_cur, t_cur);
do {
testing_set.get_next(t_cur);
if (t_cur <= time_bound)
{
compute_q_r(ts, t_cur, q, r);
schedulable = witness_condition(ts, q, r, t_cur, sigma_cur);
}
else
// exceeded testing interval
schedulable = true;
} while (t_cur <= time_bound && schedulable);
if (!schedulable && t_cur <= time_bound)
{
// find next sigma variable
do
{
sigma_cur = sigma_nxt;
sigma_nxt += sigma_step;
} while (sigma_cur <= sigma_bound &&
!witness_condition(ts, q, r, t_cur, sigma_cur));
}
}
delete [] q;
delete [] r;
return schedulable;
}