]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/resource/VirtualMachineImpl.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge remote-tracking branch 'github/master'
[simgrid.git] / src / kernel / resource / VirtualMachineImpl.cpp
index a30d3a2233beb8ad622ef4dc3004375caf8ac220..e741ba131d5361914cc2d5dd09416789dcc314d3 100644 (file)
@@ -14,6 +14,8 @@
 #include "src/surf/cpu_cas01.hpp"
 #include "src/surf/cpu_ti.hpp"
 
+#include <numeric>
+
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_vm, ker_resource, "Virtual Machines, containing actors and mobile across hosts");
 
 void surf_vm_model_init_HL13(simgrid::kernel::resource::CpuModel* cpu_pm_model)
@@ -169,6 +171,12 @@ double VMModel::next_occurring_event(double now)
   return -1.0;
 }
 
+Action* VMModel::execute_thread(const s4u::Host* host, double flops_amount, int thread_count)
+{
+  auto cpu = host->get_cpu();
+  return cpu->execution_start(thread_count * flops_amount, thread_count, -1);
+}
+
 /************
  * Resource *
  ************/
@@ -184,7 +192,7 @@ VirtualMachineImpl::VirtualMachineImpl(const std::string& name, s4u::VirtualMach
    * The value for GUESTOS_NOISE corresponds to the cost of the global action associated to the VM.  It corresponds to
    * the cost of a VM running no tasks.
    */
-  action_ = physical_host_->get_cpu()->execution_start(0, core_amount_);
+  action_ = physical_host_->get_cpu()->execution_start(0, core_amount_, 0);
 
   // It's empty for now, so it should not request resources in the PM
   update_action_weight();
@@ -205,7 +213,7 @@ void VirtualMachineImpl::vm_destroy()
   xbt_assert(ret, "Bug: some resource still remains");
 }
 
-void VirtualMachineImpl::suspend(smx_actor_t issuer)
+void VirtualMachineImpl::suspend(const actor::ActorImpl* issuer)
 {
   if (vm_state_ != s4u::VirtualMachine::State::RUNNING)
     throw VmFailureException(XBT_THROW_POINT,
@@ -253,7 +261,7 @@ void VirtualMachineImpl::resume()
  *
  * @param issuer the actor requesting the shutdown
  */
-void VirtualMachineImpl::shutdown(smx_actor_t issuer)
+void VirtualMachineImpl::shutdown(actor::ActorImpl* issuer)
 {
   if (vm_state_ != s4u::VirtualMachine::State::RUNNING)
     XBT_VERB("Shutting down the VM %s even if it's not running but in state %s", piface_->get_cname(),