Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make trace_connect_list_host_speed private as it should
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 8 Feb 2016 02:13:15 +0000 (03:13 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 8 Feb 2016 02:13:15 +0000 (03:13 +0100)
src/include/surf/surf.h
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/host_ptask_L07.cpp
src/surf/surf_interface.hpp
src/surf/surfxml_parseplatf.cpp

index 4e800a8..2a5aeec 100644 (file)
@@ -975,10 +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_speed;
-XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
-XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_bw;
-XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_lat;
 
 XBT_PUBLIC(double) parse_cpu_speed(const char *str_speed);
 
index 6c8f440..04d4f3e 100644 (file)
@@ -32,10 +32,6 @@ void surf_cpu_model_init_Cas01()
 
   surf_cpu_model_vm  = new simgrid::surf::CpuCas01Model();
   xbt_dynar_push(all_existing_models, &surf_cpu_model_vm);
-
-  simgrid::surf::on_postparse.connect([]() {
-    surf_cpu_model_pm->addTraces();
-  });
 }
 
 namespace simgrid {
@@ -107,23 +103,7 @@ double CpuCas01Model::next_occuring_event_full(double /*now*/)
 
 void CpuCas01Model::addTraces()
 {
-  xbt_dict_cursor_t cursor = NULL;
-  char *trace_name, *elm;
-  static int called = 0;
-  if (called)
-    return;
-  called = 1;
-
-  /* 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;
-
-    xbt_assert(cpu, "Host %s undefined", elm);
-    xbt_assert(trace, "Trace %s undefined", trace_name);
-
-    cpu->set_speed_trace(trace);
-  }
+  THROW_DEADCODE;
 }
 
 /************
index 91b9b40..d565730 100644 (file)
@@ -163,8 +163,8 @@ public:
   void **p_constraintCoreId=NULL;
 
 public:
-  void set_state_trace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF) */
-  void set_speed_trace(tmgr_trace_t trace); /*< setup the trace file with availability events (peak speed changes due to external load) */
+  virtual void set_state_trace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF) */
+  virtual void set_speed_trace(tmgr_trace_t trace); /*< setup the trace file with availability events (peak speed changes due to external load) */
 
   tmgr_trace_iterator_t p_stateEvent = nullptr;
   s_surf_metric_t p_speed = {1.0, 0, nullptr};
index a08d080..ec7f4e6 100644 (file)
@@ -399,10 +399,6 @@ void surf_cpu_model_init_ti()
 
   surf_cpu_model_vm = new simgrid::surf::CpuTiModel();
   xbt_dynar_push(all_existing_models, &surf_cpu_model_vm);
-
-  simgrid::surf::on_postparse.connect([]() {
-    surf_cpu_model_pm->addTraces();
-  });
 }
 
 namespace simgrid {
@@ -482,25 +478,7 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/)
 
 void CpuTiModel::addTraces()
 {
-  xbt_dict_cursor_t cursor = NULL;
-  char *trace_name, *elm;
-
-  static int called = 0;
-
-  if (called)
-    return;
-  called = 1;
-
-/* connect all traces relative to hosts */
-  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);
-
-    xbt_assert(cpu, "Host %s undefined", elm);
-    xbt_assert(trace, "Trace %s undefined", trace_name);
-
-    cpu->set_speed_trace(trace);
-  }
+THROW_DEADCODE;
 }
 
 /************
index 57b4638..f479e39 100644 (file)
@@ -118,7 +118,7 @@ public:
         int initiallyOn, tmgr_trace_t stateTrace) ;
   ~CpuTi();
 
-  void set_speed_trace(tmgr_trace_t trace);
+  void set_speed_trace(tmgr_trace_t trace) override;
 
   void apply_event(tmgr_trace_iterator_t event_type, double value) override;
   void updateActionsFinishTime(double now);
index 2280340..bc73ae6 100644 (file)
@@ -337,20 +337,9 @@ void HostL07Model::addTraces()
   xbt_dict_cursor_t cursor = NULL;
   char *trace_name, *elm;
 
-  if (!trace_connect_list_host_speed)
+  if (!trace_connect_list_link_avail)
     return;
 
-  /* Connect traces relative to 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);
-    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_speed_trace(trace);
-  }
-
   /* Connect traces relative to network */
   xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
index a0ff19d..ebbf7a8 100644 (file)
@@ -71,7 +71,6 @@ enum heap_action_type{
  *********/
 /* 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_speed;
 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_bw;
 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_lat;
index 63df75b..51ce41a 100644 (file)
@@ -191,6 +191,17 @@ void parse_platform_file(const char *file)
 
       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);
+      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_speed_trace(trace);
+    }
+
 
     /* Free my data */
     xbt_dict_free(&trace_connect_list_host_avail);