#ifndef SIMGRID_KERNEL_ACTIVITY_ACTIVITYIMPL_HPP
#define SIMGRID_KERNEL_ACTIVITY_ACTIVITYIMPL_HPP
-#include <string>
#include <list>
+#include <string>
+#include <string_view>
#include "simgrid/forward.h"
#include <xbt/utility.hpp>
resource::Action* surf_action_ = nullptr;
protected:
- void inline set_name(const std::string& name)
+ void inline set_name(std::string_view name)
{
// This is to keep name_ private while allowing ActivityImpl_T<??> to set it and then return a Ptr to qualified
// child type
std::string tracing_category_ = "";
public:
- AnyActivityImpl& set_name(const std::string& name) /* Hides the function in the ancestor class */
+ AnyActivityImpl& set_name(std::string_view name) /* Hides the function in the ancestor class */
{
ActivityImpl::set_name(name);
return static_cast<AnyActivityImpl&>(*this);
}
- AnyActivityImpl& set_tracing_category(const std::string& category)
+ AnyActivityImpl& set_tracing_category(std::string_view category)
{
tracing_category_ = category;
return static_cast<AnyActivityImpl&>(*this);
#include <cstddef>
#include <fstream>
#include <sstream>
-
+#include <string_view>
namespace simgrid {
namespace kernel {
bool loop;
double loop_delay = 0.0;
- static bool is_comment_or_empty_line(const std::string& val)
+ static bool is_comment_or_empty_line(std::string_view val)
{
- return (val[0] == '#' || val[0] == '\0' || val[0] == '%');
+ return (val.empty() || val.front() == '#' || val.front() == '%');
}
- static bool is_normal_distribution(const std::string& val)
+ static bool is_normal_distribution(std::string_view val)
{
return (val == "NORM" || val == "NORMAL" || val == "GAUSS" || val == "GAUSSIAN");
}
- static bool is_exponential_distribution(const std::string& val) { return (val == "EXP" || val == "EXPONENTIAL"); }
+ static bool is_exponential_distribution(std::string_view val) { return (val == "EXP" || val == "EXPONENTIAL"); }
- static bool is_uniform_distribution(const std::string& val) { return (val == "UNIF" || val == "UNIFORM"); }
+ static bool is_uniform_distribution(std::string_view val) { return (val == "UNIF" || val == "UNIFORM"); }
public:
LegacyUpdateCb(const std::string& input, double periodicity) : loop(periodicity > 0)
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_replay.hpp"
#include <simgrid/sg_config.hpp>
+
#if SIMGRID_HAVE_MC
#include "src/mc/mc_safety.hpp"
+#include <string_view>
#endif
-#include <climits>
-
#if SIMGRID_HAVE_MC
namespace simgrid {
namespace mc {
/* Replay (this part is enabled even if MC it disabled) */
simgrid::config::Flag<std::string> _sg_mc_record_path{
"model-check/replay", "Model-check path to replay (as reported by SimGrid when a violation is reported)", "",
- [](const std::string& value) { MC_record_path() = value; }};
+ [](std::string_view value) { MC_record_path() = value; }};
simgrid::config::Flag<bool> _sg_mc_timeout{
"model-check/timeout", "Whether to enable timeouts for wait requests", false, [](bool) {
"infty",
{{"zero", "No system buffering: MPI_Send is blocking"},
{"infty", "Infinite system buffering: MPI_Send returns immediately"}},
- [](const std::string&) { _mc_cfg_cb_check("buffering mode"); }};
+ [](std::string_view) { _mc_cfg_cb_check("buffering mode"); }};
static simgrid::config::Flag<std::string> _sg_mc_reduce{
"model-check/reduction", "Specify the kind of exploration reduction (either none or DPOR)", "dpor",
- [](const std::string& value) {
+ [](std::string_view value) {
_mc_cfg_cb_check("reduction strategy");
if (value == "none")
#include <memory>
#include <mutex>
#include <string>
+#include <string_view>
using simgrid::mc::remote;
// ***** Helper stuff
-static bool is_filtered_lib(const std::string& libname)
+static bool is_filtered_lib(std::string_view libname)
{
return libname != "libsimgrid";
}
#include <iostream>
#include <queue>
+#include <string_view>
namespace simgrid {
namespace mc {
inline void set_state_id(int sid) { state_id = sid; }
inline std::string get_transition_tag() const { return transition_tag; }
- inline void set_transition_tag(std::string const& tr_tag) { transition_tag = tr_tag; }
+ inline void set_transition_tag(std::string_view tr_tag) { transition_tag = tr_tag; }
private:
EventSet causes; // used to store directed ancestors of event e
#endif
#include <boost/algorithm/string.hpp>
+#include <string_view>
SIMGRID_REGISTER_PLUGIN(host_dvfs, "Dvfs support", &sg_host_dvfs_plugin_init)
{"performance", "TODO: Doc"}, {"powersave", "TODO: Doc"},
}),
- [](const std::string& val) {
+ [](std::string_view val) {
if (val != "performance")
sg_host_dvfs_plugin_init();
});
#include "src/smpi/include/smpi_config.hpp"
#include "src/surf/surf_interface.hpp"
+#include <string_view>
+
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf, "About the configuration of SimGrid");
static simgrid::config::Flag<bool> cfg_continue_after_help
find_model_description(surf_network_model_description, value);
}
-static void _sg_cfg_cb_contexts_parallel_mode(const std::string& mode_name)
+static void _sg_cfg_cb_contexts_parallel_mode(std::string_view mode_name)
{
if (mode_name == "posix") {
simgrid::kernel::context::set_parallel_mode(XBT_PARMAP_POSIX);
#include "simgrid/s4u/Mailbox.hpp"
#include "src/instr/instr_smpi.hpp"
#include "xbt/xbt_os_time.h"
+#include <string_view>
namespace simgrid {
namespace smpi {
void set_replaying(bool value);
bool replaying() const;
std::string get_instance_id() const { return instance_id_;}
- void set_tracing_category(const std::string& category) { tracing_category_ = category; }
+ void set_tracing_category(std::string_view category) { tracing_category_ = category; }
const std::string& get_tracing_category() const { return tracing_category_; }
smpi_trace_call_location_t* call_location();
void set_privatized_region(smpi_privatization_region_t region);
#include <cstddef>
#include <string>
+#include <string_view>
#include <vector>
// Methods used to parse and store the values for timing injections in smpi
XBT_PUBLIC std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string);
XBT_PUBLIC void add_benched_time(double time);
-XBT_PUBLIC void account_malloc_size(size_t size, const std::string& file, int line, const void* ptr);
+XBT_PUBLIC void account_malloc_size(size_t size, std::string_view file, int line, const void* ptr);
XBT_PUBLIC void account_shared_size(size_t size);
XBT_PUBLIC void print_time_analysis(double time);
XBT_PUBLIC void print_buffer_info();
total_benched_time += time;
}
-void account_malloc_size(size_t size, const std::string& file, int line, const void* ptr)
+void account_malloc_size(size_t size, std::string_view file, int line, const void* ptr)
{
if (smpi_cfg_display_alloc()) {
alloc_metadata_t metadata;