本文整理汇总了C++中TaskSet::find方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskSet::find方法的具体用法?C++ TaskSet::find怎么用?C++ TaskSet::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskSet
的用法示例。
在下文中一共展示了TaskSet::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: staticStrongAnalysis
bool AffinityTask::staticStrongAnalysis(const TaskSet& taskSet, Time overhead)
{
AffinityTask::Compare compare;
std::unordered_map<AffinityTask*, Time> responseTime;
Affinity allCPU;
for(AffinityTask* task : taskSet)
{
responseTime.insert(std::pair<AffinityTask*, Time>(task, task->worstExecution));
for(auto cpu : task->affinity)
allCPU.insert(cpu);
}
while(true)
{
bool changed = false;
bool overflow = false;
std::unordered_map<AffinityTask*, Time> newResponseTime;
for(auto current : responseTime)
{
AffinityTask* curTask = current.first;
std::set<Affinity> powerSet = AffinityTask::powerSet(curTask->affinity);
Time currentResponse = responseTime.find(curTask)->second;
TaskSet ignoreTask;
ignoreTask.insert(curTask);
Time min_sumInterfere = std::numeric_limits<Time>::max();
for(Affinity s : powerSet)
{
assert(s.size() != 0);
Size s_Size = s.size();
//Time sumInterference = 0;
std::unordered_map<CPUID, std::list<TaskSet>> possibleReplacement;
for(auto cpu : s)
{
possibleReplacement.insert(std::pair<CPUID, std::list<TaskSet>>
(cpu, std::list<TaskSet>()));
}
for(CPUID selectedCPU : s)
{
Affinity ignoreCPU(s);
ignoreCPU.erase(selectedCPU);
for(auto alternative : allCPU)
{
if(ignoreCPU.find(alternative) != ignoreCPU.end())
continue;
auto allPaths = allPath(taskSet, selectedCPU, alternative, ignoreCPU, ignoreTask);
for(auto path : allPaths)
{
if(path.size() > 0)
{
TaskSet ignoredTask;
Affinity moreCheck;
for(auto item : path)
{
if(item.isTask())
ignoredTask.insert(item.getTask());
else
moreCheck.insert(item.getCPUID());
}
TaskSet highTaskSet;
for(AffinityTask* highPriorityTask : taskSet)
{
//if(compare(curTask, highPriorityTask))
// continue;
if(highPriorityTask == curTask)
continue;
if(ignoredTask.find(highPriorityTask) != ignoredTask.end())
continue;
bool intersect = false;
for(auto cpu : highPriorityTask->affinity)
{
if(moreCheck.find(cpu) != moreCheck.end())
{
intersect = true;
break;
}
}
if(!intersect)
continue;
highTaskSet.insert(highPriorityTask);
}
possibleReplacement.find(selectedCPU)->second.push_back(highTaskSet);
}
}
}
}
for(auto possibleSet : combinePossibleTaskSet(possibleReplacement))
{
Time sumInterference = 0;
/*
if(possibleSet.size() ==0)
continue;
assert(possibleSet.size() > 0);
//.........这里部分代码省略.........