Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sanitize the handling of trace:connect for host_avail
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 31 Jan 2016 20:51:11 +0000 (21:51 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 31 Jan 2016 22:04:39 +0000 (23:04 +0100)
src/include/surf/surf.h
src/surf/cpu_cas01.cpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/host_ptask_L07.cpp
src/surf/surfxml_parseplatf.cpp

index 6fdb314..52a2e56 100644 (file)
@@ -975,7 +975,6 @@ XBT_PUBLIC(void) parse_platform_file(const char *file);
 
 /* For the trace and trace:connect tag (store their content till the end of the parsing) */
 XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
-XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail;
 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_speed;
 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_bw;
index 0523018..79d0c91 100644 (file)
@@ -115,17 +115,7 @@ void CpuCas01Model::addTraces()
     return;
   called = 1;
 
-  /* 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);
-    Cpu *cpu = sg_host_by_name(elm)->pimpl_cpu;
-
-    xbt_assert(cpu, "Host %s undefined", elm);
-    xbt_assert(trace, "Trace %s undefined", trace_name);
-
-    cpu->set_state_trace(trace);
-  }
-
+  /* connect host speed traces */
   xbt_dict_foreach(trace_connect_list_host_speed, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
     Cpu *cpu = sg_host_by_name(elm)->pimpl_cpu;
index 3bcecbf..63701e2 100644 (file)
@@ -492,22 +492,6 @@ void CpuTiModel::addTraces()
   called = 1;
 
 /* 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_by_name(elm)->pimpl_cpu);
-
-    xbt_assert(cpu, "Host %s undefined", elm);
-    xbt_assert(trace, "Trace %s undefined", trace_name);
-
-    if (cpu->p_stateEvent) {
-      XBT_DEBUG("Trace already configured for this CPU(%s), ignoring it",
-             elm);
-      continue;
-    }
-    XBT_DEBUG("Add state trace: %s to CPU(%s)", trace_name, elm);
-    cpu->p_stateEvent = future_evt_set->add_trace(trace, 0.0, cpu);
-  }
-
   xbt_dict_foreach(trace_connect_list_host_speed, 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_by_name(elm)->pimpl_cpu);
@@ -527,8 +511,7 @@ void CpuTiModel::addTraces()
       xbt_dynar_get_cpy(trace->s_list.event_list,
                         xbt_dynar_length(trace->s_list.event_list) - 1, &val);
       if (val.delta == 0) {
-        cpu->p_speedEvent =
-            future_evt_set->add_trace(tmgr_empty_trace_new(), cpu->p_availTrace->m_lastTime, cpu);
+        cpu->set_speed_trace(tmgr_empty_trace_new());
       }
     }
   }
index 9df68f4..9c46c46 100644 (file)
@@ -128,8 +128,6 @@ public:
   void modified(bool modified);
 
   CpuTiTgmr *p_availTrace;       /*< Structure with data needed to integrate trace file */
-  tmgr_trace_iterator_t p_stateEvent = NULL; /*< trace file with states events (ON or OFF) */
-  tmgr_trace_iterator_t p_speedEvent = NULL; /*< trace file with availability events */
   ActionTiList *p_actionSet;        /*< set with all actions running on cpu */
   double m_sumPriority;          /*< the sum of actions' priority that are running on cpu */
   double m_lastUpdate = 0;       /*< last update of actions' remaining amount done */
index a66b508..9197c4d 100644 (file)
@@ -340,20 +340,10 @@ void HostL07Model::addTraces()
   xbt_dict_cursor_t cursor = NULL;
   char *trace_name, *elm;
 
-  if (!trace_connect_list_host_avail)
+  if (!trace_connect_list_host_speed)
     return;
 
   /* Connect traces relative to cpu */
-  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);
-    Cpu *cpu = sg_host_by_name(elm)->pimpl_cpu;
-
-    xbt_assert(cpu, "Host %s undefined", elm);
-    xbt_assert(trace, "Trace %s undefined", trace_name);
-
-    cpu->set_state_trace(trace);
-  }
-
   xbt_dict_foreach(trace_connect_list_host_speed, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
     Cpu *cpu = sg_host_by_name(elm)->pimpl_cpu;
index 989e211..ab301e3 100644 (file)
@@ -10,6 +10,7 @@
 #include "xbt/dict.h"
 #include "simgrid/platf.h"
 #include "surf/surfxml_parse.h"
+#include "src/surf/cpu_interface.hpp"
 #include "src/surf/surf_private.h"
 
 #ifdef HAVE_LUA
@@ -135,6 +136,21 @@ void parse_platform_file(const char *file)
     /* Do the actual parsing */
     parse_status = surf_parse();
 
+    /* connect all traces relative to hosts */
+    xbt_dict_cursor_t cursor = NULL;
+    char *trace_name, *elm;
+
+    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);
+      xbt_assert(trace, "Trace %s undefined", trace_name);
+
+      simgrid::s4u::Host *host = sg_host_by_name(elm);
+      xbt_assert(host, "Host %s undefined", elm);
+      simgrid::surf::Cpu *cpu = host->pimpl_cpu;
+
+      cpu->set_state_trace(trace);
+    }
+
     /* Free my data */
     xbt_dict_free(&trace_connect_list_host_avail);
     xbt_dict_free(&trace_connect_list_host_speed);