}
Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- int pstate, double speedScale,
- tmgr_trace_t speedTrace, int core,
- int initiallyOn,
- tmgr_trace_t state_trace)
+ double speedScale, tmgr_trace_t speedTrace, int core, tmgr_trace_t state_trace)
{
xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
"Speed has to be >0.0. Did you forget to specify the mandatory power attribute?");
xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core);
- Cpu *cpu = new CpuCas01(this, host, speedPeak, pstate, speedScale, speedTrace, core, initiallyOn, state_trace);
+ Cpu *cpu = new CpuCas01(this, host, speedPeak, speedScale, speedTrace, core, state_trace);
return cpu;
}
* Resource *
************/
CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
- int initiallyOn, tmgr_trace_t stateTrace)
+ double speedScale, tmgr_trace_t speedTrace, int core, tmgr_trace_t stateTrace)
: Cpu(model, host,
- lmm_constraint_new(model->getMaxminSystem(), this, core * speedScale * xbt_dynar_get_as(speedPeak, pstate, double)),
- speedPeak, pstate,
- core, xbt_dynar_get_as(speedPeak, pstate, double), speedScale,
- initiallyOn) {
+ lmm_constraint_new(model->getMaxminSystem(), this, core * speedScale * xbt_dynar_get_as(speedPeak, 0/*pstate*/, double)),
+ speedPeak, core, xbt_dynar_get_as(speedPeak, 0/*pstate*/, double), speedScale)
+{
XBT_DEBUG("CPU create: peak=%f, pstate=%d", p_speed.peak, m_pstate);
CpuCas01Model();
~CpuCas01Model();
- Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int pstate,
- double speedScale,
- tmgr_trace_t speedTrace, int core,
- int initiallyOn,
- tmgr_trace_t state_trace) override;
+ Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, double speedScale,
+ tmgr_trace_t speedTrace, int core, tmgr_trace_t state_trace) override;
double next_occuring_event_full(double now) override;
ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
};
class CpuCas01 : public Cpu {
public:
CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
- int initiallyOn, tmgr_trace_t stateTrace) ;
+ double speedScale, tmgr_trace_t speedTrace, int core, tmgr_trace_t stateTrace) ;
~CpuCas01();
void apply_event(tmgr_trace_iterator_t event, double value) override;
CpuAction *execution_start(double size) override;
* Resource *
************/
Cpu::Cpu(Model *model, simgrid::s4u::Host *host,
- xbt_dynar_t speedPeakList, int pstate,
- int core, double speedPeak, double speedScale,
- int initiallyOn)
- : Cpu(model, host, NULL/*constraint*/, speedPeakList, pstate, core, speedPeak, speedScale, initiallyOn)
+ xbt_dynar_t speedPeakList, int core, double speedPeak, double speedScale)
+ : Cpu(model, host, NULL/*constraint*/, speedPeakList, core, speedPeak, speedScale)
{
}
Cpu::Cpu(Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint,
- xbt_dynar_t speedPeakList, int pstate,
- int core, double speedPeak,
- double speedScale, int initiallyOn)
- : Resource(model, host->name().c_str(), constraint, initiallyOn)
+ xbt_dynar_t speedPeakList, int core, double speedPeak, double speedScale)
+ : Resource(model, host->name().c_str(), constraint)
, m_core(core)
, m_host(host)
{
xbt_dynar_push(p_speedPeakList, &value);
}
- m_pstate = pstate;
-
/* Currently, we assume that a VM does not have a multicore CPU. */
if (core > 1)
xbt_assert(model == surf_cpu_model_pm);
*
* @param host The host that will have this CPU
* @param speedPeak The peak spead (max speed in Flops)
- * @param pstate [TODO]
* @param speedScale The speed scale (in [O;1] available speed from peak)
* @param speedTrace Trace variations
* @param core The number of core of this Cpu
- * @param initiallyOn [TODO]
* @param state_trace [TODO]
*/
virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- int pstate, double speedScale,
+ double speedScale,
tmgr_trace_t speedTrace, int core,
- int initiallyOn,
tmgr_trace_t state_trace)=0;
void updateActionsStateLazy(double now, double delta);
* @param host The host in which this Cpu should be plugged
* @param constraint The lmm constraint associated to this Cpu if it is part of a LMM component
* @param speedPeakList [TODO]
- * @param pstate [TODO]
* @param core The number of core of this Cpu
* @param speedPeak The speed peak of this Cpu in flops (max speed)
* @param speedScale The speed scale of this Cpu in [0;1] (available amount)
- * @param initiallyOn whether it is created running or crashed
*/
Cpu(simgrid::surf::Model *model, simgrid::s4u::Host *host,
lmm_constraint_t constraint,
- xbt_dynar_t speedPeakList, int pstate,
- int core, double speedPeak, double speedScale,
- int initiallyOn);
+ xbt_dynar_t speedPeakList,
+ int core, double speedPeak, double speedScale);
/**
* @brief Cpu constructor
* @param model The CpuModel associated to this Cpu
* @param host The host in which this Cpu should be plugged
* @param speedPeakList [TODO]
- * @param pstate
* @param core The number of core of this Cpu
* @param speedPeak The speed peak of this Cpu in flops (max speed)
* @param speedScale The speed scale of this Cpu in [0;1] (available amount)
- * @param initiallyOn whether it is created running or crashed
*/
Cpu(simgrid::surf::Model *model, simgrid::s4u::Host *host,
- xbt_dynar_t speedPeakList, int pstate,
- int core, double speedPeak, double speedScale,
- int initiallyOn);
+ xbt_dynar_t speedPeakList,
+ int core, double speedPeak, double speedScale);
~Cpu();
}
Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host,
- xbt_dynar_t speedPeak,
- int pstate,
- double speedScale,
- tmgr_trace_t speedTrace,
- int core,
- int initiallyOn,
- tmgr_trace_t stateTrace)
+ xbt_dynar_t speedPeak,
+ double speedScale,
+ tmgr_trace_t speedTrace,
+ int core,
+ tmgr_trace_t stateTrace)
{
xbt_assert(core==1,"Multi-core not handled with this model yet");
xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
"Speed has to be >0.0. Did you forget to specify the mandatory speed attribute?");
- CpuTi *cpu = new CpuTi(this, host, speedPeak, pstate, speedScale, speedTrace,
- core, initiallyOn, stateTrace);
+ CpuTi *cpu = new CpuTi(this, host, speedPeak, speedScale, speedTrace, core, stateTrace);
return cpu;
}
* Resource *
************/
CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
- int initiallyOn, tmgr_trace_t stateTrace)
- : Cpu(model, host, NULL, pstate, core, 0, speedScale, initiallyOn)
+ double speedScale, tmgr_trace_t speedTrace, int core,
+ tmgr_trace_t stateTrace)
+ : Cpu(model, host, NULL, core, 0, speedScale)
{
xbt_assert(core==1,"Multi-core not handled by this model yet");
m_core = core;
class CpuTi : public Cpu {
public:
CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
- int initiallyOn, tmgr_trace_t stateTrace) ;
+ double speedScale, tmgr_trace_t speedTrace, int core,
+ tmgr_trace_t stateTrace) ;
~CpuTi();
void set_speed_trace(tmgr_trace_t trace) override;
public:
CpuTiModel();
~CpuTiModel();
- Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- int pstate, double speedScale,
- tmgr_trace_t speedTrace, int core,
- int initiallyOn, tmgr_trace_t state_trace) override;
+ Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, double speedScale,
+ tmgr_trace_t speedTrace, int core, tmgr_trace_t state_trace) override;
double next_occuring_event(double now) override;
void updateActionsState(double now, double delta) override;
}
Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t powerPeakList,
- int pstate, double power_scale,
+ double power_scale,
tmgr_trace_t power_trace, int core,
- int initiallyOn,
tmgr_trace_t state_trace)
{
- CpuL07 *cpu = new CpuL07(this, host, powerPeakList, pstate, power_scale, power_trace,
- core, initiallyOn, state_trace);
+ CpuL07 *cpu = new CpuL07(this, host, powerPeakList, power_scale, power_trace, core, state_trace);
return cpu;
}
************/
CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host,
- xbt_dynar_t speedPeakList, int pstate,
- double speedScale, tmgr_trace_t speedTrace,
- int core, int initiallyOn, tmgr_trace_t state_trace)
- : Cpu(model, host, speedPeakList, pstate,
- core, xbt_dynar_get_as(speedPeakList,pstate,double), speedScale, initiallyOn)
+ xbt_dynar_t speedPeakList,
+ double speedScale, tmgr_trace_t speedTrace,
+ int core, tmgr_trace_t state_trace)
+ : Cpu(model, host, speedPeakList, core, xbt_dynar_get_as(speedPeakList,0,double), speedScale)
{
- p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPeakList,pstate,double) * speedScale);
+ p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPeakList,0,double) * speedScale);
if (speedTrace)
p_speed.event = future_evt_set->add_trace(speedTrace, 0.0, this);
~CpuL07Model();
Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeakList,
- int pstate, double speedScale,
+ double speedScale,
tmgr_trace_t speedTrace, int core,
- int initiallyOn,
tmgr_trace_t state_trace) override;
HostL07Model *p_hostModel;
};
class CpuL07 : public Cpu {
public:
- CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, int pstate,
+ CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList,
double power_scale, tmgr_trace_t power_trace,
- int core, int initiallyOn, tmgr_trace_t state_trace);
+ int core, tmgr_trace_t state_trace);
~CpuL07();
bool isUsed() override;
void apply_event(tmgr_trace_iterator_t event, double value) override;
simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu( h,
host->speed_peak,
- host->pstate,
host->speed_scale, host->speed_trace,
host->core_amount,
- host->initiallyOn, host->state_trace);
+ host->state_trace);
surf_host_model->createHost(host->id, netcard, cpu, host->properties)->attach(h);
+
+ if (host->pstate != 0)
+ cpu->setPState(host->pstate);
+ if (! host->initiallyOn)
+ cpu->turnOff();
+
simgrid::s4u::Host::onCreation(*h);
if (TRACE_is_enabled() && TRACE_needs_platform())
p_cpu = surf_cpu_model_vm->createCpu(host_VM, // the machine hosting the VM
sub_cpu->getSpeedPeakList(), // host->power_peak,
- sub_cpu->getPState(),
1, // host->power_scale,
NULL, // host->power_trace,
1, // host->core_amount,
- 1/*ON*/, // host->initiallyOn,
NULL); // host->state_trace,
+ if (sub_cpu->getPState() != 0)
+ p_cpu->setPState(sub_cpu->getPState());
/* We create cpu_action corresponding to a VM process on the host operating system. */
/* FIXME: TODO: we have to periodically input GUESTOS_NOISE to the system? how ? */