delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
}
-Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core)
+Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)
{
- xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
+ xbt_assert(xbt_dynar_getfirst_as(speedList, 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);
- return new CpuCas01(this, host, speedPeak, speedTrace, core);
+ return new CpuCas01(this, host, speedList, core);
}
double CpuCas01Model::next_occuring_event_full(double /*now*/)
/************
* Resource *
************/
-CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- tmgr_trace_t speedTrace, int core)
+CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)
: Cpu(model, host,
- lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedPeak, 0/*pstate*/, double)),
- speedPeak, core, xbt_dynar_get_as(speedPeak, 0/*pstate*/, double))
+ lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedList, 0/*pstate*/, double)),
+ speedList, core, xbt_dynar_get_as(speedList, 0/*pstate*/, double))
{
-
XBT_DEBUG("CPU create: peak=%f, pstate=%d", speed_.peak, pstate_);
coresAmount_ = core;
- if (speedTrace)
- speed_.event = future_evt_set->add_trace(speedTrace, 0.0, this);
}
CpuCas01::~CpuCas01()
CpuCas01Model();
~CpuCas01Model();
- Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core) override;
+ Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) 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,
- tmgr_trace_t speedTrace, int core);
+ CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core);
~CpuCas01();
void apply_event(tmgr_trace_iterator_t event, double value) override;
CpuAction *execution_start(double size) override;
* @brief Create a Cpu
*
* @param host The host that will have this CPU
- * @param speedPeak The peak spead (max speed in Flops when no external load comes from a trace)
- * @param speedTrace Speed variations
+ * @param speedList The peak speed (max speed in Flops when no external load comes from a trace) for each pstate
* @param core The number of core of this Cpu
*/
- virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core)=0;
+ virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)=0;
void updateActionsStateLazy(double now, double delta);
void updateActionsStateFull(double now, double delta);
* @param model The CpuModel associated to this Cpu
* @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 speedList [TODO]
* @param core The number of core of this Cpu
* @param speedPeak The speed peak of this Cpu in flops (max speed)
*/
xbt_heap_free(tiActionHeap_);
}
-Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host,
- xbt_dynar_t speedPeak,
- tmgr_trace_t speedTrace,
- int core)
+Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speeds, int core)
{
xbt_assert(core==1,"Multi-core not handled with this model yet");
- xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
+ xbt_assert(xbt_dynar_getfirst_as(speeds, double) > 0.0,
"Speed has to be >0.0. Did you forget to specify the mandatory speed attribute?");
- return new CpuTi(this, host, speedPeak, speedTrace, core);
+ return new CpuTi(this, host, speeds, core);
}
double CpuTiModel::next_occuring_event(double now)
/************
* Resource *
************/
-CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- tmgr_trace_t speedTrace, int core)
+CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core)
: Cpu(model, host, NULL, core, 0)
{
xbt_assert(core==1,"Multi-core not handled by this model yet");
coresAmount_ = core;
-
actionSet_ = new ActionTiList();
xbt_dynar_get_cpy(speedPeak, 0, &speed_.peak);
XBT_DEBUG("CPU create: peak=%f", speed_.peak);
- setSpeedTrace(speedTrace);
+ speedIntegratedTrace_ = new CpuTiTgmr(NULL, 1/*scale*/);
}
CpuTi::~CpuTi()
************/
class CpuTi : public Cpu {
public:
- CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core);
+ CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core);
~CpuTi();
void setSpeedTrace(tmgr_trace_t trace) override;
public:
CpuTiModel();
~CpuTiModel();
- Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
- tmgr_trace_t speedTrace, int core) override;
+ Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speeds, int core) override;
double next_occuring_event(double now) override;
void updateActionsState(double now, double delta) override;
sg_host_t*host_list = xbt_new0(sg_host_t, 2);
double *flops_amount = xbt_new0(double, 2);
double *bytes_amount = xbt_new0(double, 4);
- Action *res = NULL;
host_list[0] = sg_host_by_name(src->name());
host_list[1] = sg_host_by_name(dst->name());
bytes_amount[1] = size;
- res = p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate);
-
- return res;
+ return p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate);
}
-Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t powerPeakList,
- tmgr_trace_t power_trace, int core)
+Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedsList, int core)
{
- return new CpuL07(this, host, powerPeakList, power_trace, core);
+ return new CpuL07(this, host, speedsList, core);
}
Link* NetworkL07Model::createLink(const char *name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy, xbt_dict_t properties)
{
- xbt_assert(!Link::byName(name),
- "Link '%s' declared several times in the platform.", name);
+ xbt_assert(!Link::byName(name), "Link '%s' declared several times in the platform.", name);
Link* link = new LinkL07(this, name, properties, bandwidth, latency, policy);
Link::onCreation(link);
* Resource *
************/
-CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host,
- xbt_dynar_t speedPeakList,
- tmgr_trace_t speedTrace,
- int core)
- : Cpu(model, host, speedPeakList, core, xbt_dynar_get_as(speedPeakList,0,double))
+CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)
+ : Cpu(model, host, speedList, core, xbt_dynar_get_as(speedList,0,double))
{
- p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPeakList,0,double));
-
- if (speedTrace)
- speed_.event = future_evt_set->add_trace(speedTrace, 0.0, this);
+ p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedList,0,double));
}
CpuL07::~CpuL07()
CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
~CpuL07Model();
- Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeakList,
- tmgr_trace_t speedTrace, int core) override;
+ Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedsList, int core) override;
HostL07Model *p_hostModel;
};
class CpuL07 : public Cpu {
public:
- CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, tmgr_trace_t power_trace, int core);
+ CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core);
~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->speed_trace,
host->core_amount);
if (host->state_trace)
cpu->setStateTrace(host->state_trace);
+ if (host->speed_trace)
+ cpu->setSpeedTrace(host->speed_trace);
surf_host_model->createHost(host->id, netcard, cpu, host->properties)->attach(h);
if (host->pstate != 0)
CpuCas01 *sub_cpu = static_cast<CpuCas01*>(host_PM->pimpl_cpu);
p_cpu = surf_cpu_model_vm->createCpu(host_VM, // the machine hosting the VM
- sub_cpu->getSpeedPeakList(), // host->speed_peak,
- NULL, // host->speed_trace,
- 1); // host->core_amount,
+ sub_cpu->getSpeedPeakList(), 1 /*cores*/);
if (sub_cpu->getPState() != 0)
p_cpu->setPState(sub_cpu->getPState());