* under the terms of the license (GNU LGPL) which comes with this package. */
#include "cpu_interface.hpp"
+#include "plugins/energy.hpp"
XBT_LOG_EXTERNAL_CATEGORY(surf_kernel);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
Cpu::Cpu(){
surf_callback_emit(cpuCreatedCallbacks, this);
+ physCpu = NULL;
}
Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
, p_constraintCoreId(NULL)
{
surf_callback_emit(cpuCreatedCallbacks, this);
+ physCpu = NULL;
}
Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
p_constraintCore[i] = lmm_constraint_new(model->getMaxminSystem(), p_constraintCoreId[i], m_powerScale * m_powerPeak);
}
}
+ physCpu = NULL;
}
Cpu::~Cpu(){
Resource::setState(state);
surf_callback_emit(cpuStateChangedCallbacks, this, old, state);
}
+
+void Cpu::setVirtual(Cpu *physCpu)
+{
+ this->physCpu = physCpu;
+ XBT_DEBUG("The CPU is virtual so associate the cpu energy to the physical cpu instead of creating a new one");
+ std::map<Cpu*, CpuEnergy*>::iterator cpu_energy_it = surf_energy->find(physCpu);
+ xbt_assert(cpu_energy_it != surf_energy->end(), "The cpu is not in surf_energy.");
+ (*surf_energy)[this] = cpu_energy_it->second;
+}
+
+Cpu* Cpu::isVirtual(void)
+{
+ return physCpu;
+}
+
/**********
* Action *
**********/