本文整理汇总了C++中TaskSet类的典型用法代码示例。如果您正苦于以下问题:C++ TaskSet类的具体用法?C++ TaskSet怎么用?C++ TaskSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TaskSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xmain
int xmain(int argc, char** argv)
{
DebugGlobalScheduler<EarliestDeadlineFirst> theSim(2);
TaskSet ts = TaskSet();
/* ts[0].init(10, 100);
ts[1].init(3, 9);
ts[2].init(11, 33);
ts[3].init(11, 17);
ts[4].init(2, 5);
*/
ts.add_task(20, 30);
ts.add_task(20, 30);
ts.add_task(20, 30);
PeriodicJobSequence* gen[NUM_TASKS];
for (int i = 0; i < NUM_TASKS; i++) {
gen[i] = new PeriodicJobSequence(ts[i]);
gen[i]->set_simulation(&theSim);
theSim.add_release(gen[i]);
}
theSim.simulate_until(1000);
return 0;
}
示例2: is_task_schedulable
bool BaruahGedf::is_task_schedulable(unsigned int k,
const TaskSet &ts,
const integral_t &ilen,
integral_t &i1,
integral_t &sum,
integral_t *idiff,
integral_t **ptr)
{
integral_t bound;
sum = 0;
for (unsigned int i = 0; i < ts.get_task_count(); i++)
{
interval1(i, k, ts, ilen, i1);
interval2(i, k, ts, ilen, idiff[i]);
sum += i1;
idiff[i] -= i1;
}
/* sort pointers to idiff to find largest idiff values */
sort(ptr, ptr + ts.get_task_count(), MPZComparator());
for (unsigned int i = 0; i < m - 1 && i < ts.get_task_count(); i++)
sum += *ptr[i];
bound = ilen + ts[k].get_deadline() - ts[k].get_wcet();
bound *= m;
return sum <= bound;
}
示例3: newVisited
void AffinityTask::combinePossibleTaskSet_recursive(const std::unordered_map<CPUID, std::list<TaskSet>>& possibleReplacement, const std::unordered_map<CPUID, CPUID>& nextCPU, const CPUID& currentCPU, const std::list<TaskSet>& visited, std::list<TaskSet>& saveAt)
{
auto currentList = possibleReplacement.find(currentCPU);
auto nextCPUIter = nextCPU.find(currentCPU);
if(nextCPUIter == nextCPU.end())
{
//time to print
for(auto currentItem : currentList->second)
{
TaskSet returnSet;
for(auto curStack : visited)
{
for(auto task : curStack)
returnSet.insert(task);
}
for(auto task : currentItem)
returnSet.insert(task);
saveAt.push_back(returnSet);
}
}
else
{
auto nextCPUID = nextCPUIter->second;
for(auto currentItem : currentList->second)
{
std::list<TaskSet> newVisited(visited);
newVisited.push_back(currentItem);
combinePossibleTaskSet_recursive(
possibleReplacement, nextCPU, nextCPUID, newVisited, saveAt);
}
}
}
示例4: affinityCopy
std::list<std::list<GraphNode>> AffinityTask::allPath(const TaskSet& taskSet, const GraphNode& start, const GraphNode& target, const Affinity& excludeID, const TaskSet& excludeTask)
{
std::list<std::list<GraphNode>> returnValue;
//prepare link map
std::unordered_map<CPUID, TaskSet> cpuToTaskList;
std::unordered_map<AffinityTask*, Affinity> taskToCPUList;
for(auto task : taskSet)
{
if(excludeTask.find(task) != excludeTask.end())
continue;
Affinity affinityCopy(task->affinity);
for(auto cpu : excludeID)
affinityCopy.erase(cpu);
taskToCPUList.insert(std::pair<AffinityTask*, Affinity>(task, affinityCopy));
for(CPUID cpu : affinityCopy)
{
if(cpuToTaskList.find(cpu) == cpuToTaskList.end())
cpuToTaskList.insert(std::pair<CPUID, TaskSet>(cpu, TaskSet()));
cpuToTaskList.find(cpu)->second.insert(task);
}
}
DFS(returnValue, cpuToTaskList, taskToCPUList, start, target, std::list<GraphNode>());
return returnValue;
}
示例5: test_la
void test_la()
{
TaskSet ts = TaskSet();
ts.add_task(40, 100, 0, 0, 10, 0);
ts.add_task(42, 100, 0, 0, 20, 0);
ts.add_task( 2, 100, 50, 0, 5, 0);
BakerGedf t = BakerGedf(2);
cout << "Baker schedulable? : " << t.is_schedulable(ts) << endl;
GFBGedf gfb = GFBGedf(2);
cout << "GFB schedulable? : " << gfb.is_schedulable(ts) << endl;
cout << "BCL schedulable? : " << BCLGedf(2).is_schedulable(ts) << endl;
cout << "Baruah schedulable? : " << BaruahGedf(2).is_schedulable(ts)
<< endl;
cout << "BCL Iter. sched.? : " << BCLIterativeGedf(2).is_schedulable(ts)
<< endl;
cout << "LA schedulable? : " << LAGedf(2).is_schedulable(ts)
<< endl;
cout << "G-EDF schedulable? : " << GlobalEDF(2).is_schedulable(ts) << endl;
}
示例6: main
int main(int argc, char **argv) {
TaskSet *taskSet;
Overhead *overhead;
CacheTop *cacheTop;
ClusteredTest clusteredTest;
SchedTestParam *schedTestParam;
CmdlParser cmdlParser(argc, argv);
overhead = Overhead::getInstance();
taskSet = new TaskSet();
cacheTop = new CacheTop();
schedTestParam = SchedTestParam::getInstance();
clusteredTest.setTaskSet(taskSet);
clusteredTest.setOverhead(overhead);
clusteredTest.setCacheTop(cacheTop);
schedTestParam->initSchedTestParam();
schedTestParam->setParameters(cmdlParser);
schedTestParam->getSchedTestParam();
overhead->updateAllOverheads(schedTestParam);
taskSet->updateAllTasks(schedTestParam);
cacheTop->updateCacheTop(schedTestParam);
taskSet->setParameters(cmdlParser);
overhead->setParameters(cmdlParser);
clusteredTest.setMHzCpuClock(schedTestParam->getMHzCpuClock());
clusteredTest.makeSchedTest();
return 0;
}
示例7: init
void init(const TaskSet &ts, int k, integral_t* bound)
{
last = -1;
dbf = new DBFPointsOfChange[ts.get_task_count()];
for (unsigned int i = 0; i < ts.get_task_count(); i++)
{
dbf[i].init(ts[i], ts[k]);
queue.push(dbf + i);
}
upper_bound = bound;
}
示例8: terminateAllTasks
int TaskScheduler::terminateAllTasks()
{
TaskSet copy = runningThreads;
TaskSet::iterator it;
PRINTF(1,"Terminating all tasks\n");
for (it = copy.begin();it!=copy.end();it++) {
// delete pointer and empty the list of running tasks
terminateTask(it->second);
}
runningThreads.clear();
mainThread.reset();
return 0;
}
示例9: response_estimate
bool RTAGedf::response_estimate(unsigned int k,
const TaskSet &ts,
unsigned long const *slack,
unsigned long response,
unsigned long &new_response)
{
integral_t other_work = 0;
integral_t inf_edf;
integral_t inf_rta;
integral_t inf_bound = response - ts[k].get_wcet() + 1;
integral_t tmp;
for (unsigned int i = 0; i < ts.get_task_count(); i++)
if (k != i)
{
edf_interfering_workload(ts[i], ts[k], slack[i], inf_edf);
rta_interfering_workload(ts[i], response, slack[i], inf_rta, tmp);
other_work += min(min(inf_edf, inf_rta), inf_bound);
}
/* implicit floor */
other_work /= m;
other_work += ts[k].get_wcet();
if (other_work.fits_ulong_p())
{
new_response = other_work.get_ui();
return true;
}
else
{
/* overflowed => reponse time > deadline */
return false;
}
}
示例10: is_task_schedulable
bool BCLGedf::is_task_schedulable(unsigned int k, const TaskSet &ts)
{
fractional_t beta_i, beta_sum = 0;
fractional_t lambda_term;
bool small_beta_exists = false;
ts[k].get_density(lambda_term);
lambda_term *= -1;
lambda_term += 1;
for (unsigned int i = 0; i < ts.get_task_count(); i++)
{
if (i != k) {
beta(ts[i], ts[k], beta_i);
beta_sum += min(beta_i, lambda_term);
small_beta_exists = small_beta_exists ||
(0 < beta_i && beta_i <= lambda_term);
}
}
lambda_term *= m;
return beta_sum < lambda_term ||
(small_beta_exists && beta_sum == lambda_term);
}
示例11: switch
void
TaskRunner::getReadyTasks(const InitializerTask::SP task, TaskList &readyTasks, TaskSet &checked)
{
if (task->getState() != State::BLOCKED) {
return; // task running or done, all dependencies done
}
if (!checked.insert(task.get()).second) {
return; // task already checked from another depender
}
const TaskList &deps = task->getDependencies();
bool ready = true;
for (const auto &dep : deps) {
switch (dep->getState()) {
case State::RUNNING:
ready = false;
break;
case State::DONE:
break;
case State::BLOCKED:
ready = false;
getReadyTasks(dep, readyTasks, checked);
}
}
if (ready) {
readyTasks.push_back(task);
}
}
示例12: is_schedulable
bool BCLGedf::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()))
return false;
}
for (unsigned int k = 0; k < ts.get_task_count(); k++)
if (!is_task_schedulable(k, ts))
return false;
return true;
}
示例13: ffdbf_ts
static void ffdbf_ts(const TaskSet &ts,
const integral_t q[], const fractional_t r[],
const fractional_t &time, const fractional_t &speed,
fractional_t &demand, fractional_t &tmp)
{
demand = 0;
for (unsigned int i = 0; i < ts.get_task_count(); i++)
ffdbf(ts[i], time, speed, q[i], r[i], demand, tmp);
}
示例14: xxxxmain
int xxxxmain(int argc, char** argv)
{
GlobalScheduler<EarliestDeadlineFirst> theSim(24);
TaskSet* ts = init_baruah();
PeriodicJobSequence** gen;
gen = new PeriodicJobSequence*[ts->get_task_count()];
for (unsigned int i = 0; i < ts->get_task_count(); i++) {
gen[i] = new PeriodicJobSequence((*ts)[i]);
gen[i]->set_simulation(&theSim);
theSim.add_release(gen[i]);
}
theSim.simulate_until(1000 * 1000 * 1000); // 1000 seconds
return 0;
}
示例15: main
int main(int argc,char** argv)
{
if(4 != argc)
{
cout<<"Usage: ./RMtest [positive processor number] [positive task number] [positive experiment times]"<<endl;
return 0;
}
uint processor_num = atoi(argv[1]);
uint task_num = atoi(argv[2]);
uint exp_t = atoi(argv[3]);
if(0 >= task_num || 0 >= exp_t || 0 >= processor_num)
{
cout<<"Usage: ./RMtest [positive processor number] [positive task number] [positive experiment times]"<<endl;
return 0;
}
//ProcessorSet processorset = ProcessorSet(processor_num);
RMS rms = RMS(processor_num);//uniprocessor
uint j = 0;
uint success = 0;
while(j++ < exp_t)
{
TaskSet taskset = TaskSet();
for(int i = 1; i <= task_num; i++)
{
int wcet = int(exponential_gen(5)*100);
if(0 == wcet)
wcet++;
int period = 500;
taskset.add_task(wcet,period);
}
if(rms.is_RM_schedulable(taskset))
success++;
}
fraction_t rate(success, exp_t);
cout << "RM schedulability rate:" << rate << endl;
}