From eb650ffefc6fb7d05ad74b4d5f79f402f4b7f878 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 6 Jul 2017 12:06:54 +0200 Subject: [PATCH] s4u: implement Engine::setConfig() --- doc/doxygen/options.doc | 2 +- include/simgrid/s4u/Engine.hpp | 9 +++++++++ src/s4u/s4u_engine.cpp | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/doxygen/options.doc b/doc/doxygen/options.doc index 1e11522fcc..879a1bf683 100644 --- a/doc/doxygen/options.doc +++ b/doc/doxygen/options.doc @@ -42,7 +42,7 @@ file: A last solution is to pass your configuration directly using the C interface. If you happen to use the MSG interface, this is very easy -with the MSG_config() function. If you do not use MSG, that's a bit +with the simgrid::s4u::Engine::setConfig() or MSG_config() functions. If you do not use MSG, that's a bit more complex, as you have to mess with the internal configuration set directly as follows. Check the \ref XBT_config "relevant page" for details on all the functions you can use in this context, \c diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index feef402dcb..a42becaef6 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -100,6 +100,15 @@ public: /** Returns whether SimGrid was initialized yet -- mostly for internal use */ static bool isInitialized(); + /** @brief set a configuration variable + * + * Do --help on any simgrid binary to see the list of currently existing configuration variables (see @ref options). + * + * Example: + * e->setConfig("host/model","ptask_L07"); + */ + void setConfig(std::string str); + simgrid::kernel::EngineImpl* pimpl; private: diff --git a/src/s4u/s4u_engine.cpp b/src/s4u/s4u_engine.cpp index 2e7de0a7d3..0e983e8ffe 100644 --- a/src/s4u/s4u_engine.cpp +++ b/src/s4u/s4u_engine.cpp @@ -158,5 +158,9 @@ bool Engine::isInitialized() { return Engine::instance_ != nullptr; } +void Engine::setConfig(std::string str) +{ + xbt_cfg_set_parse(str.c_str()); +} } } // namespace -- 2.20.1