Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
gitlab-ci: only release the commits that are on the releases branch
[simgrid.git] / src / surf / cpu_cas01.cpp
index ab669d9..114e9e1 100644 (file)
@@ -76,7 +76,7 @@ CpuCas01Model::~CpuCas01Model()
   surf_cpu_model_pm = nullptr;
 }
 
-Cpu* CpuCas01Model::create_cpu(simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core)
+Cpu* CpuCas01Model::create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
 {
   return new CpuCas01(this, host, speed_per_pstate, core);
 }
@@ -84,9 +84,10 @@ Cpu* CpuCas01Model::create_cpu(simgrid::s4u::Host* host, std::vector<double>* sp
 /************
  * Resource *
  ************/
-CpuCas01::CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, std::vector<double>* speedPerPstate, int core)
-    : Cpu(model, host, model->get_maxmin_system()->constraint_new(this, core * speedPerPstate->front()), speedPerPstate,
-          core)
+CpuCas01::CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate,
+                   int core)
+    : Cpu(model, host, model->get_maxmin_system()->constraint_new(this, core * speed_per_pstate.front()),
+          speed_per_pstate, core)
 {
 }
 
@@ -184,7 +185,7 @@ CpuAction* CpuCas01::sleep(double duration)
   // FIXME: sleep variables should not consume 1.0 in System::expand()
   action->set_max_duration(duration);
   action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
-  if (duration < 0) // NO_MAX_DURATION
+  if (duration == NO_MAX_DURATION)
     action->set_state(simgrid::kernel::resource::Action::State::IGNORED);
 
   get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);