X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7f4f03348bd07609e258eb3b545bdafc2c881847..23a00833ef66ff4383394e3cac558a5232d4bd62:/src/surf/cpu_ti.cpp diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 0eeb532ce1..d6a976ba67 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -435,23 +435,20 @@ CpuTiModel::~CpuTiModel() xbt_heap_free(p_tiActionHeap); } -Cpu *CpuTiModel::createCpu(const char *name, +Cpu *CpuTiModel::createCpu(simgrid::Host *host, xbt_dynar_t speedPeak, int pstate, double speedScale, tmgr_trace_t speedTrace, int core, e_surf_resource_state_t stateInitial, - tmgr_trace_t stateTrace, - xbt_dict_t cpuProperties) + tmgr_trace_t stateTrace) { xbt_assert(core==1,"Multi-core not handled with this model yet"); - sg_host_t host = sg_host_by_name(name); 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, name, speedPeak, pstate, speedScale, speedTrace, - core, stateInitial, stateTrace, cpuProperties); - sg_host_surfcpu_register(host, cpu); + CpuTi *cpu = new CpuTi(this, host, speedPeak, pstate, speedScale, speedTrace, + core, stateInitial, stateTrace); return cpu; } @@ -505,7 +502,7 @@ void CpuTiModel::addTraces() /* connect all traces relative to hosts */ xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) { tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name); - CpuTi *cpu = static_cast(sg_host_surfcpu(sg_host_by_name(elm))); + CpuTi *cpu = static_cast(sg_host_by_name(elm)->p_cpu); xbt_assert(cpu, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); @@ -521,7 +518,7 @@ void CpuTiModel::addTraces() xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) { tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name); - CpuTi *cpu = static_cast(sg_host_surfcpu(sg_host_by_name(elm))); + CpuTi *cpu = static_cast(sg_host_by_name(elm)->p_cpu); xbt_assert(cpu, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); @@ -551,11 +548,10 @@ void CpuTiModel::addTraces() /************ * Resource * ************/ -CpuTi::CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t speedPeak, +CpuTi::CpuTi(CpuTiModel *model, simgrid::Host *host, xbt_dynar_t speedPeak, int pstate, double speedScale, tmgr_trace_t speedTrace, int core, - e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, - xbt_dict_t properties) - : Cpu(model, name, properties, core, 0, speedScale, stateInitial) + e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace) + : Cpu(model, host, NULL, pstate, core, 0, speedScale, stateInitial) { p_speedEvent = NULL; m_speedScale = speedScale; @@ -588,7 +584,8 @@ CpuTi::CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t speedPeak, } }; -CpuTi::~CpuTi(){ +CpuTi::~CpuTi() +{ modified(false); delete p_availTrace; delete p_actionSet; @@ -861,8 +858,6 @@ CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed, CpuTi *cpu) : CpuAction(model_, cost, failed) { - m_suspended = 0; /* Should be useless because of the - calloc but it seems to help valgrind... */ p_cpu = cpu; m_indexHeap = -1; p_cpu->modified(true); @@ -977,4 +972,3 @@ double CpuTiAction::getRemains() } #endif /* SURF_MODEL_CPUTI_H_ */ -