• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TaskSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TaskSet的典型用法代码示例。如果您正苦于以下问题:C++ TaskSet类的具体用法?C++ TaskSet怎么用?C++ TaskSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TaskSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:binarybison,项目名称:schedcat,代码行数:28,代码来源:testmain.cpp


示例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;
}
开发者ID:jerickson314,项目名称:schedcat,代码行数:29,代码来源:baruah.cpp


示例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);
		}
	}
}
开发者ID:HyeongiKim,项目名称:Introduction_to_Network_KENSv3,代码行数:34,代码来源:E_Affinity.cpp


示例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;
}
开发者ID:HyeongiKim,项目名称:Introduction_to_Network_KENSv3,代码行数:27,代码来源:E_Affinity.cpp


示例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;
}
开发者ID:binarybison,项目名称:schedcat,代码行数:26,代码来源:testmain.cpp


示例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;
}
开发者ID:brandenburg,项目名称:rt_schedtest,代码行数:33,代码来源:rt_clustered-test.cpp


示例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;
 }
开发者ID:jerickson314,项目名称:schedcat,代码行数:11,代码来源:baruah.cpp


示例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;
}
开发者ID:BenoitLescot,项目名称:ros_task_manager,代码行数:13,代码来源:TaskScheduler.cpp


示例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;
    }
}
开发者ID:ChenZewei,项目名称:schedcat,代码行数:33,代码来源:rta.cpp


示例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);
}
开发者ID:GElliott,项目名称:schedcat,代码行数:25,代码来源:bcl.cpp


示例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);
    }
}
开发者ID:songhtdo,项目名称:vespa,代码行数:27,代码来源:task_runner.cpp


示例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;
}
开发者ID:GElliott,项目名称:schedcat,代码行数:17,代码来源:bcl.cpp


示例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);
}
开发者ID:ChenZewei,项目名称:schedcat,代码行数:9,代码来源:ffdbf.cpp


示例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;
}
开发者ID:binarybison,项目名称:schedcat,代码行数:19,代码来源:testmain.cpp


示例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;

}
开发者ID:maolyang,项目名称:SchedulingAnalysis,代码行数:42,代码来源:scheduling_test.cpp


示例16: main

int main(int argc, char** argv)
{

	char tempFile [] = "tempFile.txt";
	TaskSetInputParser parser;

	stringstream csvFileName;
	csvFileName << "datapoints_number_tasks_" << NUMBER_OF_TASKS;

	ofstream outputFile;
	outputFile.open((char*)csvFileName.str().c_str());

	Simulator s;

	for (double currentIncrement = 0.1; currentIncrement<=0.9; currentIncrement+=0.1) {
		outputFile << currentIncrement << ",";
		TaskGenerator::generateTasksAndWriteToFile(tempFile, currentIncrement, NUMBER_OF_TASKS, NUMBER_OF_TASKS_SETS);

		parser.parseInputFile(tempFile);

		int totalTaskSets = parser.getTaskSetSize();

		while(!parser.isEmpty()) {
			TaskSet taskSet = parser.getNext();

			cout << "<Analyzing task set> \n";
			taskSet.printTaskSet();
			cout << "\n";

			taskSet.sortTaskSetByUtilization();
			outputFile << s.MUF(taskSet) << ",";

			taskSet.sortTaskSetByPeriod();
			outputFile << s.RM(taskSet) << ",";

			taskSet.sortTaskSetByWCET();
			outputFile << s.SJF(taskSet) << "\n";;
		}

	}
	return 0;
}
开发者ID:hamo26,项目名称:SchdedulingAndFunStuff,代码行数:42,代码来源:494ComparingSchedulingPolicies.cpp


示例17: is_schedulable

