Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Give a p_netcard to simgrid::Host instead of relying on extensions for that
[simgrid.git] / src / surf / cpu_ti.cpp
index 90447fb..d6a976b 100644 (file)
@@ -435,7 +435,7 @@ 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,
@@ -447,7 +447,7 @@ Cpu *CpuTiModel::createCpu(const char *name,
   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, name, speedPeak, pstate, speedScale, speedTrace,
+  CpuTi *cpu = new CpuTi(this, host, speedPeak, pstate, speedScale, speedTrace,
                           core, stateInitial, stateTrace);
   return cpu;
 }
@@ -502,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<CpuTi*>(sg_host_surfcpu(sg_host_by_name(elm)));
+    CpuTi *cpu = static_cast<CpuTi*>(sg_host_by_name(elm)->p_cpu);
 
     xbt_assert(cpu, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -518,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<CpuTi*>(sg_host_surfcpu(sg_host_by_name(elm)));
+    CpuTi *cpu = static_cast<CpuTi*>(sg_host_by_name(elm)->p_cpu);
 
     xbt_assert(cpu, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -548,10 +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)
-  : Cpu(model, name, core, 0, speedScale, stateInitial)
+  : Cpu(model, host, NULL, pstate, core, 0, speedScale, stateInitial)
 {
   p_speedEvent = NULL;
   m_speedScale = speedScale;
@@ -858,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);