From de190af4974a9ed57a52e649e5cbe0ac83512acb Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 19 Apr 2018 12:53:13 +0200 Subject: [PATCH 1/1] Change xbt_cfg_get_bool -> simgrid::config::get_config. --- src/instr/instr_paje_containers.cpp | 6 ++++-- src/instr/instr_paje_events.cpp | 6 ++++-- src/instr/instr_paje_header.cpp | 2 +- src/msg/msg_global.cpp | 2 +- src/simdag/sd_global.cpp | 2 +- src/simix/smx_global.cpp | 2 +- src/smpi/internals/smpi_bench.cpp | 2 +- src/smpi/internals/smpi_global.cpp | 4 ++-- src/smpi/mpi/smpi_request.cpp | 4 ++-- src/surf/cpu_cas01.cpp | 2 +- src/surf/network_cm02.cpp | 2 +- src/xbt/exception.cpp | 4 ++-- 12 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 23f44b3899..f509556e1c 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -3,6 +3,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include + #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" #include "src/instr/instr_private.hpp" @@ -164,7 +166,7 @@ void Container::logCreation() prefix = xbt_os_time(); } - if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || ti_unique_file == nullptr) { + if (not simgrid::config::get_config("tracing/smpi/format/ti-one-file") || ti_unique_file == nullptr) { std::string folder_name = TRACE_get_filename() + "_files"; std::string filename = folder_name + "/" + std::to_string(prefix) + "_" + name_ + ".txt"; #ifdef WIN32 @@ -195,7 +197,7 @@ void Container::logDestruction() XBT_DEBUG("Dump %s", stream.str().c_str()); fprintf(tracing_file, "%s\n", stream.str().c_str()); } else if (trace_format == simgrid::instr::TraceFormat::Ti) { - if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || tracing_files.size() == 1) { + if (not simgrid::config::get_config("tracing/smpi/format/ti-one-file") || tracing_files.size() == 1) { fclose(tracing_files.at(this)); } tracing_files.erase(this); diff --git a/src/instr/instr_paje_events.cpp b/src/instr/instr_paje_events.cpp index 4aacda95af..a9abe0e473 100644 --- a/src/instr/instr_paje_events.cpp +++ b/src/instr/instr_paje_events.cpp @@ -3,6 +3,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include + #include "src/instr/instr_private.hpp" #include "src/instr/instr_smpi.hpp" #include "src/smpi/include/private.hpp" @@ -30,7 +32,7 @@ StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type : PajeEvent::PajeEvent(container, type, SIMIX_get_clock(), event_type), value(value), extra_(extra) { #if HAVE_SMPI - if (xbt_cfg_get_boolean("smpi/trace-call-location")) { + if (simgrid::config::get_config("smpi/trace-call-location")) { smpi_trace_call_location_t* loc = smpi_trace_get_call_location(); filename = loc->filename; linenumber = loc->linenumber; @@ -85,7 +87,7 @@ void StateEvent::print() stream_ << " " << ((extra_ != nullptr) ? extra_->display_size() : 0); #if HAVE_SMPI - if (xbt_cfg_get_boolean("smpi/trace-call-location")) { + if (simgrid::config::get_config("smpi/trace-call-location")) { stream_ << " \"" << filename << "\" " << linenumber; } #endif diff --git a/src/instr/instr_paje_header.cpp b/src/instr/instr_paje_header.cpp index f638de9b42..b7f4229b8c 100644 --- a/src/instr/instr_paje_header.cpp +++ b/src/instr/instr_paje_header.cpp @@ -164,7 +164,7 @@ static void TRACE_header_PajePushState(int size) fprintf(tracing_file, "%% Value string\n"); if (size) fprintf(tracing_file, "%% Size int\n"); #if HAVE_SMPI - if (xbt_cfg_get_boolean("smpi/trace-call-location")) { + if (simgrid::config::get_config("smpi/trace-call-location")) { /** * paje currently (May 2016) uses "Filename" and "Linenumber" as * reserved words. We cannot use them... diff --git a/src/msg/msg_global.cpp b/src/msg/msg_global.cpp index 06c387f63b..52ee291093 100644 --- a/src/msg/msg_global.cpp +++ b/src/msg/msg_global.cpp @@ -51,7 +51,7 @@ void MSG_init_nocheck(int *argc, char **argv) { MC_ignore_heap(&(msg_global->sent_msg), sizeof(msg_global->sent_msg)); } - if (xbt_cfg_get_boolean("clean-atexit")) + if (simgrid::config::get_config("clean-atexit")) atexit(MSG_exit); } diff --git a/src/simdag/sd_global.cpp b/src/simdag/sd_global.cpp index 7bcdaf7676..664f838c55 100644 --- a/src/simdag/sd_global.cpp +++ b/src/simdag/sd_global.cpp @@ -162,7 +162,7 @@ void SD_init_nocheck(int *argc, char **argv) surf_init(argc, argv); xbt_cfg_setdefault_string("host/model", "ptask_L07"); - if(xbt_cfg_get_boolean("clean-atexit")) + if (simgrid::config::get_config("clean-atexit")) atexit(SD_exit); if (_sg_cfg_exit_asap) { exit(0); diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 386d94c50a..0d7fae6b4f 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -217,7 +217,7 @@ void SIMIX_global_init(int *argc, char **argv) }); } - if (xbt_cfg_get_boolean("clean-atexit")) + if (simgrid::config::get_config("clean-atexit")) atexit(SIMIX_clean); if (_sg_cfg_exit_asap) diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index 33d32ef87f..fcd845352e 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -154,7 +154,7 @@ void smpi_bench_end() } // Simulate the benchmarked computation unless disabled via command-line argument - if (xbt_cfg_get_boolean("smpi/simulate-computation")) { + if (simgrid::config::get_config("smpi/simulate-computation")) { smpi_execute(xbt_os_timer_elapsed(timer)/speedup); } diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index edbbf716e4..5ff6ac3e1b 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -527,7 +527,7 @@ int smpi_main(const char* executable, int argc, char *argv[]) // Load the copy and resolve the entry point: void* handle = dlopen(target_executable.c_str(), RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND); int saved_errno = errno; - if (xbt_cfg_get_boolean("smpi/keep-temps") == false) + if (simgrid::config::get_config("smpi/keep-temps") == false) unlink(target_executable.c_str()); if (handle == nullptr) xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), saved_errno, strerror(saved_errno)); @@ -579,7 +579,7 @@ int smpi_main(const char* executable, int argc, char *argv[]) SIMIX_run(); xbt_os_walltimer_stop(global_timer); - if (xbt_cfg_get_boolean("smpi/display-timing")){ + if (simgrid::config::get_config("smpi/display-timing")) { double global_time = xbt_os_timer_elapsed(global_timer); XBT_INFO("Simulated time: %g seconds. \n\n" "The simulation took %g seconds (after parsing and platform setup)\n" diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 7aa1dfdffb..ca851d7c18 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -547,7 +547,7 @@ int Request::test(MPI_Request * request, MPI_Status * status) { nsleeps=1;//reset the number of sleeps we will do next time if (*request != MPI_REQUEST_NULL && ((*request)->flags_ & PERSISTENT) == 0) *request = MPI_REQUEST_NULL; - } else if (xbt_cfg_get_boolean("smpi/grow-injected-times")){ + } else if (simgrid::config::get_config("smpi/grow-injected-times")) { nsleeps++; } } @@ -709,7 +709,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* } else { *flag = 0; - if (xbt_cfg_get_boolean("smpi/grow-injected-times")) + if (simgrid::config::get_config("smpi/grow-injected-times")) nsleeps++; } unref(&request); diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 2ffe199424..2f9fe9da8c 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -60,7 +60,7 @@ namespace surf { CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid::surf::CpuModel(algo) { - bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update"); + bool select = simgrid::config::get_config("cpu/maxmin-selective-update"); if (algo == Model::UpdateAlgo::Lazy) { xbt_assert(select || xbt_cfg_is_default_value("cpu/maxmin-selective-update"), diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index f7f4a84a8e..ccd09c7e91 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -135,7 +135,7 @@ NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(b : NetworkModel(xbt_cfg_get_string("network/optim") == "Full" ? Model::UpdateAlgo::Full : Model::UpdateAlgo::Lazy) { std::string optim = xbt_cfg_get_string("network/optim"); - bool select = xbt_cfg_get_boolean("network/maxmin-selective-update"); + bool select = simgrid::config::get_config("network/maxmin-selective-update"); if (optim == "Lazy") { xbt_assert(select || xbt_cfg_is_default_value("network/maxmin-selective-update"), diff --git a/src/xbt/exception.cpp b/src/xbt/exception.cpp index 0b6b899b9d..dd9a146660 100644 --- a/src/xbt/exception.cpp +++ b/src/xbt/exception.cpp @@ -45,7 +45,7 @@ void logException( XBT_LOG(prio, "%s %s: %s", context, name.get(), exception.what()); // Do we have a backtrace? - if (with_context != nullptr && not xbt_cfg_get_boolean("exception/cutpath")) { + if (with_context != nullptr && not simgrid::config::get_config("exception/cutpath")) { auto backtrace = simgrid::xbt::resolveBacktrace( with_context->backtrace().data(), with_context->backtrace().size()); for (std::string const& s : backtrace) @@ -74,7 +74,7 @@ void logException( static void showBacktrace(std::vector& bt) { - if (xbt_cfg_get_boolean("exception/cutpath")) { + if (simgrid::config::get_config("exception/cutpath")) { XBT_LOG(xbt_log_priority_critical, "Display of current backtrace disabled by --cfg=exception/cutpath."); return; } -- 2.20.1