bool RTAGedf::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_only_feasible_tasks()))
            return false;
        if (ts.get_task_count() == 0)
            return true;
    }

    unsigned long* slack = new unsigned long[ts.get_task_count()];

    for (unsigned int i = 0; i < ts.get_task_count(); i++)
        slack[i] = 0;

    unsigned long round = 0;
    bool schedulable = false;
    bool updated     = true;

    while (updated && !schedulable && (max_rounds == 0 || round < max_rounds))
    {
        round++;
        schedulable = true;
        updated     = false;
        for (unsigned int k = 0; k < ts.get_task_count(); k++)
        {
            unsigned long response, new_slack;
            if (rta_fixpoint(k, ts, slack, response))
            {
                new_slack = ts[k].get_deadline() - response;
                if (new_slack != slack[k])
                {
                    slack[k] = new_slack;
                    updated = true;
                }
            }
            else
            {
                schedulable = false;
            }
        }
    }

    return schedulable;
}
开发者ID:ChenZewei,项目名称:schedcat,代码行数:48,代码来源:rta.cpp


示例18: DBGOUT

void SchedViz::Visit_Node( const Semantics::Node &node ) {
	std::string nodeName = node.name();
	DBGOUT("Node: " << nodeName << std::endl)

	// Add a superblock to the viz
	TVSuperblock* superblock = this->_traceViz->AddSuperblock( nodeName, this->_hyperperiodSec );

	// Now iterate through all of the task children
	TaskSet taskSet = node.executes();
	TaskSet::iterator taskIter = taskSet.begin();
	for ( ; taskIter != taskSet.end(); taskIter++ ) {
		// Visit the task
		this->Visit_Task( *taskIter, superblock );
	}

	// Now interate through all of the device children
	DeviceSet deviceSet = node.integrates();
	DeviceSet::iterator deviceIter = deviceSet.begin();
	for ( ; deviceIter != deviceSet.end(); deviceIter++ ) {
		// Visit the device
		this->Visit_Device( *deviceIter, superblock );
	}
}
开发者ID:pombreda,项目名称:metamorphosys-desktop,代码行数:23,代码来源:schedViz.cpp


示例19: slack_update

bool BCLIterativeGedf::slack_update(unsigned int k,
                                    const TaskSet &ts,
                                    unsigned long *slack,
                                    bool &has_slack)
{
    integral_t other_work = 0;
    integral_t inf;
    integral_t inf_bound = ts[k].get_deadline() - ts[k].get_wcet() + 1;

    for (unsigned int i = 0; i < ts.get_task_count(); i++)
        if (k != i)
        {
            interfering_workload(ts[i], ts[k], slack[i], inf);
            other_work += min(inf, inf_bound);
        }
    other_work /= m;
    unsigned long tmp = ts[k].get_wcet() + other_work.get_ui();

    assert( other_work.fits_ulong_p() );
    assert (tmp > other_work.get_ui() );

    has_slack = tmp <= ts[k].get_deadline();
    if (!has_slack)
        // negative slack => no update, always assume zero
        return false;
    else
    {
        tmp = ts[k].get_deadline() - tmp;
        if (tmp > slack[k])
        {
            // better slack => update
            slack[k] = tmp;
            return true;
        }
        else
            // no improvement
            return false;
    }
}
开发者ID:GElliott,项目名称:schedcat,代码行数:39,代码来源:bcl_iterative.cpp


示例20: is_schedulable

bool BCLIterativeGedf::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;
        if (ts.get_task_count() == 0)
            return true;
    }

    unsigned long* slack = new unsigned long[ts.get_task_count()];

    for (unsigned int i = 0; i < ts.get_task_count(); i++)
        slack[i] = 0;

    unsigned long round = 0;
    bool schedulable = false;
    bool updated     = true;

    while (updated && !schedulable && (max_rounds == 0 || round < max_rounds))
    {
        round++;
        schedulable = true;
        updated     = false;
        for (unsigned int k = 0; k < ts.get_task_count(); k++)
        {
            bool ok;
            if (slack_update(k, ts, slack, ok))
                updated = true;
            schedulable = schedulable && ok;
        }
    }

    return schedulable;
}
开发者ID:GElliott,项目名称:schedcat,代码行数:38,代码来源:bcl_iterative.cpp



注:本文中的TaskSet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TaskStatus类代码示例发布时间:2022-05-31
下一篇:
C++ TaskScheduler类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap