public:
explicit VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
- void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
+ void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, const std::string& coord);
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
// deprecated
class XBT_PRIVATE Coords {
public:
static simgrid::xbt::Extension<NetPoint, Coords> EXTENSION_ID;
- explicit Coords(NetPoint* host, std::string str);
+ explicit Coords(NetPoint* host, const std::string& str);
virtual ~Coords() = default;
std::vector<double> coords;
sg_size_t tell(); /** Retrieves the current file position */
/** Rename a file. WARNING: It is forbidden to move the file to another mount point */
- void move(std::string fullpath);
+ void move(const std::string& fullpath);
int remote_copy(sg_host_t host, const char* fullpath);
int remote_move(sg_host_t host, const char* fullpath);
static simgrid::xbt::Extension<Storage, FileSystemStorageExt> EXTENSION_ID;
explicit FileSystemStorageExt(Storage* ptr);
~FileSystemStorageExt();
- std::map<std::string, sg_size_t>* parse_content(std::string filename);
+ std::map<std::string, sg_size_t>* parse_content(const std::string& filename);
std::map<std::string, sg_size_t>* get_content() { return content_; }
sg_size_t get_size() { return size_; }
sg_size_t get_used_size() { return used_size_; }
}
// Create actor from function name:
- static ActorPtr create(std::string name, s4u::Host* host, std::string function, std::vector<std::string> args);
+ static ActorPtr create(std::string name, s4u::Host* host, const std::string& function, std::vector<std::string> args);
// ***** Methods *****
/** This actor will be automatically terminated when the last non-daemon actor finishes **/
/** Retrieve the property value (or nullptr if not set) */
std::unordered_map<std::string, std::string>*
get_properties(); // FIXME: do not export the map, but only the keys or something
- const char* get_property(std::string key);
- void set_property(std::string key, std::string value);
+ const char* get_property(const std::string& key);
+ void set_property(const std::string& key, std::string value);
#ifndef DOXYGEN
XBT_ATTRIB_DEPRECATED_v325("Please use Actor::by_pid(pid).kill() instead") static void kill(aid_t pid);
* The environment is either a XML file following the simgrid.dtd formalism, or a lua file.
* Some examples can be found in the directory examples/platforms.
*/
- void load_platform(std::string platf);
+ void load_platform(const std::string& platf);
/** Registers the main function of an actor that will be launched from the deployment file */
- void register_function(std::string name, int (*code)(int, char**));
+ void register_function(const std::string& name, int (*code)(int, char**));
/** Registers the main function of an actor that will be launched from the deployment file */
- void register_function(std::string name, void (*code)(std::vector<std::string>));
+ void register_function(const std::string& name, void (*code)(std::vector<std::string>));
/** Registers a function as the default main function of actors
*
*/
void register_default(int (*code)(int, char**));
- template <class F> void register_actor(std::string name)
+ template <class F> void register_actor(const std::string& name)
{
simgrid::simix::register_function(name, [](std::vector<std::string> args) {
return simgrid::simix::ActorCode([args] {
});
}
- template <class F> void register_actor(std::string name, F code)
+ template <class F> void register_actor(const std::string& name, F code)
{
simgrid::simix::register_function(name, [code](std::vector<std::string> args) {
return simgrid::simix::ActorCode([code, args] { code(std::move(args)); });
}
/** @brief Load a deployment file and launch the actors that it contains */
- void load_deployment(std::string deploy);
+ void load_deployment(const std::string& deploy);
protected:
#ifndef DOXYGEN
friend kernel::routing::NetPoint;
friend kernel::routing::NetZoneImpl;
friend kernel::resource::LinkImpl;
- void host_register(std::string name, Host* host);
- void host_unregister(std::string name);
- void link_register(std::string name, Link* link);
- void link_unregister(std::string name);
- void storage_register(std::string name, Storage* storage);
- void storage_unregister(std::string name);
+ void host_register(const std::string& name, Host* host);
+ void host_unregister(const std::string& name);
+ void link_register(const std::string& name, Link* link);
+ void link_unregister(const std::string& name);
+ void storage_register(const std::string& name, Storage* storage);
+ void storage_unregister(const std::string& name);
void netpoint_register(simgrid::kernel::routing::NetPoint* card);
void netpoint_unregister(simgrid::kernel::routing::NetPoint* card);
#endif /*DOXYGEN*/
/** @brief Returns the list of all hosts found in the platform */
std::vector<Host*> get_all_hosts();
std::vector<Host*> get_filtered_hosts(std::function<bool(Host*)> filter);
- simgrid::s4u::Host* host_by_name(std::string name);
- simgrid::s4u::Host* host_by_name_or_null(std::string name);
+ simgrid::s4u::Host* host_by_name(const std::string& name);
+ simgrid::s4u::Host* host_by_name_or_null(const std::string& name);
size_t get_link_count();
std::vector<Link*> get_all_links();
std::vector<Link*> get_filtered_links(std::function<bool(Link*)> filter);
- simgrid::s4u::Link* link_by_name(std::string name);
- simgrid::s4u::Link* link_by_name_or_null(std::string name);
+ simgrid::s4u::Link* link_by_name(const std::string& name);
+ simgrid::s4u::Link* link_by_name_or_null(const std::string& name);
size_t get_actor_count();
std::vector<ActorPtr> get_all_actors();
size_t get_storage_count();
std::vector<Storage*> get_all_storages();
- simgrid::s4u::Storage* storage_by_name(std::string name);
- simgrid::s4u::Storage* storage_by_name_or_null(std::string name);
+ simgrid::s4u::Storage* storage_by_name(const std::string& name);
+ simgrid::s4u::Storage* storage_by_name_or_null(const std::string& name);
std::vector<simgrid::kernel::routing::NetPoint*> get_all_netpoints();
- simgrid::kernel::routing::NetPoint* netpoint_by_name_or_null(std::string name);
+ simgrid::kernel::routing::NetPoint* netpoint_by_name_or_null(const std::string& name);
simgrid::s4u::NetZone* get_netzone_root();
void set_netzone_root(s4u::NetZone* netzone);
- simgrid::s4u::NetZone* netzone_by_name_or_null(std::string name);
+ simgrid::s4u::NetZone* netzone_by_name_or_null(const std::string& name);
/** @brief Retrieves all netzones of the type indicated by the template argument */
template <class T> std::vector<T*> get_filtered_netzones()
Host& operator=(Host const&) = delete;
/** Retrieve a host from its name, or return nullptr */
- static Host* by_name_or_null(std::string name);
+ static Host* by_name_or_null(const std::string& name);
/** Retrieve a host from its name, or die */
- static s4u::Host* by_name(std::string name);
+ static s4u::Host* by_name(const std::string& name);
/** Retrieves the host on which the running actor is located */
static s4u::Host* current();
/** Returns if that host is currently down and offline */
XBT_ATTRIB_DEPRECATED_v325("Please use !is_on()") bool is_off() const { return not is_on(); }
- const char* get_property(std::string key) const;
- void set_property(std::string key, std::string value);
+ const char* get_property(const std::string& key) const;
+ void set_property(const std::string& key, std::string value);
std::unordered_map<std::string, std::string>* get_properties();
void set_state_profile(kernel::profile::Profile* p);
kernel::resource::LinkImpl* get_impl() { return pimpl_; }
/** @brief Retrieve a link from its name */
- static Link* by_name(std::string name);
- static Link* by_name_or_null(std::string name);
+ static Link* by_name(const std::string& name);
+ static Link* by_name_or_null(const std::string& name);
/** @brief Retrieves the name of that link as a C++ string */
const std::string& get_name() const;
* The profile must contain absolute values */
void set_latency_profile(kernel::profile::Profile* profile);
- const char* get_property(std::string key);
- void set_property(std::string key, std::string value);
+ const char* get_property(const std::string& key);
+ void set_property(const std::string& key, std::string value);
/* The signals */
/** @brief Callback signal fired when a new Link is created */
const char* get_cname() const;
/** Retrieve the mailbox associated to the given name */
- static MailboxPtr by_name(std::string name);
+ static MailboxPtr by_name(const std::string& name);
/** Returns whether the mailbox contains queued communications */
bool empty();
std::vector<NetZone*> get_children();
/** Retrieve the property value (or nullptr if not set) */
- const char* get_property(std::string key);
- void set_property(std::string key, std::string value);
+ const char* get_property(const std::string& key);
+ void set_property(const std::string& key, std::string value);
/* Add content to the netzone, at parsing time. It should be sealed afterward. */
int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */
static simgrid::xbt::signal<void(s4u::Storage&)> on_state_change;
/** Retrieve a Storage by its name. It must exist in the platform file */
- static Storage* by_name(std::string name);
- static Storage* by_name_or_null(std::string name);
+ static Storage* by_name(const std::string& name);
+ static Storage* by_name_or_null(const std::string& name);
/** @brief Retrieves the name of that storage as a C++ string */
std::string const& get_name() const { return name_; }
void set_host(Host* host) { attached_to_ = host; }
std::unordered_map<std::string, std::string>* get_properties();
- const char* get_property(std::string key);
- void set_property(std::string, std::string value);
+ const char* get_property(const std::string& key);
+ void set_property(const std::string&, std::string value);
void set_data(void* data) { userdata_ = data; }
void* get_data() { return userdata_; }
SG_END_DECL()
#ifdef __cplusplus
-XBT_PUBLIC void SIMIX_function_register(std::string name, void (*code)(std::vector<std::string>));
-XBT_PUBLIC void SIMIX_function_register(std::string name, xbt_main_func_t code);
-XBT_PUBLIC void SIMIX_launch_application(std::string file);
+XBT_PUBLIC void SIMIX_function_register(const std::string& name, void (*code)(std::vector<std::string>));
+XBT_PUBLIC void SIMIX_function_register(const std::string& name, xbt_main_func_t code);
+XBT_PUBLIC void SIMIX_launch_application(const std::string& file);
#endif
/*********************************** Host *************************************/
#ifdef __cplusplus
XBT_ATTRIB_DEPRECATED_v325("Please use Exec::start()") XBT_PUBLIC smx_activity_t
- simcall_execution_start(std::string name, std::string category, double flops_amount, double priority, double bound,
- sg_host_t host);
+ simcall_execution_start(const std::string& name, const std::string& category, double flops_amount, double priority,
+ double bound, sg_host_t host);
#endif
#endif
// Create an ActorCode based on a std::string
typedef std::function<ActorCode(std::vector<std::string> args)> ActorCodeFactory;
-XBT_PUBLIC void register_function(std::string name, ActorCodeFactory factory);
+XBT_PUBLIC void register_function(const std::string& name, ActorCodeFactory factory);
}
}
class ActionArgParser {
public:
virtual ~ActionArgParser() = default;
- virtual void parse(simgrid::xbt::ReplayAction& action, std::string name) { CHECK_ACTION_PARAMS(action, 0, 0) }
+ virtual void parse(simgrid::xbt::ReplayAction& action, const std::string& name) { CHECK_ACTION_PARAMS(action, 0, 0) }
};
class WaitTestParser : public ActionArgParser {
int dst;
int tag;
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class SendRecvParser : public ActionArgParser {
int tag;
MPI_Datatype datatype1 = MPI_DEFAULT_TYPE;
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class ComputeParser : public ActionArgParser {
/* communication partner; if we send, this is the receiver and vice versa */
double flops;
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class CollCommParser : public ActionArgParser {
class BcastArgParser : public CollCommParser {
public:
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class ReduceArgParser : public CollCommParser {
public:
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class AllReduceArgParser : public CollCommParser {
public:
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class AllToAllArgParser : public CollCommParser {
public:
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class GatherArgParser : public CollCommParser {
public:
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class GatherVArgParser : public CollCommParser {
int recv_size_sum;
std::shared_ptr<std::vector<int>> recvcounts;
std::vector<int> disps;
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class ScatterArgParser : public CollCommParser {
public:
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class ScatterVArgParser : public CollCommParser {
int send_size_sum;
std::shared_ptr<std::vector<int>> sendcounts;
std::vector<int> disps;
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class ReduceScatterArgParser : public CollCommParser {
int recv_size_sum;
std::shared_ptr<std::vector<int>> recvcounts;
std::vector<int> disps;
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
class AllToAllVArgParser : public CollCommParser {
std::vector<int> recvdisps;
int send_buf_size;
int recv_buf_size;
- void parse(simgrid::xbt::ReplayAction& action, std::string name) override;
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
/**
// Get config
-template <class T> XBT_PUBLIC T const& get_value(std::string name);
+template <class T> XBT_PUBLIC T const& get_value(const std::string& name);
-extern template XBT_PUBLIC int const& get_value<int>(std::string name);
-extern template XBT_PUBLIC double const& get_value<double>(std::string name);
-extern template XBT_PUBLIC bool const& get_value<bool>(std::string name);
-extern template XBT_PUBLIC std::string const& get_value<std::string>(std::string name);
+extern template XBT_PUBLIC int const& get_value<int>(const std::string& name);
+extern template XBT_PUBLIC double const& get_value<double>(const std::string& name);
+extern template XBT_PUBLIC bool const& get_value<bool>(const std::string& name);
+extern template XBT_PUBLIC std::string const& get_value<std::string>(const std::string& name);
// Register:
* @param callback called with the option value
*/
template <class T>
-XBT_PUBLIC void declare_flag(std::string name, std::string description, T value,
+XBT_PUBLIC void declare_flag(const std::string& name, std::string description, T value,
std::function<void(const T&)> callback = std::function<void(const T&)>());
-extern template XBT_PUBLIC void declare_flag(std::string name, std::string description, int value,
+extern template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, int value,
std::function<void(int const&)> callback);
-extern template XBT_PUBLIC void declare_flag(std::string name, std::string description, double value,
+extern template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, double value,
std::function<void(double const&)> callback);
-extern template XBT_PUBLIC void declare_flag(std::string name, std::string description, bool value,
+extern template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, bool value,
std::function<void(bool const&)> callback);
-extern template XBT_PUBLIC void declare_flag(std::string name, std::string description, std::string value,
+extern template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, std::string value,
std::function<void(std::string const&)> callback);
// ***** alias *****
return id;
}
-void jxbt_throw_by_name(JNIEnv* env, const char* name, std::string msg)
+void jxbt_throw_by_name(JNIEnv* env, const char* name, const std::string& msg)
{
jclass cls = env->FindClass(name);
env->ThrowNew(cls, msg.c_str());
}
-void jxbt_throw_jni(JNIEnv* env, std::string msg)
+void jxbt_throw_jni(JNIEnv* env, const std::string& msg)
{
jxbt_throw_by_name(env, "org/simgrid/msg/JniException", "Internal or JNI error: " + msg);
}
-void jxbt_throw_notbound(JNIEnv* env, std::string kind, void* pointer)
+void jxbt_throw_notbound(JNIEnv* env, const std::string& kind, void* pointer)
{
jxbt_throw_by_name(env, "org/simgrid/msg/JniException",
"Internal error: " + kind + " " + static_cast<const char*>(pointer) + " not bound");
}
-void jxbt_throw_null(JNIEnv* env, std::string msg)
+void jxbt_throw_null(JNIEnv* env, const std::string& msg)
{
jxbt_throw_by_name(env, "java/lang/NullPointerException", msg);
}
-void jxbt_throw_illegal(JNIEnv* env, std::string msg)
+void jxbt_throw_illegal(JNIEnv* env, const std::string& msg)
{
jxbt_throw_by_name(env, "java/lang/IllegalArgumentException", msg);
}
-void jxbt_throw_host_not_found(JNIEnv* env, std::string invalid_name)
+void jxbt_throw_host_not_found(JNIEnv* env, const std::string& invalid_name)
{
jxbt_throw_by_name(env, "org/simgrid/msg/HostNotFoundException", "No such host: " + invalid_name);
}
-void jxbt_throw_storage_not_found(JNIEnv* env, std::string invalid_name)
+void jxbt_throw_storage_not_found(JNIEnv* env, const std::string& invalid_name)
{
jxbt_throw_by_name(env, "org/simgrid/msg/StorageNotFoundException", "No such storage: " + invalid_name);
}
-void jxbt_throw_process_not_found(JNIEnv* env, std::string invalid_name)
+void jxbt_throw_process_not_found(JNIEnv* env, const std::string& invalid_name)
{
jxbt_throw_by_name(env, "org/simgrid/msg/ProcessNotFoundException", "No such process: " + invalid_name);
}
-void jxbt_throw_transfer_failure(JNIEnv* env, std::string details)
+void jxbt_throw_transfer_failure(JNIEnv* env, const std::string& details)
{
jxbt_throw_by_name(env, "org/simgrid/msg/TransferFailureException", details);
}
-void jxbt_throw_host_failure(JNIEnv* env, std::string details)
+void jxbt_throw_host_failure(JNIEnv* env, const std::string& details)
{
jxbt_throw_by_name(env, "org/simgrid/msg/HostFailureException", "Host Failure " + details);
}
-void jxbt_throw_time_out_failure(JNIEnv* env, std::string details)
+void jxbt_throw_time_out_failure(JNIEnv* env, const std::string& details)
{
jxbt_throw_by_name(env, "org/simgrid/msg/TimeoutException", details);
}
-void jxbt_throw_task_cancelled(JNIEnv* env, std::string details)
+void jxbt_throw_task_cancelled(JNIEnv* env, const std::string& details)
{
jxbt_throw_by_name(env, "org/simgrid/msg/TaskCancelledException", details);
}
} while (0)
/* Throws an exception according to its name */
-void jxbt_throw_by_name(JNIEnv* env, const char* name, std::string msg);
+void jxbt_throw_by_name(JNIEnv* env, const char* name, const std::string& msg);
/** Thrown on internal error of this layer, or on problem with JNI */
-void jxbt_throw_jni(JNIEnv* env, std::string msg);
+void jxbt_throw_jni(JNIEnv* env, const std::string& msg);
/** Thrown when using an object not bound to a native one where it should, or reverse (kinda JNI issue) */
-void jxbt_throw_notbound(JNIEnv* env, std::string kind, void* pointer);
+void jxbt_throw_notbound(JNIEnv* env, const std::string& kind, void* pointer);
/** Thrown if NULL gets used */
-void jxbt_throw_null(JNIEnv* env, std::string msg);
+void jxbt_throw_null(JNIEnv* env, const std::string& msg);
/** Thrown on illegal arguments */
-void jxbt_throw_illegal(JNIEnv* env, std::string msg);
+void jxbt_throw_illegal(JNIEnv* env, const std::string& msg);
/** Thrown when looking for a host from name does not lead to anything */
-void jxbt_throw_host_not_found(JNIEnv* env, std::string invalid_name);
+void jxbt_throw_host_not_found(JNIEnv* env, const std::string& invalid_name);
/** Thrown when looking for a host from name does not lead to anything */
-void jxbt_throw_process_not_found(JNIEnv* env, std::string invalid_name);
+void jxbt_throw_process_not_found(JNIEnv* env, const std::string& invalid_name);
/** Thrown when a transfer failure accure while Sending task */
-void jxbt_throw_transfer_failure(JNIEnv* env, std::string detail);
+void jxbt_throw_transfer_failure(JNIEnv* env, const std::string& detail);
/** Thrown when a host failure occurs while Sending a task*/
-void jxbt_throw_host_failure(JNIEnv* env, std::string details);
+void jxbt_throw_host_failure(JNIEnv* env, const std::string& details);
/** Thrown when a timeout occurs while Sending a task */
-void jxbt_throw_time_out_failure(JNIEnv* env, std::string details);
+void jxbt_throw_time_out_failure(JNIEnv* env, const std::string& details);
/**Thrown when a task is canceled */
-void jxbt_throw_task_cancelled(JNIEnv* env, std::string details);
+void jxbt_throw_task_cancelled(JNIEnv* env, const std::string& details);
/** Thrown when looking for a storage from name does not lead to anything */
-void jxbt_throw_storage_not_found(JNIEnv* env, std::string invalid_name);
+void jxbt_throw_storage_not_found(JNIEnv* env, const std::string& invalid_name);
#endif
":cpp:func:`simgrid::s4u::Engine::load_deployment()`")
.def("run", &Engine::run, "Run the simulation")
.def("register_actor",
- [pyStopRequestEx](Engine*, std::string name, py::object fun_or_class) {
+ [pyStopRequestEx](Engine*, const std::string& name, py::object fun_or_class) {
simgrid::simix::register_function(
name, [pyStopRequestEx, fun_or_class](std::vector<std::string> args) -> simgrid::simix::ActorCode {
return [pyStopRequestEx, fun_or_class, args]() {
XBT_PUBLIC void surf_exit();
/* surf parse file related (public because called from a test suite) */
-XBT_PUBLIC void parse_platform_file(std::string file);
+XBT_PUBLIC void parse_platform_file(const std::string& file);
#endif
new Container(std::move(name), std::move(type_name), this);
}
-Container* Container::by_name_or_null(std::string name)
+Container* Container::by_name_or_null(const std::string& name)
{
auto cont = allContainers.find(name);
return cont == allContainers.end() ? nullptr : cont->second;
}
-Container* Container::by_name(std::string name)
+Container* Container::by_name(const std::string& name)
{
Container* ret = Container::by_name_or_null(name);
xbt_assert(ret != nullptr, "container with name %s not found", name.c_str());
}
}
-StateType* Container::get_state(std::string name)
+StateType* Container::get_state(const std::string& name)
{
StateType* ret = dynamic_cast<StateType*>(type_->by_name(name));
ret->set_calling_container(this);
return ret;
}
-LinkType* Container::get_link(std::string name)
+LinkType* Container::get_link(const std::string& name)
{
LinkType* ret = dynamic_cast<LinkType*>(type_->by_name(name));
ret->set_calling_container(this);
return ret;
}
-VariableType* Container::get_variable(std::string name)
+VariableType* Container::get_variable(const std::string& name)
{
VariableType* ret = dynamic_cast<VariableType*>(type_->by_name(name));
ret->set_calling_container(this);
std::map<std::string, Container*> children_;
kernel::routing::NetPoint* netpoint_ = nullptr;
- static Container* by_name_or_null(std::string name);
- static Container* by_name(std::string name);
+ static Container* by_name_or_null(const std::string& name);
+ static Container* by_name(const std::string& name);
std::string get_name() { return name_; }
const char* get_cname() { return name_.c_str(); }
long long int get_id() { return id_; }
void log_creation();
void log_destruction();
- StateType* get_state(std::string name);
- LinkType* get_link(std::string name);
- VariableType* get_variable(std::string name);
+ StateType* get_state(const std::string& name);
+ LinkType* get_link(const std::string& name);
+ VariableType* get_variable(const std::string& name);
void create_child(std::string name, std::string type_name);
static Container* get_root();
};
static std::vector<simgrid::instr::PajeEvent*> buffer;
-void dump_comment(std::string comment)
+void dump_comment(const std::string& comment)
{
if (not comment.empty())
tracing_file << "# " << comment << std::endl;
}
-void dump_comment_file(std::string filename)
+void dump_comment_file(const std::string& filename)
{
if (filename.empty())
return;
delete elm.second;
}
-ContainerType::ContainerType(std::string name, Type* father) : Type(name, name, "", father)
+ContainerType::ContainerType(const std::string& name, Type* father) : Type(name, name, "", father)
{
XBT_DEBUG("ContainerType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id());
log_definition(PAJE_DefineContainerType);
events_.clear();
}
-void StateType::set_event(std::string value_name)
+void StateType::set_event(const std::string& value_name)
{
events_.push_back(new StateEvent(issuer_, this, PAJE_SetState, get_entity_value(value_name), nullptr));
}
-void StateType::push_event(std::string value_name, TIData* extra)
+void StateType::push_event(const std::string& value_name, TIData* extra)
{
events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, get_entity_value(value_name), extra));
}
-void StateType::push_event(std::string value_name)
+void StateType::push_event(const std::string& value_name)
{
events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, get_entity_value(value_name), nullptr));
}
events_.push_back(new StateEvent(issuer_, this, PAJE_PopState, nullptr, extra));
}
-VariableType::VariableType(std::string name, std::string color, Type* father)
+VariableType::VariableType(const std::string& name, std::string color, Type* father)
: Type(name, name, std::move(color), father)
{
XBT_DEBUG("VariableType %s(%lld), child of %s(%lld)", get_cname(), get_id(), father->get_cname(), father->get_id());
tracing_file << stream_.str() << std::endl;
}
-Type* Type::by_name(std::string name)
+Type* Type::by_name(const std::string& name)
{
Type* ret = nullptr;
for (auto elm : children_) {
return ret;
}
-void ValueType::add_entity_value(std::string name)
+void ValueType::add_entity_value(const std::string& name)
{
add_entity_value(name, "");
}
-void ValueType::add_entity_value(std::string name, std::string color)
+void ValueType::add_entity_value(const std::string& name, std::string color)
{
if (name.empty())
THROWF(tracing_error, 0, "can't get a value with no name");
}
}
-EntityValue* ValueType::get_entity_value(std::string name)
+EntityValue* ValueType::get_entity_value(const std::string& name)
{
auto ret = values_.find(name);
if (ret == values_.end()) {
return ret->second;
}
-VariableType* Type::by_name_or_create(std::string name, std::string color)
+VariableType* Type::by_name_or_create(const std::string& name, std::string color)
{
auto cont = children_.find(name);
std::string mycolor = color.empty() ? "1 1 1" : std::move(color);
: static_cast<VariableType*>(cont->second);
}
-LinkType* Type::by_name_or_create(std::string name, Type* source, Type* dest)
+LinkType* Type::by_name_or_create(const std::string& name, Type* source, Type* dest)
{
std::string alias = name + "-" + std::to_string(source->id_) + "-" + std::to_string(dest->id_);
auto it = children_.find(alias);
long long int get_id() { return id_; }
bool is_colored() { return not color_.empty(); }
- Type* by_name(std::string name);
- LinkType* by_name_or_create(std::string name, Type* source, Type* dest);
- VariableType* by_name_or_create(std::string name, std::string color);
+ Type* by_name(const std::string& name);
+ LinkType* by_name_or_create(const std::string& name, Type* source, Type* dest);
+ VariableType* by_name_or_create(const std::string& name, std::string color);
- template <class T> T* by_name_or_create(std::string name)
+ template <class T> T* by_name_or_create(const std::string& name)
{
auto cont = children_.find(name);
return cont == children_.end() ? new T(name, this) : static_cast<T*>(cont->second);
class ContainerType : public Type {
public:
- explicit ContainerType(std::string name) : Type(name, name, "", nullptr){};
- ContainerType(std::string name, Type* father);
+ explicit ContainerType(const std::string& name) : Type(name, name, "", nullptr){};
+ ContainerType(const std::string& name, Type* father);
};
class VariableType : public Type {
std::vector<VariableEvent*> events_;
public:
- VariableType(std::string name, std::string color, Type* father);
+ VariableType(const std::string& name, std::string color, Type* father);
~VariableType();
void instr_event(double now, double delta, const char* resource, double value);
void set_event(double timestamp, double value);
public:
std::map<std::string, EntityValue*> values_;
ValueType(std::string name, std::string alias, Type* father) : Type(std::move(name), std::move(alias), "", father){};
- ValueType(std::string name, Type* father) : Type(name, name, "", father){};
+ ValueType(const std::string& name, Type* father) : Type(name, name, "", father){};
virtual ~ValueType();
- void add_entity_value(std::string name, std::string color);
- void add_entity_value(std::string name);
- EntityValue* get_entity_value(std::string name);
+ void add_entity_value(const std::string& name, std::string color);
+ void add_entity_value(const std::string& name);
+ EntityValue* get_entity_value(const std::string& name);
};
class LinkType : public ValueType {
public:
StateType(std::string name, Type* father);
~StateType();
- void set_event(std::string value_name);
- void push_event(std::string value_name);
- void push_event(std::string value_name, TIData* extra);
+ void set_event(const std::string& value_name);
+ void push_event(const std::string& value_name);
+ void push_event(const std::string& value_name, TIData* extra);
void pop_event();
void pop_event(TIData* extra);
};
/*
* user categories support
*/
-static void recursiveNewVariableType(std::string new_typename, std::string color, simgrid::instr::Type* root)
+static void recursiveNewVariableType(const std::string& new_typename, const std::string& color,
+ simgrid::instr::Type* root)
{
if (root->get_name() == "HOST" || root->get_name() == "VM")
root->by_name_or_create(std::string("p") + new_typename, color);
}
}
-void instr_new_variable_type(std::string new_typename, std::string color)
+void instr_new_variable_type(const std::string& new_typename, const std::string& color)
{
recursiveNewVariableType(new_typename, color, simgrid::instr::Container::get_root()->type_);
}
-static void recursiveNewUserVariableType(std::string father_type, std::string new_typename, std::string color,
- simgrid::instr::Type* root)
+static void recursiveNewUserVariableType(const std::string& father_type, const std::string& new_typename,
+ const std::string& color, simgrid::instr::Type* root)
{
if (root->get_name() == father_type) {
root->by_name_or_create(new_typename, color);
recursiveNewUserVariableType(father_type, new_typename, color, elm.second);
}
-void instr_new_user_variable_type(std::string father_type, std::string new_typename, std::string color)
+void instr_new_user_variable_type(const std::string& father_type, const std::string& new_typename,
+ const std::string& color)
{
recursiveNewUserVariableType(father_type, new_typename, color, simgrid::instr::Container::get_root()->type_);
}
-static void recursiveNewUserStateType(std::string father_type, std::string new_typename, simgrid::instr::Type* root)
+static void recursiveNewUserStateType(const std::string& father_type, const std::string& new_typename,
+ simgrid::instr::Type* root)
{
if (root->get_name() == father_type)
root->by_name_or_create<simgrid::instr::StateType>(new_typename);
recursiveNewUserStateType(father_type, new_typename, elm.second);
}
-void instr_new_user_state_type(std::string father_type, std::string new_typename)
+void instr_new_user_state_type(const std::string& father_type, const std::string& new_typename)
{
recursiveNewUserStateType(father_type, new_typename, simgrid::instr::Container::get_root()->type_);
}
-static void recursiveNewValueForUserStateType(std::string type_name, const char* val, std::string color,
+static void recursiveNewValueForUserStateType(const std::string& type_name, const char* val, const std::string& color,
simgrid::instr::Type* root)
{
if (root->get_name() == type_name)
recursiveNewValueForUserStateType(type_name, val, color, elm.second);
}
-void instr_new_value_for_user_state_type(std::string type_name, const char* value, std::string color)
+void instr_new_value_for_user_state_type(const std::string& type_name, const char* value, const std::string& color)
{
recursiveNewValueForUserStateType(type_name, value, color, simgrid::instr::Container::get_root()->type_);
}
XBT_PUBLIC bool TRACE_smpi_view_internals();
XBT_PRIVATE void TRACE_surf_resource_set_utilization(const char* type, const char* name, const char* resource,
- std::string category, double value, double now, double delta);
+ const std::string& category, double value, double now,
+ double delta);
/* instr_paje.c */
extern XBT_PRIVATE std::set<std::string> trivaNodeTypes;
extern XBT_PRIVATE std::set<std::string> trivaEdgeTypes;
XBT_PRIVATE long long int instr_new_paje_id();
XBT_PRIVATE void instr_define_callbacks();
-void instr_new_variable_type(std::string new_typename, std::string color);
-void instr_new_user_variable_type(std::string father_type, std::string new_typename, std::string color);
-void instr_new_user_state_type(std::string father_type, std::string new_typename);
-void instr_new_value_for_user_state_type(std::string new_typename, const char* value, std::string color);
+void instr_new_variable_type(const std::string& new_typename, const std::string& color);
+void instr_new_user_variable_type(const std::string& father_type, const std::string& new_typename,
+ const std::string& color);
+void instr_new_user_state_type(const std::string& father_type, const std::string& new_typename);
+void instr_new_value_for_user_state_type(const std::string& new_typename, const char* value, const std::string& color);
XBT_PRIVATE void TRACE_global_init();
XBT_PRIVATE void TRACE_help();
XBT_PRIVATE void TRACE_paje_dump_buffer(bool force);
-XBT_PRIVATE void dump_comment_file(std::string filename);
-XBT_PRIVATE void dump_comment(std::string comment);
+XBT_PRIVATE void dump_comment_file(const std::string& filename);
+XBT_PRIVATE void dump_comment(const std::string& comment);
XBT_PRIVATE std::string TRACE_get_filename();
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_resource, instr, "tracing (un)-categorized resource utilization");
-void TRACE_surf_resource_set_utilization(const char* type, const char* name, const char* resource, std::string category,
- double value, double now, double delta)
+void TRACE_surf_resource_set_utilization(const char* type, const char* name, const char* resource,
+ const std::string& category, double value, double now, double delta)
{
// only trace resource utilization if resource is known by tracing mechanism
container_t container = simgrid::instr::Container::by_name_or_null(resource);
namespace kernel {
namespace activity {
/** @brief Returns the mailbox of that name, or nullptr */
-MailboxImpl* MailboxImpl::by_name_or_null(std::string name)
+MailboxImpl* MailboxImpl::by_name_or_null(const std::string& name)
{
auto mbox = mailboxes->find(name);
if (mbox != mailboxes->end())
return nullptr;
}
/** @brief Returns the mailbox of that name, newly created on need */
-MailboxImpl* MailboxImpl::by_name_or_create(std::string name)
+MailboxImpl* MailboxImpl::by_name_or_create(const std::string& name)
{
/* two processes may have pushed the same mbox_create simcall at the same time */
auto m = mailboxes->find(name);
class MailboxImpl {
friend s4u::Mailbox;
- friend s4u::MailboxPtr s4u::Mailbox::by_name(std::string name);
+ friend s4u::MailboxPtr s4u::Mailbox::by_name(const std::string& name);
friend mc::CommunicationDeterminismChecker;
explicit MailboxImpl(std::string name)
public:
const simgrid::xbt::string& get_name() const { return name_; }
const char* get_cname() const { return name_.c_str(); }
- static MailboxImpl* by_name_or_null(std::string name);
- static MailboxImpl* by_name_or_create(std::string name);
+ static MailboxImpl* by_name_or_null(const std::string& name);
+ static MailboxImpl* by_name_or_create(const std::string& name);
void set_receiver(s4u::ActorPtr actor);
void push(activity::CommImplPtr comm);
void remove(smx_activity_t activity);
*/
public:
StopRequest() = default;
- explicit StopRequest(std::string msg) : msg_(std::string("Actor killed (") + msg + std::string(").")) {}
+ explicit StopRequest(const std::string& msg) : msg_(std::string("Actor killed (") + msg + std::string(").")) {}
~StopRequest();
const char* what() const noexcept { return msg_.c_str(); }
XBT_PRIVATE void SIMIX_post_create_environment();
-XBT_PRIVATE simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(std::string name);
+XBT_PRIVATE simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(const std::string& name);
#endif
return dateVal;
}
-Profile* Profile::from_string(std::string name, std::string input, double periodicity)
+Profile* Profile::from_string(const std::string& name, const std::string& input, double periodicity)
{
int linecount = 0;
simgrid::kernel::profile::Profile* profile = new simgrid::kernel::profile::Profile();
return profile;
}
-Profile* Profile::from_file(std::string path)
+Profile* Profile::from_file(const std::string& path)
{
xbt_assert(not path.empty(), "Cannot parse a trace from an empty filename");
xbt_assert(trace_list.find(path) == trace_list.end(), "Refusing to define trace %s twice", path.c_str());
Event* schedule(FutureEvtSet* fes, resource::Resource* resource);
DatedValue next(Event* event);
- static Profile* from_file(std::string path);
- static Profile* from_string(std::string name, std::string input, double periodicity);
+ static Profile* from_file(const std::string& path);
+ static Profile* from_string(const std::string& name, const std::string& input, double periodicity);
// private:
std::vector<DatedValue> event_list;
namespace vivaldi {
simgrid::xbt::Extension<NetPoint, Coords> Coords::EXTENSION_ID;
-Coords::Coords(NetPoint* netpoint, std::string coordStr)
+Coords::Coords(NetPoint* netpoint, const std::string& coordStr)
{
if (not Coords::EXTENSION_ID.valid())
Coords::EXTENSION_ID = NetPoint::extension_create<Coords>();
{
}
-void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string coord)
+void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, const std::string& coord)
{
xbt_assert(netpoint->get_englobing_zone() == this,
"Cannot add a peer link to a netpoint that is not in this netzone");
return current_position_;
}
-void File::move(std::string fullpath)
+void File::move(const std::string& fullpath)
{
/* Check if the new full path is on the same mount point */
if (not strncmp(mount_point_.c_str(), fullpath.c_str(), mount_point_.length())) {
delete content_;
}
-std::map<std::string, sg_size_t>* FileSystemStorageExt::parse_content(std::string filename)
+std::map<std::string, sg_size_t>* FileSystemStorageExt::parse_content(const std::string& filename)
{
if (filename.empty())
return nullptr;
return actor->iface();
}
-ActorPtr Actor::create(std::string name, s4u::Host* host, std::string function, std::vector<std::string> args)
+ActorPtr Actor::create(std::string name, s4u::Host* host, const std::string& function, std::vector<std::string> args)
{
simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
return create(std::move(name), host, factory(std::move(args)));
}
/** Retrieve the property value (or nullptr if not set) */
-const char* Actor::get_property(std::string key)
+const char* Actor::get_property(const std::string& key)
{
return simgrid::simix::simcall([this, key] { return pimpl_->get_property(key); });
}
-void Actor::set_property(std::string key, std::string value)
+void Actor::set_property(const std::string& key, std::string value)
{
simgrid::simix::simcall([this, key, value] { pimpl_->set_property(key, std::move(value)); });
}
*
* @include examples/platforms/small_platform.xml
*/
-void Engine::load_platform(std::string platf)
+void Engine::load_platform(const std::string& platf)
{
double start = xbt_os_time();
try {
XBT_DEBUG("PARSE TIME: %g", (end - start));
}
-void Engine::register_function(std::string name, int (*code)(int, char**))
+void Engine::register_function(const std::string& name, int (*code)(int, char**))
{
SIMIX_function_register(name, code);
}
-void Engine::register_function(std::string name, void (*code)(std::vector<std::string>))
+void Engine::register_function(const std::string& name, void (*code)(std::vector<std::string>))
{
SIMIX_function_register(name, code);
}
{
SIMIX_function_register_default(code);
}
-void Engine::load_deployment(std::string deploy)
+void Engine::load_deployment(const std::string& deploy)
{
SIMIX_launch_application(deploy);
}
return hosts;
}
-void Engine::host_register(std::string name, simgrid::s4u::Host* host)
+void Engine::host_register(const std::string& name, simgrid::s4u::Host* host)
{
pimpl->hosts_[name] = host;
}
-void Engine::host_unregister(std::string name)
+void Engine::host_unregister(const std::string& name)
{
pimpl->hosts_.erase(name);
}
*
* @throw std::invalid_argument if the searched host does not exist.
*/
-simgrid::s4u::Host* Engine::host_by_name(std::string name)
+simgrid::s4u::Host* Engine::host_by_name(const std::string& name)
{
if (pimpl->hosts_.find(name) == pimpl->hosts_.end())
throw std::invalid_argument(std::string("Host not found: '") + name + std::string("'"));
}
/** @brief Find a host from its name (or nullptr if that host does not exist) */
-simgrid::s4u::Host* Engine::host_by_name_or_null(std::string name)
+simgrid::s4u::Host* Engine::host_by_name_or_null(const std::string& name)
{
auto host = pimpl->hosts_.find(name);
return host == pimpl->hosts_.end() ? nullptr : host->second;
*
* @throw std::invalid_argument if the searched link does not exist.
*/
-simgrid::s4u::Link* Engine::link_by_name(std::string name)
+simgrid::s4u::Link* Engine::link_by_name(const std::string& name)
{
if (pimpl->links_.find(name) == pimpl->links_.end())
throw std::invalid_argument(std::string("Link not found: ") + name);
}
/** @brief Find an link from its name (or nullptr if that link does not exist) */
-simgrid::s4u::Link* Engine::link_by_name_or_null(std::string name)
+simgrid::s4u::Link* Engine::link_by_name_or_null(const std::string& name)
{
auto link = pimpl->links_.find(name);
return link == pimpl->links_.end() ? nullptr : link->second;
}
-void Engine::link_register(std::string name, simgrid::s4u::Link* link)
+void Engine::link_register(const std::string& name, simgrid::s4u::Link* link)
{
pimpl->links_[name] = link;
}
-void Engine::link_unregister(std::string name)
+void Engine::link_unregister(const std::string& name)
{
pimpl->links_.erase(name);
}
*
* @throw std::invalid_argument if the searched storage does not exist.
*/
-simgrid::s4u::Storage* Engine::storage_by_name(std::string name)
+simgrid::s4u::Storage* Engine::storage_by_name(const std::string& name)
{
if (pimpl->storages_.find(name) == pimpl->storages_.end())
throw std::invalid_argument(std::string("Storage not found: ") + name);
}
/** @brief Find a storage from its name (or nullptr if that storage does not exist) */
-simgrid::s4u::Storage* Engine::storage_by_name_or_null(std::string name)
+simgrid::s4u::Storage* Engine::storage_by_name_or_null(const std::string& name)
{
auto storage = pimpl->storages_.find(name);
return storage == pimpl->storages_.end() ? nullptr : storage->second;
}
-void Engine::storage_register(std::string name, simgrid::s4u::Storage* storage)
+void Engine::storage_register(const std::string& name, simgrid::s4u::Storage* storage)
{
pimpl->storages_[name] = storage;
}
-void Engine::storage_unregister(std::string name)
+void Engine::storage_unregister(const std::string& name)
{
pimpl->storages_.erase(name);
}
pimpl->netzone_root_ = netzone->get_impl();
}
-static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, std::string name)
+static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const std::string& name)
{
if (current->get_name() == name)
return current;
}
/** @brief Retrieve the NetZone of the given name (or nullptr if not found) */
-NetZone* Engine::netzone_by_name_or_null(std::string name)
+NetZone* Engine::netzone_by_name_or_null(const std::string& name)
{
return netzone_by_name_recursive(get_netzone_root(), name);
}
/** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
-simgrid::kernel::routing::NetPoint* Engine::netpoint_by_name_or_null(std::string name)
+simgrid::kernel::routing::NetPoint* Engine::netpoint_by_name_or_null(const std::string& name)
{
auto netp = pimpl->netpoints_.find(name);
return netp == pimpl->netpoints_.end() ? nullptr : netp->second;
}
}
-Host* Host::by_name(std::string name)
+Host* Host::by_name(const std::string& name)
{
return Engine::get_instance()->host_by_name(name);
}
-Host* Host::by_name_or_null(std::string name)
+Host* Host::by_name_or_null(const std::string& name)
{
return Engine::get_instance()->host_by_name_or_null(name);
}
}
/** Retrieve the property value (or nullptr if not set) */
-const char* Host::get_property(std::string key) const
+const char* Host::get_property(const std::string& key) const
{
return this->pimpl_->get_property(key);
}
-void Host::set_property(std::string key, std::string value)
+void Host::set_property(const std::string& key, std::string value)
{
simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, std::move(value)); });
}
simgrid::xbt::signal<void(kernel::resource::NetworkAction*, kernel::resource::Action::State)>
Link::on_communication_state_change;
-Link* Link::by_name(std::string name)
+Link* Link::by_name(const std::string& name)
{
return Engine::get_instance()->link_by_name(name);
}
-Link* Link::by_name_or_null(std::string name)
+Link* Link::by_name_or_null(const std::string& name)
{
return Engine::get_instance()->link_by_name_or_null(name);
}
simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); });
}
-const char* Link::get_property(std::string key)
+const char* Link::get_property(const std::string& key)
{
return this->pimpl_->get_property(key);
}
-void Link::set_property(std::string key, std::string value)
+void Link::set_property(const std::string& key, std::string value)
{
simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, std::move(value)); });
}
return pimpl_->get_cname();
}
-MailboxPtr Mailbox::by_name(std::string name)
+MailboxPtr Mailbox::by_name(const std::string& name)
{
kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::by_name_or_null(name);
if (mbox == nullptr) {
}
/** Retrieve the property value (or nullptr if not set) */
-const char* NetZone::get_property(std::string key)
+const char* NetZone::get_property(const std::string& key)
{
return properties_.at(key).c_str();
}
-void NetZone::set_property(std::string key, std::string value)
+void NetZone::set_property(const std::string& key, std::string value)
{
simgrid::simix::simcall([this, key, value] { properties_[key] = std::move(value); });
}
simgrid::s4u::Engine::get_instance()->storage_register(name_, this);
}
-Storage* Storage::by_name(std::string name)
+Storage* Storage::by_name(const std::string& name)
{
return Engine::get_instance()->storage_by_name(name);
}
-Storage* Storage::by_name_or_null(std::string name)
+Storage* Storage::by_name_or_null(const std::string& name)
{
return Engine::get_instance()->storage_by_name_or_null(name);
}
return simgrid::simix::simcall([this] { return pimpl_->get_properties(); });
}
-const char* Storage::get_property(std::string key)
+const char* Storage::get_property(const std::string& key)
{
return this->pimpl_->get_property(key);
}
-void Storage::set_property(std::string key, std::string value)
+void Storage::set_property(const std::string& key, std::string value)
{
simgrid::simix::simcall([this, key, value] { this->pimpl_->set_property(key, value); });
}
[exec, bound] { boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(exec)->set_bound(bound); });
}
-smx_activity_t simcall_execution_start(std::string name, std::string category, double flops_amount, double priority,
- double bound, sg_host_t host)
+smx_activity_t simcall_execution_start(const std::string& name, const std::string& category, double flops_amount,
+ double priority, double bound, sg_host_t host)
{
return simgrid::simix::simcall([name, category, flops_amount, priority, bound, host] {
return simgrid::kernel::activity::ExecImplPtr(
* @include small_deployment.xml
*
*/
-void SIMIX_launch_application(std::string file)
+void SIMIX_launch_application(const std::string& file)
{
XBT_ATTRIB_UNUSED int parse_status;
xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_launch_application.");
* @param name the reference name of the function.
* @param code the function
*/
-void SIMIX_function_register(std::string name, xbt_main_func_t code)
+void SIMIX_function_register(const std::string& name, xbt_main_func_t code)
{
simix_global->registered_functions[name] = toActorCodeFactory(code);
}
-void SIMIX_function_register(std::string name, void (*code)(std::vector<std::string>))
+void SIMIX_function_register(const std::string& name, void (*code)(std::vector<std::string>))
{
simix_global->registered_functions[name] = toActorCodeFactory(code);
}
* @param name the reference name of the function.
* @return The #smx_actor_t or nullptr.
*/
-simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(std::string name)
+simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(const std::string& name)
{
xbt_assert(simix_global,
"SIMIX_global_init has to be called before SIMIX_get_actor_code_factory.");
namespace simgrid {
namespace simix {
-void register_function(std::string name, ActorCodeFactory factory)
+void register_function(const std::string& name, ActorCodeFactory factory)
{
simix_global->registered_functions[name] = std::move(factory);
}
#define COLL_SETTER(cat, ret, args, args2) \
int(*Colls::cat) args; \
- void Colls::set_##cat(std::string name) \
+ void Colls::set_##cat(const std::string& name) \
{ \
int id = find_coll_description(mpi_coll_##cat##_description, name, #cat); \
cat = reinterpret_cast<ret(*) args>(mpi_coll_##cat##_description[id].coll); \
XBT_WARN(" %s: %s\n", table[i].name.c_str(), table[i].description.c_str());
}
-int Colls::find_coll_description(s_mpi_coll_description_t* table, std::string name, const char* desc)
+int Colls::find_coll_description(s_mpi_coll_description_t* table, const std::string& name, const char* desc)
{
for (int i = 0; not table[i].name.empty(); i++)
if (name == table[i].name) {
XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor);
XBT_PRIVATE int smpi_process_count();
-XBT_PRIVATE void smpi_deployment_register_process(const std::string instance_id, int rank,
+XBT_PRIVATE void smpi_deployment_register_process(const std::string& instance_id, int rank,
simgrid::s4u::ActorPtr actor);
-XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const std::string instance_id);
-XBT_PRIVATE simgrid::s4u::Barrier* smpi_deployment_finalization_barrier(const std::string instance_id);
+XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const std::string& instance_id);
+XBT_PRIVATE simgrid::s4u::Barrier* smpi_deployment_finalization_barrier(const std::string& instance_id);
XBT_PRIVATE void smpi_deployment_cleanup_instances();
XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_activity_t comm, void* buff, size_t buff_size);
/** @brief MPI collective description */
#define COLL_DEFS(cat, ret, args, args2) \
- static void set_##cat(std::string name); \
+ static void set_##cat(const std::string& name); \
static s_mpi_coll_description_t mpi_coll_##cat##_description[]; \
static int(*cat) args;
class Colls{
public:
static XBT_PUBLIC void coll_help(const char* category, s_mpi_coll_description_t* table);
- static XBT_PUBLIC int find_coll_description(s_mpi_coll_description_t* table, std::string name, const char* desc);
+ static XBT_PUBLIC int find_coll_description(s_mpi_coll_description_t* table, const std::string& name,
+ const char* desc);
static void set_collectives();
// for each collective type, create the set_* prototype, the description array and the function pointer
bool is_valid();
bool is_basic();
static const char* encode(MPI_Datatype dt);
- static MPI_Datatype decode(std::string datatype_id);
+ static MPI_Datatype decode(const std::string& datatype_id);
bool is_replayable();
void addflag(int flag);
int extent(MPI_Aint* lb, MPI_Aint* extent);
std::vector<double> values;
};
-XBT_PUBLIC std::vector<s_smpi_factor_t> parse_factor(std::string smpi_coef_string);
+XBT_PUBLIC std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string);
#endif
smpi_instances.insert(std::pair<std::string, Instance>(name, instance));
}
-void smpi_deployment_register_process(const std::string instance_id, int rank, simgrid::s4u::ActorPtr actor)
+void smpi_deployment_register_process(const std::string& instance_id, int rank, simgrid::s4u::ActorPtr actor)
{
Instance& instance = smpi_instances.at(instance_id);
instance.comm_world->group()->set_mapping(actor, rank);
}
-MPI_Comm* smpi_deployment_comm_world(const std::string instance_id)
+MPI_Comm* smpi_deployment_comm_world(const std::string& instance_id)
{
if (smpi_instances.empty()) { // no instance registered, we probably used smpirun.
return nullptr;
return &instance.comm_world;
}
-simgrid::s4u::Barrier* smpi_deployment_finalization_barrier(const std::string instance_id)
+simgrid::s4u::Barrier* smpi_deployment_finalization_barrier(const std::string& instance_id)
{
if (smpi_instances.empty()) { // no instance registered, we probably used smpirun.
return nullptr;
return smpi_entry_point_type();
}
-static void smpi_copy_file(std::string src, std::string target, off_t fdin_size)
+static void smpi_copy_file(const std::string& src, const std::string& target, off_t fdin_size)
{
int fdin = open(src.c_str(), O_RDONLY);
xbt_assert(fdin >= 0, "Cannot read from %s. Please make sure that the file exists and is executable.", src.c_str());
}
/* Helper function */
-static double parse_double(std::string string)
+static double parse_double(const std::string& string)
{
return xbt_str_parse_double(string.c_str(), "%s is not a double");
}
}
};
-void WaitTestParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void WaitTestParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 3, 0)
src = std::stoi(action[2]);
tag = std::stoi(action[4]);
}
-void SendRecvParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void SendRecvParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 3, 1)
partner = std::stoi(action[2]);
datatype1 = simgrid::smpi::Datatype::decode(action[5]);
}
-void ComputeParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void ComputeParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 1, 0)
flops = parse_double(action[2]);
}
-void BcastArgParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void BcastArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 1, 2)
size = parse_double(action[2]);
datatype1 = simgrid::smpi::Datatype::decode(action[4]);
}
-void ReduceArgParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void ReduceArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 2, 2)
comm_size = parse_double(action[2]);
datatype1 = simgrid::smpi::Datatype::decode(action[5]);
}
-void AllReduceArgParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void AllReduceArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 2, 1)
comm_size = parse_double(action[2]);
datatype1 = simgrid::smpi::Datatype::decode(action[4]);
}
-void AllToAllArgParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void AllToAllArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 2, 1)
comm_size = MPI_COMM_WORLD->size();
datatype2 = simgrid::smpi::Datatype::decode(action[5]);
}
-void GatherArgParser::parse(simgrid::xbt::ReplayAction& action, std::string name)
+void GatherArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string& name)
{
/* The structure of the gather action for the rank 0 (total 4 processes) is the following:
0 gather 68 68 0 0 0
}
}
-void GatherVArgParser::parse(simgrid::xbt::ReplayAction& action, std::string name)
+void GatherVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string& name)
{
/* The structure of the gatherv action for the rank 0 (total 4 processes) is the following:
0 gather 68 68 10 10 10 0 0 0
recv_size_sum = std::accumulate(recvcounts->begin(), recvcounts->end(), 0);
}
-void ScatterArgParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void ScatterArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
/* The structure of the scatter action for the rank 0 (total 4 processes) is the following:
0 gather 68 68 0 0 0
datatype2 = simgrid::smpi::Datatype::decode(action[6]);
}
-void ScatterVArgParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void ScatterVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
/* The structure of the scatterv action for the rank 0 (total 4 processes) is the following:
0 gather 68 10 10 10 68 0 0 0
root = (action.size() > 3 + comm_size) ? std::stoi(action[3 + comm_size]) : 0;
}
-void ReduceScatterArgParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void ReduceScatterArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
/* The structure of the reducescatter action for the rank 0 (total 4 processes) is the following:
0 reducescatter 275427 275427 275427 204020 11346849 0
recv_size_sum = std::accumulate(recvcounts->begin(), recvcounts->end(), 0);
}
-void AllToAllVArgParser::parse(simgrid::xbt::ReplayAction& action, std::string)
+void AllToAllVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
/* The structure of the alltoallv action for the rank 0 (total 4 processes) is the following:
0 alltoallv 100 1 7 10 12 100 1 70 10 5
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_utils, smpi, "Logging specific to SMPI (utils)");
-std::vector<s_smpi_factor_t> parse_factor(std::string smpi_coef_string)
+std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string)
{
std::vector<s_smpi_factor_t> smpi_factor;
return dt->id.c_str();
}
-MPI_Datatype Datatype::decode(std::string datatype_id)
+MPI_Datatype Datatype::decode(const std::string& datatype_id)
{
return id2type_lookup.find(datatype_id)->second;
}
class MigrateParser : public simgrid::smpi::replay::ActionArgParser {
public:
double memory_consumption;
- void parse(simgrid::xbt::ReplayAction& action, std::string)
+ void parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
// The only parameter is the amount of memory used by the current process.
CHECK_ACTION_PARAMS(action, 1, 0);
}
/** @brief Return the property associated to the provided key (or nullptr if not existing) */
-const char* PropertyHolder::get_property(std::string key)
+const char* PropertyHolder::get_property(const std::string& key)
{
if (properties_ == nullptr)
return nullptr;
}
/** @brief Change the value of a given key in the property set */
-void PropertyHolder::set_property(std::string key, std::string value)
+void PropertyHolder::set_property(const std::string& key, std::string value)
{
if (not properties_)
properties_ = new std::unordered_map<std::string, std::string>;
PropertyHolder() = default;
~PropertyHolder();
- const char* get_property(std::string key);
- void set_property(std::string id, std::string value);
+ const char* get_property(const std::string& key);
+ void set_property(const std::string& id, std::string value);
/* FIXME: This should not be exposed, as users may do bad things with the map they got (it's not a copy).
* But some user API expose this call so removing it is not so easy.
* Resource *
************/
-StorageImpl::StorageImpl(kernel::resource::Model* model, std::string name, kernel::lmm::System* maxminSystem,
+StorageImpl::StorageImpl(kernel::resource::Model* model, const std::string& name, kernel::lmm::System* maxminSystem,
double bread, double bwrite, std::string type_id, std::string content_name, sg_size_t size,
std::string attach)
- : Resource(model, name.c_str(), maxminSystem->constraint_new(this, std::max(bread, bwrite)))
+ : Resource(model, name, maxminSystem->constraint_new(this, std::max(bread, bwrite)))
, piface_(name, this)
, typeId_(std::move(type_id))
, content_name(std::move(content_name))
class StorageImpl : public kernel::resource::Resource, public PropertyHolder {
public:
/** @brief Storage constructor */
- StorageImpl(kernel::resource::Model* model, std::string name, kernel::lmm::System* maxmin_system, double bread,
+ StorageImpl(kernel::resource::Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double bread,
double bwrite, std::string type_id, std::string content_name, sg_size_t size, std::string attach);
~StorageImpl() override;
}
/* returns whether #file_path is a absolute file path. Surprising, isn't it ? */
-static bool is_absolute_file_path(std::string file_path)
+static bool is_absolute_file_path(const std::string& file_path)
{
#ifdef _WIN32
WIN32_FIND_DATA wfd = {0};
#endif
}
-std::ifstream* surf_ifsopen(std::string name)
+std::ifstream* surf_ifsopen(const std::string& name)
{
xbt_assert(not name.empty());
return fs;
}
-FILE* surf_fopen(std::string name, const char* mode)
+FILE* surf_fopen(const std::string& name, const char* mode)
{
FILE *file = nullptr;
printf(" %s: %s\n", table[i].name, table[i].description);
}
-int find_model_description(s_surf_model_description_t* table, std::string name)
+int find_model_description(s_surf_model_description_t* table, const std::string& name)
{
for (int i = 0; table[i].name; i++)
if (name == table[i].name)
};
typedef struct surf_model_description s_surf_model_description_t;
-XBT_PUBLIC int find_model_description(s_surf_model_description_t* table, std::string name);
+XBT_PUBLIC int find_model_description(s_surf_model_description_t* table, const std::string& name);
XBT_PUBLIC void model_help(const char* category, s_surf_model_description_t* table);
#define SIMGRID_REGISTER_PLUGIN(id, desc, init) \
/* Generic functions common to all models */
-XBT_PRIVATE FILE* surf_fopen(std::string name, const char* mode);
-XBT_PRIVATE std::ifstream* surf_ifsopen(std::string name);
+XBT_PRIVATE FILE* surf_fopen(const std::string& name, const char* mode);
+XBT_PRIVATE std::ifstream* surf_ifsopen(const std::string& name);
XBT_PRIVATE void check_disk_attachment();
XBT_PUBLIC void sg_platf_init();
XBT_PUBLIC void sg_platf_exit();
-XBT_PUBLIC void surf_parse_open(std::string file);
+XBT_PUBLIC void surf_parse_open(const std::string& file);
XBT_PUBLIC void surf_parse_close();
-XBT_PUBLIC void surf_parse_assert(bool cond, std::string msg);
-XBT_ATTRIB_NORETURN XBT_PUBLIC void surf_parse_error(std::string msg);
-XBT_PUBLIC void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::string post);
-
-XBT_PUBLIC double surf_parse_get_double(std::string s);
-XBT_PUBLIC int surf_parse_get_int(std::string s);
-XBT_PUBLIC double surf_parse_get_time(const char* string, const char* entity_kind, std::string name);
-XBT_PUBLIC double surf_parse_get_size(const char* string, const char* entity_kind, std::string name);
-XBT_PUBLIC double surf_parse_get_bandwidth(const char* string, const char* entity_kind, std::string name);
-XBT_PUBLIC double surf_parse_get_speed(const char* string, const char* entity_kind, std::string name);
+XBT_PUBLIC void surf_parse_assert(bool cond, const std::string& msg);
+XBT_ATTRIB_NORETURN XBT_PUBLIC void surf_parse_error(const std::string& msg);
+XBT_PUBLIC void surf_parse_assert_netpoint(const std::string& hostname, const std::string& pre,
+ const std::string& post);
+
+XBT_PUBLIC double surf_parse_get_double(const std::string& s);
+XBT_PUBLIC int surf_parse_get_int(const std::string& s);
+XBT_PUBLIC double surf_parse_get_time(const char* string, const char* entity_kind, const std::string& name);
+XBT_PUBLIC double surf_parse_get_size(const char* string, const char* entity_kind, const std::string& name);
+XBT_PUBLIC double surf_parse_get_bandwidth(const char* string, const char* entity_kind, const std::string& name);
+XBT_PUBLIC double surf_parse_get_speed(const char* string, const char* entity_kind, const std::string& name);
XBT_PUBLIC int surf_parse(); /* Entry-point to the parser */
}
/* This function acts as a main in the parsing area. */
-void parse_platform_file(std::string file)
+void parse_platform_file(const std::string& file)
{
const char* cfile = file.c_str();
int len = strlen(cfile);
/*
* Helping functions
*/
-void surf_parse_assert(bool cond, std::string msg)
+void surf_parse_assert(bool cond, const std::string& msg)
{
if (not cond) {
int lineno = surf_parse_lineno;
}
}
-void surf_parse_error(std::string msg)
+void surf_parse_error(const std::string& msg)
{
int lineno = surf_parse_lineno;
cleanup();
xbt_die("Exiting now");
}
-void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::string post)
+void surf_parse_assert_netpoint(const std::string& hostname, const std::string& pre, const std::string& post)
{
if (sg_netpoint_by_name_or_null(hostname.c_str()) != nullptr) // found
return;
surf_parse_error(msg);
}
-double surf_parse_get_double(std::string s)
+double surf_parse_get_double(const std::string& s)
{
try {
return std::stod(s);
}
}
-int surf_parse_get_int(std::string s)
+int surf_parse_get_int(const std::string& s)
{
try {
return std::stoi(s);
namespace {
/* Turn something like "1-4,6,9-11" into the vector {1,2,3,4,6,9,10,11} */
-std::vector<int>* explodesRadical(std::string radicals)
+std::vector<int>* explodesRadical(const std::string& radicals)
{
std::vector<int>* exploded = new std::vector<int>();
/* Note: field `unit' for the last element of parameter `units' should be nullptr. */
double surf_parse_get_value_with_unit(const char* string, const unit_scale& units, const char* entity_kind,
- std::string name, const char* error_msg, const char* default_unit)
+ const std::string& name, const char* error_msg, const char* default_unit)
{
char* ptr;
errno = 0;
}
}
-double surf_parse_get_time(const char* string, const char* entity_kind, std::string name)
+double surf_parse_get_time(const char* string, const char* entity_kind, const std::string& name)
{
static const unit_scale units{std::make_pair("w", 7 * 24 * 60 * 60),
std::make_pair("d", 24 * 60 * 60),
"Append 's' to your time to get seconds", "s");
}
-double surf_parse_get_size(const char* string, const char* entity_kind, std::string name)
+double surf_parse_get_size(const char* string, const char* entity_kind, const std::string& name)
{
static const unit_scale units{std::make_tuple("b", 0.125, 2, true), std::make_tuple("b", 0.125, 10, true),
std::make_tuple("B", 1.0, 2, true), std::make_tuple("B", 1.0, 10, true)};
"Append 'B' to get bytes (or 'b' for bits but 1B = 8b).", "B");
}
-double surf_parse_get_bandwidth(const char* string, const char* entity_kind, std::string name)
+double surf_parse_get_bandwidth(const char* string, const char* entity_kind, const std::string& name)
{
static const unit_scale units{std::make_tuple("bps", 0.125, 2, true), std::make_tuple("bps", 0.125, 10, true),
std::make_tuple("Bps", 1.0, 2, true), std::make_tuple("Bps", 1.0, 10, true)};
"Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps");
}
-double surf_parse_get_speed(const char* string, const char* entity_kind, std::string name)
+double surf_parse_get_speed(const char* string, const char* entity_kind, const std::string& name)
{
static const unit_scale units{std::make_tuple("f", 1.0, 10, true), std::make_tuple("flops", 1.0, 10, false)};
return surf_parse_get_value_with_unit(string, units, entity_kind, name,
"Append 'f' or 'flops' to your speed to get flop per second", "f");
}
-static std::vector<double> surf_parse_get_all_speeds(char* speeds, const char* entity_kind, std::string id)
+static std::vector<double> surf_parse_get_all_speeds(char* speeds, const char* entity_kind, const std::string& id)
{
std::vector<double> speed_per_pstate;
/* Open and Close parse file */
YY_BUFFER_STATE surf_input_buffer;
-void surf_parse_open(std::string file)
+void surf_parse_open(const std::string& file)
{
surf_parsed_filename = file;
std::string dir = simgrid::xbt::Path(file).get_dir_name();
void alias(std::string realname, std::string aliasname);
template <class T, class... A>
- simgrid::config::TypedConfigurationElement<T>* register_option(std::string name, A&&... a)
+ simgrid::config::TypedConfigurationElement<T>* register_option(const std::string& name, A&&... a)
{
xbt_assert(options.find(name) == options.end(), "Refusing to register the config element '%s' twice.",
name.c_str());
// ***** get_value *****
-template <class T> XBT_PUBLIC T const& get_value(std::string name)
+template <class T> XBT_PUBLIC T const& get_value(const std::string& name)
{
return (*simgrid_config)[name].get_value<T>();
}
-template XBT_PUBLIC int const& get_value<int>(std::string name);
-template XBT_PUBLIC double const& get_value<double>(std::string name);
-template XBT_PUBLIC bool const& get_value<bool>(std::string name);
-template XBT_PUBLIC std::string const& get_value<std::string>(std::string name);
+template XBT_PUBLIC int const& get_value<int>(const std::string& name);
+template XBT_PUBLIC double const& get_value<double>(const std::string& name);
+template XBT_PUBLIC bool const& get_value<bool>(const std::string& name);
+template XBT_PUBLIC std::string const& get_value<std::string>(const std::string& name);
// ***** alias *****
// ***** declare_flag *****
template <class T>
-XBT_PUBLIC void declare_flag(std::string name, std::string description, T value, std::function<void(const T&)> callback)
+XBT_PUBLIC void declare_flag(const std::string& name, std::string description, T value,
+ std::function<void(const T&)> callback)
{
if (simgrid_config == nullptr)
simgrid_config = new simgrid::config::Config();
simgrid_config->register_option<T>(name, std::move(description), std::move(value), std::move(callback));
}
-template XBT_PUBLIC void declare_flag(std::string name, std::string description, int value,
+template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, int value,
std::function<void(int const&)> callback);
-template XBT_PUBLIC void declare_flag(std::string name, std::string description, double value,
+template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, double value,
std::function<void(double const&)> callback);
-template XBT_PUBLIC void declare_flag(std::string name, std::string description, bool value,
+template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, bool value,
std::function<void(bool const&)> callback);
-template XBT_PUBLIC void declare_flag(std::string name, std::string description, std::string value,
+template XBT_PUBLIC void declare_flag(const std::string& name, std::string description, std::string value,
std::function<void(std::string const&)> callback);
void finalize()
simgrid::s4u::Actor::create(std::move(name), location, computation_fun, arg);
}
-static void test_energy_consumption(std::string name, int nb_cores)
+static void test_energy_consumption(const std::string& name, int nb_cores)
{
double new_energy = 0;
}
}
-static void run_test(std::string chooser)
+static void run_test(const std::string& chooser)
{
simgrid::s4u::Host *pm0 = simgrid::s4u::Host::by_name("node-0.1core.org");
simgrid::s4u::Host *pm1 = simgrid::s4u::Host::by_name("node-1.1core.org");
if (not keys.empty()) {
std::printf(">\n");
std::sort(keys.begin(), keys.end());
- for (std::string key : keys)
+ for (const std::string& key : keys)
std::printf(" <prop id=\"%s\" value=\"%s\"/>\n", key.c_str(), props->at(key).c_str());
std::printf(" </host>\n");
} else {