From: Martin Quinson Date: Mon, 8 Feb 2016 02:13:15 +0000 (+0100) Subject: make trace_connect_list_host_speed private as it should X-Git-Tag: v3_13~923 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/03d87ef83eada5a3cf9aacce9e6a5dc0d169aaa3?hp=ff3eea1f5a18fdbdc861435f6ea9122f075d7249;ds=sidebyside make trace_connect_list_host_speed private as it should --- diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 4e800a8ade..2a5aeec9f5 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -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); diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 6c8f4406a8..04d4f3ea74 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -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; } /************ diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 91b9b40360..d565730a00 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -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}; diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index a08d0804a6..ec7f4e67cd 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -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(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; } /************ diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 57b46382bc..f479e396f1 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -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); diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index 22803406d6..bc73ae68fb 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -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); diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index a0ff19d00d..ebbf7a8d4d 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -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; diff --git a/src/surf/surfxml_parseplatf.cpp b/src/surf/surfxml_parseplatf.cpp index 63df75bb5e..51ce41a759 100644 --- a/src/surf/surfxml_parseplatf.cpp +++ b/src/surf/surfxml_parseplatf.cpp @@ -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);