class trace;
class future_evt_set;
}
+namespace vm {
+class VMModel;
+class VirtualMachineImpl;
+} // namespace vm
} // namespace simgrid
typedef simgrid::s4u::Actor s4u_Actor;
* and actors can retrieve the host on which they run using simgrid::s4u::Host::current().
*/
class XBT_PUBLIC Host : public simgrid::xbt::Extendable<Host> {
+ friend simgrid::vm::VMModel; // Use the pimpl_cpu to compute the VM sharing
+ friend simgrid::vm::VirtualMachineImpl; // creates the the pimpl_cpu
public:
explicit Host(const char* name);
std::unordered_map<std::string, Storage*>* mounts_ = nullptr; // caching
public:
- // TODO, this could be a unique_ptr
- surf::HostImpl* pimpl_ = nullptr;
/** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
surf::Cpu* pimpl_cpu = nullptr;
+ // TODO, this could be a unique_ptr
+ surf::HostImpl* pimpl_ = nullptr;
/** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
kernel::routing::NetPoint* pimpl_netpoint = nullptr;
};
/* iterate for all virtual machines */
for (s4u::VirtualMachine* const& ws_vm : VirtualMachineImpl::allVms_) {
surf::Cpu* cpu = ws_vm->pimpl_cpu;
- xbt_assert(cpu, "cpu-less host");
double solved_value =
ws_vm->getImpl()->action_->get_variable()->get_value(); // this is X1 in comment above, what
/* Currently, a VM uses the network resource of its physical host */
pimpl_netpoint = pm->pimpl_netpoint;
+
// Create a VCPU for this VM
- surf::CpuCas01* sub_cpu = dynamic_cast<surf::CpuCas01*>(pm->pimpl_cpu);
+ std::vector<double>* speeds = new std::vector<double>();
+ for (int i = 0; i < pm->getPstatesCount(); i++)
+ speeds->push_back(pm->getPstateSpeed(i));
- pimpl_cpu = surf_cpu_model_vm->createCpu(this, sub_cpu->getSpeedPeakList(), coreAmount);
- if (sub_cpu->getPState() != 0)
- pimpl_cpu->setPState(sub_cpu->getPState());
+ surf_cpu_model_vm->createCpu(this, speeds, pm->getCoreCount());
+ if (pm->getPstate() != 0)
+ setPstate(pm->getPstate());
/* Make a process container */
extension_set<simgrid::simix::Host>(new simgrid::simix::Host());