本文整理汇总了C++中TaskSet::add_task方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskSet::add_task方法的具体用法?C++ TaskSet::add_task怎么用?C++ TaskSet::add_task使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskSet
的用法示例。
在下文中一共展示了TaskSet::add_task方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}