本文整理汇总了C++中Cpu::getConstraint方法的典型用法代码示例。如果您正苦于以下问题:C++ Cpu::getConstraint方法的具体用法?C++ Cpu::getConstraint怎么用?C++ Cpu::getConstraint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cpu
的用法示例。
在下文中一共展示了Cpu::getConstraint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustWeightOfDummyCpuActions
double VMHL13Model::next_occuring_event(double now)
{
/* TODO: update action's cost with the total cost of processes on the VM. */
/* 1. Now we know how many resource should be assigned to each virtual
* machine. We update constraints of the virtual machine layer.
*
* If we have two virtual machine (VM1 and VM2) on a physical machine (PM1).
* X1 + X2 = C (Equation 1)
* where
* the resource share of VM1: X1
* the resource share of VM2: X2
* the capacity of PM1: C
*
* Then, if we have two process (P1 and P2) on VM1.
* X1_1 + X1_2 = X1 (Equation 2)
* where
* the resource share of P1: X1_1
* the resource share of P2: X1_2
* the capacity of VM1: X1
*
* Equation 1 was solved in the physical machine layer.
* Equation 2 is solved in the virtual machine layer (here).
* X1 must be passed to the virtual machine laye as a constraint value.
**/
/* iterate for all virtual machines */
for (VMModel::vm_list_t::iterator iter = VMModel::ws_vms.begin(); iter != VMModel::ws_vms.end(); ++iter) {
VirtualMachine *ws_vm = &*iter;
Cpu *cpu = ws_vm->p_cpu;
xbt_assert(cpu, "cpu-less host");
double solved_value = ws_vm->action_->getVariable()->value;
XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getName(), ws_vm->getPm()->name().c_str());
// TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution.
// cpu_cas01->constraint->bound = solved_value;
xbt_assert(cpu->getModel() == surf_cpu_model_vm);
lmm_system_t vcpu_system = cpu->getModel()->getMaxminSystem();
lmm_update_constraint_bound(vcpu_system, cpu->getConstraint(), virt_overhead * solved_value);
}
/* 2. Calculate resource share at the virtual machine layer. */
adjustWeightOfDummyCpuActions();
/* 3. Ready. Get the next occuring event */
return surf_cpu_model_vm->next_occuring_event(now);
}