示例#1
0
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
0
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;
}
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;

}