From: Martin Quinson Date: Sun, 22 Nov 2015 21:57:06 +0000 (+0100) Subject: rename a global to make its purpose clear (hopefully) X-Git-Tag: v3_13~1576 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/63d18c86bbffb905a9d31dc2384596cead30529a rename a global to make its purpose clear (hopefully) --- diff --git a/src/bindings/java/surf_swig.cpp b/src/bindings/java/surf_swig.cpp index 69d0acfbea..878f249e6f 100644 --- a/src/bindings/java/surf_swig.cpp +++ b/src/bindings/java/surf_swig.cpp @@ -24,7 +24,7 @@ CpuModel *getCpuModel(){ CpuModel *java_cpu_model; static void java_cpu_model_init_preparse() { surf_cpu_model_pm = java_cpu_model; - xbt_dynar_push(model_list, &java_cpu_model); + xbt_dynar_push(all_existing_models, &java_cpu_model); xbt_dynar_push(model_list_invoke, &java_cpu_model); sg_platf_host_add_cb(cpu_parse_init); } diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 939f8bc60a..182a93c9c5 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -1036,7 +1036,7 @@ XBT_PUBLIC_DATA(s_surf_model_description_t) /** \ingroup SURF_models * \brief List of initialized models */ -XBT_PUBLIC_DATA(xbt_dynar_t) model_list; +XBT_PUBLIC_DATA(xbt_dynar_t) all_existing_models; XBT_PUBLIC_DATA(xbt_dynar_t) model_list_invoke; /** \ingroup SURF_simulation diff --git a/src/simdag/sd_global.c b/src/simdag/sd_global.c index 836b0e9ca4..e5f97a0b36 100644 --- a/src/simdag/sd_global.c +++ b/src/simdag/sd_global.c @@ -297,9 +297,8 @@ xbt_swag_t SD_simulate_swag(double how_long) { if (elapsed_time > 0.0) total_time += elapsed_time; - /* FIXME: shoud look at model_list or model_list_invoke? */ /* let's see which tasks are done */ - xbt_dynar_foreach(model_list, iter, model) { + xbt_dynar_foreach(all_existing_models, iter, model) { while ((action = surf_model_extract_done_action_set(model))) { task = surf_action_get_data(action); task->start_time = surf_action_get_start_time(task->surf_action); diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index 0404d17deb..677f9d52a2 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -433,7 +433,7 @@ void SIMIX_run(void) } } /* Wake up all processes waiting for a Surf action to finish */ - xbt_dynar_foreach(model_list, iter, model) { + xbt_dynar_foreach(all_existing_models, iter, model) { XBT_DEBUG("Handling process whose action failed"); while ((action = surf_model_extract_failed_action_set(model))) { XBT_DEBUG(" Handling Action %p",action); @@ -471,7 +471,7 @@ void SIMIX_run(void) } /* Wake up all processes waiting for a Surf action to finish */ - xbt_dynar_foreach(model_list, iter, model) { + xbt_dynar_foreach(all_existing_models, iter, model) { XBT_DEBUG("Handling process whose action failed"); while ((action = surf_model_extract_failed_action_set(model))) { XBT_DEBUG(" Handling Action %p",action); diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index de2d9a54bb..fde93bca20 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -35,8 +35,8 @@ void surf_cpu_model_init_Cas01() Model *model_pm = surf_cpu_model_pm; Model *model_vm = surf_cpu_model_vm; - xbt_dynar_push(model_list, &model_pm); - xbt_dynar_push(model_list, &model_vm); + xbt_dynar_push(all_existing_models, &model_pm); + xbt_dynar_push(all_existing_models, &model_vm); } CpuCas01Model::CpuCas01Model() : CpuModel() diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 00346bf243..fba3eac780 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -400,8 +400,8 @@ void surf_cpu_model_init_ti() cpu_ti_define_callbacks(); Model *model_pm = static_cast(surf_cpu_model_pm); Model *model_vm = static_cast(surf_cpu_model_vm); - xbt_dynar_push(model_list, &model_pm); - xbt_dynar_push(model_list, &model_vm); + xbt_dynar_push(all_existing_models, &model_pm); + xbt_dynar_push(all_existing_models, &model_vm); } CpuTiModel::CpuTiModel() : CpuModel() diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index e4d4957ff3..e18f0420c9 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -28,7 +28,7 @@ void surf_host_model_init_current_default(void) surf_network_model_init_LegrandVelho(); Model *model = surf_host_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); xbt_dynar_push(model_list_invoke, &model); sg_platf_host_add_cb(host_parse_init); } @@ -41,7 +41,7 @@ void surf_host_model_init_compound() surf_host_model = new HostCLM03Model(); Model *model = surf_host_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); xbt_dynar_push(model_list_invoke, &model); sg_platf_host_add_cb(host_parse_init); } diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index 5dca16698b..390f3c3e94 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -41,7 +41,7 @@ void surf_host_model_init_ptask_L07(void) surf_host_model = new HostL07Model(); Model *model = surf_host_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); xbt_dynar_push(model_list_invoke, &model); } diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 21f8106482..c5c242be8c 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -55,7 +55,7 @@ void surf_network_model_init_LegrandVelho(void) surf_network_model = new NetworkCm02Model(); net_define_callbacks(); Model *model = surf_network_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 13.01); @@ -84,7 +84,7 @@ void surf_network_model_init_CM02(void) surf_network_model = new NetworkCm02Model(); net_define_callbacks(); Model *model = surf_network_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0); xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", @@ -110,7 +110,7 @@ void surf_network_model_init_Reno(void) surf_network_model = new NetworkCm02Model(); net_define_callbacks(); Model *model = surf_network_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi); surf_network_model->f_networkSolve = lagrange_solve; @@ -130,7 +130,7 @@ void surf_network_model_init_Reno2(void) surf_network_model = new NetworkCm02Model(); net_define_callbacks(); Model *model = surf_network_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp, func_reno2_fpi); surf_network_model->f_networkSolve = lagrange_solve; @@ -150,7 +150,7 @@ void surf_network_model_init_Vegas(void) surf_network_model = new NetworkCm02Model(); net_define_callbacks(); Model *model = surf_network_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi); surf_network_model->f_networkSolve = lagrange_solve; diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index 3421c67663..609b2de12f 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -32,7 +32,7 @@ void surf_network_model_init_Constant() sg_platf_link_add_cb(netcste_parse_nolink); Model *model = surf_network_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); } double NetworkConstantModel::shareResources(double /*now*/) diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index a2e52ffa1a..65a501c8f0 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -82,7 +82,7 @@ void surf_network_model_init_IB(void) return; surf_network_model = new NetworkIBModel(); net_define_callbacks(); - xbt_dynar_push(model_list, &surf_network_model); + xbt_dynar_push(all_existing_models, &surf_network_model); surf_callback_connect(networkActionStateChangedCallbacks, IB_action_state_changed_callback); surf_callback_connect(networkCommunicateCallbacks, IB_action_init_callback); diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index dd70811397..8eab114d6c 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -270,7 +270,7 @@ void surf_network_model_init_NS3() surf_network_model = new NetworkNS3Model(); - xbt_dynar_push(model_list, &surf_network_model); + xbt_dynar_push(all_existing_models, &surf_network_model); } NetworkNS3Model::NetworkNS3Model() : NetworkModel() { diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index 78e03e5b05..5d26431b7d 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -79,7 +79,7 @@ void surf_network_model_init_SMPI(void) return; surf_network_model = new NetworkSmpiModel(); net_define_callbacks(); - xbt_dynar_push(model_list, &surf_network_model); + xbt_dynar_push(all_existing_models, &surf_network_model); xbt_cfg_setdefault_double(_sg_cfg_set, "network/sender_gap", 10e-6); xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 42fef37138..a2614f817d 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -214,7 +214,7 @@ void surf_storage_model_init_default(void) { surf_storage_model = new StorageN11Model(); storage_define_callbacks(); - xbt_dynar_push(model_list, &surf_storage_model); + xbt_dynar_push(all_existing_models, &surf_storage_model); } StorageN11Model::StorageN11Model() : StorageModel() { diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 490ca6eb95..4c3a58dd54 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -51,7 +51,7 @@ void surf_presolve(void) } } } - xbt_dynar_foreach(model_list, iter, model) + xbt_dynar_foreach(all_existing_models, iter, model) model->updateActionsState(NOW, 0.0); } @@ -152,7 +152,7 @@ double surf_solve(double max_date) NOW = NOW + surf_min; /* FIXME: model_list or model_list_invoke? revisit here later */ /* sequential version */ - xbt_dynar_foreach(model_list, iter, model) { + xbt_dynar_foreach(all_existing_models, iter, model) { model->updateActionsState(NOW, surf_min); } diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 8a671c14fa..178b7b1431 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -26,7 +26,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, /* model_list_invoke contains only surf_host and surf_vm. * The callback functions of cpu_model and network_model will be called from * those of these host models. */ -xbt_dynar_t model_list = NULL; /* for destroying all models correctly */ +xbt_dynar_t all_existing_models = NULL; /* to destroy models correctly */ xbt_dynar_t model_list_invoke = NULL; /* for invoking callbacks */ tmgr_history_t history = NULL; @@ -317,8 +317,8 @@ void surf_init(int *argc, char **argv) SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_storage_free); xbt_init(argc, argv); - if (!model_list) - model_list = xbt_dynar_new(sizeof(Model*), NULL); + if (!all_existing_models) + all_existing_models = xbt_dynar_new(sizeof(Model*), NULL); if (!model_list_invoke) model_list_invoke = xbt_dynar_new(sizeof(Model*), NULL); if (!history) @@ -354,9 +354,9 @@ void surf_exit(void) xbt_lib_free(&file_lib); xbt_dict_free(&watched_hosts_lib); - xbt_dynar_foreach(model_list, iter, model) + xbt_dynar_foreach(all_existing_models, iter, model) delete model; - xbt_dynar_free(&model_list); + xbt_dynar_free(&all_existing_models); xbt_dynar_free(&model_list_invoke); routing_exit(); diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index c9e52acb9d..3bd23942b3 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -273,7 +273,7 @@ typedef ActionLmmList* ActionLmmListPtr; /********* * Model * *********/ -XBT_PUBLIC_DATA(xbt_dynar_t) model_list; +XBT_PUBLIC_DATA(xbt_dynar_t) all_existing_models; /** @ingroup SURF_interface * @brief SURF model interface class diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index 82c3591c27..40b73a9929 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -14,7 +14,7 @@ void surf_vm_model_init_HL13(void){ surf_vm_model = new VMHL13Model(); Model *model = surf_vm_model; - xbt_dynar_push(model_list, &model); + xbt_dynar_push(all_existing_models, &model); xbt_dynar_push(model_list_invoke, &model); } } diff --git a/teshsuite/surf/surf_usage/surf_usage2.c b/teshsuite/surf/surf_usage/surf_usage2.c index 811b6920fd..7859613657 100644 --- a/teshsuite/surf/surf_usage/surf_usage2.c +++ b/teshsuite/surf/surf_usage/surf_usage2.c @@ -72,7 +72,7 @@ void test(char *platform) now = surf_get_clock(); XBT_DEBUG("Next Event : %g", now); - xbt_dynar_foreach(model_list, iter, model) { + xbt_dynar_foreach(all_existing_models, iter, model) { XBT_DEBUG("\t Actions"); while ((action = surf_model_extract_failed_action_set((surf_model_t)model))) { XBT_DEBUG("\t * Failed : %p", action);