Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake_case some easy parts of s4u::Host
[simgrid.git] / src / plugins / vm / s4u_VirtualMachine.cpp
index 8d83e9b..af76685 100644 (file)
@@ -33,12 +33,15 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm, int coreAmount,
 
   /* 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;
+  for (int i = 0; i < pm->get_pstate_count(); 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->create_cpu(this, &speeds, pm->get_core_count());
+  if (pm->get_pstate() != 0)
+    set_pstate(pm->get_pstate());
 
   /* Make a process container */
   extension_set<simgrid::simix::Host>(new simgrid::simix::Host());