-Cpu::Cpu(Model *model, const char *name,
- lmm_constraint_t constraint, int core, double speedPeak,
- double speedScale, e_surf_resource_state_t stateInitial)
- : Resource(model, name, constraint, stateInitial)
- , m_core(core)
- , m_speedPeak(speedPeak)
- , m_speedScale(speedScale)
-{
- /* At now, we assume that a VM does not have a multicore CPU. */
- if (core > 1)
- xbt_assert(model == surf_cpu_model_pm);
-
- if (model->getUpdateMechanism() != UM_UNDEFINED) {
- p_constraintCore = xbt_new(lmm_constraint_t, core);
- p_constraintCoreId = xbt_new(void*, core);
-
- int i;
- for (i = 0; i < core; i++) {
- /* just for a unique id, never used as a string. */
- p_constraintCoreId[i] = bprintf("%s:%i", name, i);
- p_constraintCore[i] = lmm_constraint_new(model->getMaxminSystem(), p_constraintCoreId[i], m_speedScale * m_speedPeak);
- }