本文整理汇总了C++中xbt_cfg_get_string函数的典型用法代码示例。如果您正苦于以下问题:C++ xbt_cfg_get_string函数的具体用法?C++ xbt_cfg_get_string怎么用?C++ xbt_cfg_get_string使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xbt_cfg_get_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: surf_config_models_setup
void surf_config_models_setup(const char *platform_file)
{
char *workstation_model_name;
int workstation_id = -1;
char *network_model_name = NULL;
char *cpu_model_name = NULL;
workstation_model_name =
xbt_cfg_get_string(_surf_cfg_set, "workstation/model");
network_model_name = xbt_cfg_get_string(_surf_cfg_set, "network/model");
cpu_model_name = xbt_cfg_get_string(_surf_cfg_set, "cpu/model");
/* Check whether we use a net/cpu model differing from the default ones, in which case
* we should switch to the "compound" workstation model to correctly dispatch stuff to
* the right net/cpu models.
*/
if ((strcmp(network_model_name, "LV08")
|| strcmp(cpu_model_name, "Cas01"))
&& !strcmp(workstation_model_name, "CLM03")) {
const char *val = "compound";
XBT_INFO
("Switching workstation model to compound since you changed the network and/or cpu model(s)");
xbt_cfg_set_string(_surf_cfg_set, "workstation/model", val);
workstation_model_name = (char *) "compound";
}
XBT_DEBUG("Workstation model: %s", workstation_model_name);
workstation_id =
find_model_description(surf_workstation_model_description,
workstation_model_name);
if (!strcmp(workstation_model_name, "compound")) {
int network_id = -1;
int cpu_id = -1;
xbt_assert(cpu_model_name,
"Set a cpu model to use with the 'compound' workstation model");
xbt_assert(network_model_name,
"Set a network model to use with the 'compound' workstation model");
network_id =
find_model_description(surf_network_model_description,
network_model_name);
cpu_id =
find_model_description(surf_cpu_model_description, cpu_model_name);
surf_cpu_model_description[cpu_id].model_init_preparse(platform_file);
surf_network_model_description[network_id].model_init_preparse
(platform_file);
}
XBT_DEBUG("Call workstation_model_init");
surf_workstation_model_description[workstation_id].model_init_preparse
(platform_file);
}
示例2: _mc_cfg_cb_dot_output
void _mc_cfg_cb_dot_output(const char *name)
{
if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a file name for a dot output of graph state after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
_sg_mc_dot_output_file = xbt_cfg_get_string(name);
}
示例3: _sg_cfg_cb__storage_mode
/* callback of the cpu/model variable */
static void _sg_cfg_cb__storage_mode(const char *name)
{
xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
char *val = xbt_cfg_get_string(name);
if (!strcmp(val, "help")) {
model_help("storage", surf_storage_model_description);
sg_cfg_exit_early();
}
find_model_description(surf_storage_model_description, val);
}
示例4: surf_config_models_create_elms
void surf_config_models_create_elms(void)
{
char *workstation_model_name =
xbt_cfg_get_string(_surf_cfg_set, "workstation/model");
int workstation_id =
find_model_description(surf_workstation_model_description,
workstation_model_name);
if (surf_workstation_model_description
[workstation_id].model_init_postparse != NULL)
surf_workstation_model_description[workstation_id].model_init_postparse
();
}
示例5: _sg_cfg_cb__network_model
/* callback of the network_model variable */
static void _sg_cfg_cb__network_model(const char *name)
{
xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
char *val = xbt_cfg_get_string(name);
if (!strcmp(val, "help")) {
model_help("network", surf_network_model_description);
sg_cfg_exit_early();
}
/* New Module missing */
find_model_description(surf_network_model_description, val);
}
示例6: _sg_cfg_cb__vm_model
/* callback of the vm/model variable */
static void _sg_cfg_cb__vm_model(const char *name)
{
xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
char *val = xbt_cfg_get_string(name);
if (!strcmp(val, "help")) {
model_help("vm", surf_vm_model_description);
sg_cfg_exit_early();
}
/* Make sure that the model exists */
find_model_description(surf_vm_model_description, val);
}
示例7: _check_coll
/* callback of the mpi collectives: simply check that this is a valid name. It will be picked up in smpi_global.cpp */
static void _check_coll(const char *category,
s_mpi_coll_description_t * table,
const char *name)
{
xbt_assert(_sg_cfg_init_status < 2, "Cannot change the collective algorithm after the initialization");
char *val = xbt_cfg_get_string(name);
if (val && !strcmp(val, "help")) {
coll_help(category, table);
sg_cfg_exit_early();
}
find_coll_description(table, val, category);
}
示例8: TRACE_start
int TRACE_start()
{
if (TRACE_is_configured())
TRACE_getopts();
// tracing system must be:
// - enabled (with --cfg=tracing:yes)
// - already configured (TRACE_global_init already called)
if (TRACE_is_enabled()) {
XBT_DEBUG("Tracing starts");
/* init the tracing module to generate the right output */
/* open internal buffer */
TRACE_init();
/* open the trace file(s) */
const char* format = xbt_cfg_get_string(OPT_TRACING_FORMAT);
XBT_DEBUG("Tracing format %s\n", format);
if(!strcmp(format, "Paje")){
TRACE_paje_init();
TRACE_paje_start();
}else if (!strcmp(format, "TI")){
TRACE_TI_init();
TRACE_TI_start();
}else{
xbt_die("Unknown trace format :%s ", format);
}
/* activate trace */
if (trace_active == 1) {
THROWF(tracing_error, 0, "Tracing is already active");
}
trace_active = 1;
XBT_DEBUG("Tracing is on");
/* other trace initialization */
created_categories = xbt_dict_new_homogeneous(xbt_free_f);
declared_marks = xbt_dict_new_homogeneous(xbt_free_f);
user_host_variables = xbt_dict_new_homogeneous(xbt_free_f);
user_vm_variables = xbt_dict_new_homogeneous(xbt_free_f);
user_link_variables = xbt_dict_new_homogeneous(xbt_free_f);
if (TRACE_start_functions != NULL) {
void (*func) ();
unsigned int iter;
xbt_dynar_foreach(TRACE_start_functions, iter, func) {
func();
}
}
}
示例9: _mc_cfg_cb_reduce
void _mc_cfg_cb_reduce(const char *name)
{
if (_sg_cfg_init_status && !_sg_do_model_check)
xbt_die
("You are specifying a reduction strategy after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
char *val = xbt_cfg_get_string(name);
if (!strcasecmp(val, "none"))
simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::none;
else if (!strcasecmp(val, "dpor"))
simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::dpor;
else
xbt_die("configuration option %s can only take 'none' or 'dpor' as a value",
name);
}
示例10: _sg_cfg_cb__plugin
/* callback of the plugin variable */
static void _sg_cfg_cb__plugin(const char *name)
{
xbt_assert(_sg_cfg_init_status < 2, "Cannot load a plugin after the initialization");
char *val = xbt_cfg_get_string(name);
if (val==nullptr || val[0] == '\0')
return;
if (!strcmp(val, "help")) {
model_help("plugin", surf_plugin_description);
sg_cfg_exit_early();
}
int plugin_id = find_model_description(surf_plugin_description, val);
surf_plugin_description[plugin_id].model_init_preparse();
}
示例11: _surf_cfg_cb__surf_network_coordinates
static void _surf_cfg_cb__surf_network_coordinates(const char *name,
int pos)
{
char *val = xbt_cfg_get_string(_surf_cfg_set, name);
if (!strcmp(val, "yes")) {
if (!COORD_HOST_LEVEL) {
COORD_HOST_LEVEL = xbt_lib_add_level(host_lib,xbt_dynar_free_voidp);
COORD_ASR_LEVEL = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
}
} else if (!strcmp(val, "no")) {
if (COORD_HOST_LEVEL)
xbt_die("Setting of whether to use coordinate cannot be disabled once set.");
} else {
xbt_die("Command line setting of whether to use coordinates must be either \"yes\" or \"no\"");
}
}
示例12: parse_factor
double NetworkSmpiModel::latencyFactor(double size)
{
if (smpi_lat_factor.empty())
smpi_lat_factor = parse_factor(xbt_cfg_get_string("smpi/lat-factor"));
double current=1.0;
for (auto fact: smpi_lat_factor) {
if (size <= fact.factor) {
XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
return current;
} else
current=fact.values.front();
}
XBT_DEBUG("%f > %zu return %f", size, smpi_lat_factor.back().factor, current);
return current;
}
示例13: _sg_cfg_cb__workstation_model
/* callback of the workstation/model variable */
static void _sg_cfg_cb__workstation_model(const char *name, int pos)
{
char *val;
xbt_assert(_sg_init_status == 1,
"Cannot change the model after the initialization");
val = xbt_cfg_get_string(_sg_cfg_set, name);
if (!strcmp(val, "help")) {
model_help("workstation", surf_workstation_model_description);
exit(0);
}
/* Make sure that the model exists */
find_model_description(surf_workstation_model_description, val);
}
示例14: _sg_cfg_cb__network_model
/* callback of the workstation_model variable */
static void _sg_cfg_cb__network_model(const char *name, int pos)
{
char *val;
xbt_assert(_sg_init_status == 1,
"Cannot change the model after the initialization");
val = xbt_cfg_get_string(_sg_cfg_set, name);
if (!strcmp(val, "help")) {
model_help("network", surf_network_model_description);
exit(0);
}
/* New Module missing */
find_model_description(surf_network_model_description, val);
}
示例15: _sg_cfg_cb__storage_mode
/* callback of the cpu/model variable */
static void _sg_cfg_cb__storage_mode(const char *name, int pos)
{
char *val;
xbt_assert(_sg_cfg_init_status < 2,
"Cannot change the model after the initialization");
val = xbt_cfg_get_string(_sg_cfg_set, name);
if (!strcmp(val, "help")) {
model_help("storage", surf_storage_model_description);
sg_cfg_exit_early();
}
/* New Module missing */
find_model_description(surf_storage_model_description, val);
}