* its code between, say, MSG_init and MSG_create_environment using MSG_config
*/
XBT_PUBLIC(void) surf_config_models_setup(const char *platform_file);
+XBT_PUBLIC(void) surf_config_add_callback(void);
/** \brief create the elements of the models
*
void *surf_workstation = NULL;
void *surf_link = NULL;
- SD_CHECK_INIT_DONE();
+ //First pass of platform file
+ surf_config_add_callback();
+ parse_platform_file(platform_file);
+ SD_CHECK_INIT_DONE();
DEBUG0("SD_create_environment");
-
surf_config_models_setup(platform_file);
parse_platform_file(platform_file);
surf_config_models_create_elms();
double start, end;
+ //First pass of platform file
+ surf_config_add_callback();
+ parse_platform_file(file);
+
surf_config_models_setup(file);
parse_platform_file(file);
surf_config_models_create_elms();
*/
void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_t get_link_latency_fun)
{
-
/* config the uniq global routing */
global_routing = xbt_new0(s_routing_global_t, 1);
global_routing->where_network_elements = xbt_dict_new();
surfxml_add_callback(STag_surfxml_peer_cb_list,
&routing_parse_Speer);
- surfxml_add_callback(STag_surfxml_config_cb_list,
- &routing_parse_Sconfig);
- surfxml_add_callback(ETag_surfxml_config_cb_list,
- &routing_parse_Econfig);
-
#ifdef HAVE_TRACING
instr_routing_define_callbacks();
#endif
}
+void surf_config_add_callback(void)
+{
+ surf_parse_reset_parser();
+ surfxml_add_callback(STag_surfxml_config_cb_list, &routing_parse_Sconfig);
+ surfxml_add_callback(ETag_surfxml_config_cb_list, &routing_parse_Econfig);
+ surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
+}
+
/* ************************************************************************** */
/* *************************** FULL ROUTING ********************************* */
static void routing_parse_Sconfig(void)
{
- //TODO
- DEBUG0("WARNING tag config not yet implemented.");
- DEBUG1("Configuration name = %s",A_surfxml_config_id);
+ DEBUG1("START configuration name = %s",A_surfxml_config_id);
}
static void routing_parse_Econfig(void)
{
- //TODO
xbt_dict_cursor_t cursor = NULL;
char *key;
char *elem;
+ char *cfg;
xbt_dict_foreach(current_property_set, cursor, key, elem) {
- DEBUG2("property : %s = %s",key,elem);
+ cfg = bprintf("%s:%s",key,elem);
+ xbt_cfg_set_parse(_surf_cfg_set, cfg);
}
+ DEBUG1("End configuration name = %s",A_surfxml_config_id);
}
static void routing_parse_Scluster(void)
xbt_dynar_new(sizeof(void_f_void_t), NULL);
ETag_surfxml_peer_cb_list =
xbt_dynar_new(sizeof(void_f_void_t), NULL);
- STag_surfxml_config_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
- ETag_surfxml_config_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+ STag_surfxml_config_cb_list =
+ xbt_dynar_new(sizeof(void_f_void_t), NULL);
+ ETag_surfxml_config_cb_list =
+ xbt_dynar_new(sizeof(void_f_void_t), NULL);
}
/* Stag and Etag parse functions */
trace_connect_list_bandwidth = xbt_dict_new();
trace_connect_list_latency = xbt_dict_new();
- surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
- surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
- surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_Stag_trace);
- surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace);
- surfxml_add_callback(STag_surfxml_trace_connect_cb_list,
- &parse_Stag_trace_connect);
+ if(xbt_dynar_is_empty(STag_surfxml_config_cb_list))
+ {
+ surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
+ surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
+ surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_Stag_trace);
+ surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace);
+ surfxml_add_callback(STag_surfxml_trace_connect_cb_list,
+ &parse_Stag_trace_connect);
+ }
}
static void free_data(void)
}
/* Here start parse */
-
void parse_platform_file(const char *file)
{
int parse_status;
$ ${bindir:=.}/basic_parsing_test ./four_hosts_floyd_bis.xml
> [0.000000] [surf_workstation/INFO] surf_workstation_model_init_ptask_L07
> Workstation number: 5, link number: 7
+
+$ ${bindir:=.}/basic_parsing_test ./properties.xml
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '0.000010'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'cpu/model' to 'CpuTI'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'workstation/model' to 'compound'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'Vegas'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'path' to '~/'
+> Workstation number: 1, link number: 1
\ No newline at end of file
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="3">
+
+<config id="General">
+ <prop id="maxmin/precision" value="0.000010"></prop>
+
+ <prop id="cpu/model" value="Cas01_fullupdate"></prop>
+ <prop id="cpu/model" value="Cas01"></prop>
+ <prop id="cpu/model" value="CpuTI"></prop>
+
+ <prop id="workstation/model" value="CLM03"></prop>
+ <prop id="workstation/model" value="ptask_L07"></prop>
+ <prop id="workstation/model" value="compound"></prop>
+
+ <prop id="network/model" value="Constant"></prop>
+ <prop id="network/model" value="CM02"></prop>
+ <prop id="network/model" value="LV08"></prop>
+ <prop id="network/model" value="SMPI"></prop>
+ <prop id="network/model" value="Reno"></prop>
+ <prop id="network/model" value="Reno2"></prop>
+ <prop id="network/model" value="Vegas"></prop>
+
+ <prop id="path" value="~/"></prop>
+</config>
+
+<AS id="AS0" routing="Full">
+ <host id="bob" power="500000000"/>
+</AS>
+</platform>
<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "simgrid.dtd">
<platform version="3">
- <config id="general">
- <prop id="test" value="retest"></prop>
- <prop id="test" value="retest"></prop>
- <prop id="test" value="retest"></prop>
- </config>
<AS id="AS0" routing="Full">
<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "simgrid.dtd">
- <platform version="3">
- <config id="general">
- <prop id="test" value="retest"></prop>
- <prop id="test" value="retest"></prop>
- <prop id="test" value="retest"></prop>
- </config>
-
+ <platform version="3">
<AS id="AS0" routing="Full">
<cluster id="bob_cluster" prefix="bob" suffix=".hamburger.edu"