namespace simgrid {
namespace surf {
+simgrid::xbt::FacetLevel<simgrid::Host, Cpu> Cpu::LEVEL;
+
+void Cpu::init()
+{
+ if (!LEVEL.valid())
+ LEVEL = simgrid::Host::add_level<simgrid::surf::Cpu>();
+}
+
/*************
* Callbacks *
*************/
/************
* Resource *
************/
-Cpu::Cpu(){
+Cpu::Cpu()
+{
}
, m_core(core)
, m_speedPeak(speedPeak)
, m_speedScale(speedScale)
- , p_constraintCore(NULL)
- , p_constraintCoreId(NULL)
{
}
if (core > 1)
xbt_assert(model == surf_cpu_model_pm);
- p_constraintCore = NULL;
- p_constraintCoreId = NULL;
if (model->getUpdateMechanism() != UM_UNDEFINED) {
p_constraintCore = xbt_new(lmm_constraint_t, core);
p_constraintCoreId = xbt_new(void*, core);
surf_callback_emit(cpuStateChangedCallbacks, this, old, state);
}
+void Cpu::plug(simgrid::Host* host)
+{
+ if (this->m_host != nullptr)
+ xbt_die("Aleady plugged into host %s", host->id().c_str());
+ host->set_facet(this);
+ this->m_host = host;
+ simgrid::surf::cpuCreatedCallbacks(this);
+ simgrid::surf::cpuStateChangedCallbacks(this,
+ SURF_RESOURCE_ON, this->getState());
+}
+
/**********
* Action *
**********/