#ifndef SURFXML_PARSE_VALUES_H_
#define SURFXML_PARSE_VALUES_H_
-struct V_peer {
+typedef struct s_peer *peer_t;
+typedef struct s_peer {
char* V_peer_id;
- double V_peer_power;
- double V_peer_bw_in;
- double V_peer_bw_out;
- double V_peer_lat;
+ char* V_peer_power;
+ char* V_peer_bw_in;
+ char* V_peer_bw_out;
+ char* V_peer_lat;
char* V_peer_coord;
- tmgr_trace_t V_peer_availability_trace;
- tmgr_trace_t V_peer_state_trace;
-};
+ char* V_peer_availability_trace;
+ char* V_peer_state_trace;
+} s_peer_t;
-struct V_link {
+typedef struct s_link *link_t;
+typedef struct s_link {
char* V_link_id;
double V_link_bandwidth;
tmgr_trace_t V_link_bandwidth_file;
e_surf_resource_state_t V_link_state;
tmgr_trace_t V_link_state_file;
int V_link_sharing_policy;
-};
+ int V_policy_initial_link;
+} s_link_t;
-struct V_cluster {
+typedef struct s_cluster *cluster_t;
+typedef struct s_cluster {
char* V_cluster_id;
char* V_cluster_prefix;
char* V_cluster_suffix;
char* V_cluster_radical;
- double V_cluster_power;
- int V_cluster_core;
- double V_cluster_bw;
- double V_cluster_lat;
- double V_cluster_bb_bw;
- double V_cluster_bb_lat;
- char * V_cluster_router_id;
+ char* S_cluster_power;
+ char* S_cluster_core;
+ char* S_cluster_bw;
+ char* S_cluster_lat;
+ char* S_cluster_bb_bw;
+ char* S_cluster_bb_lat;
+ char* S_cluster_router_id;
int V_cluster_sharing_policy;
int V_cluster_bb_sharing_policy;
-};
+} s_cluster_t;
-struct V_router {
+typedef struct s_router *router_t;
+typedef struct s_router {
char* V_router_id;
char* V_router_coord;
-};
+} s_router_t;
-struct V_host {
+typedef struct s_host *host_t;
+typedef struct s_host {
char* V_host_id; //id
double V_host_power_peak; //power
int V_host_core; //core
e_surf_resource_state_t V_host_state_initial; //state
tmgr_trace_t V_host_state_trace; //state file
char* V_host_coord;
-};
+} s_host_t;
-struct V_host s_host;
-struct V_router s_router;
-struct V_cluster s_cluster;
-struct V_peer s_peer;
-struct V_link s_link;
+extern host_t struct_host;
+extern router_t struct_router;
+extern cluster_t struct_cluster;
+extern peer_t struct_peer;
+extern link_t struct_lnk;
#endif /* SURFXML_PARSE_VALUES_H_ */
static void instr_routing_parse_start_link ()
{
container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
- const char *link_id = A_surfxml_link_id;
- double bandwidth_value = atof(A_surfxml_link_bandwidth);
- double latency_value = atof(A_surfxml_link_latency);
+ double bandwidth_value = lnk->V_link_bandwidth;
+ double latency_value = lnk->V_link_latency;
xbt_dynar_t links_to_create = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX){
- char *up = bprintf("%s_UP", link_id);
- char *down = bprintf("%s_DOWN", link_id);
+ if (lnk->V_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX){
+ char *up = bprintf("%s_UP", lnk->V_link_id);
+ char *down = bprintf("%s_DOWN", lnk->V_link_id);
xbt_dynar_push_as (links_to_create, char*, xbt_strdup(up));
xbt_dynar_push_as (links_to_create, char*, xbt_strdup(down));
free (up);
free (down);
}else{
- xbt_dynar_push_as (links_to_create, char*, strdup(link_id));
+ xbt_dynar_push_as (links_to_create, char*, strdup(lnk->V_link_id));
}
char *link_name = NULL;
static void instr_routing_parse_start_host ()
{
container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
- container_t new = newContainer (A_surfxml_host_id, INSTR_HOST, father);
+ container_t new = newContainer (host->V_host_id, INSTR_HOST, father);
if (TRACE_categorized() || TRACE_uncategorized()) {
type_t power = getVariableType ("power", NULL, new->type);
- new_pajeSetVariable (0, new, power, atof(A_surfxml_host_power));
+ new_pajeSetVariable (0, new, power, host->V_host_power_peak);
}
if (TRACE_uncategorized()){
getVariableType ("power_used", "0.5 0.5 0.5", new->type);
static void instr_routing_parse_start_router ()
{
container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
- newContainer (A_surfxml_router_id, INSTR_ROUTER, father);
+ newContainer (router->V_router_id, INSTR_ROUTER, father);
}
static void instr_routing_parse_end_router ()
tmgr_trace_t state_trace,
xbt_dict_t cpu_properties)
{
+
cpu_Cas01_t cpu = xbt_new0(s_cpu_Cas01_t, 1);
xbt_assert(!surf_cpu_resource_by_name(name),
"Host '%s' declared several times in the platform file",
static void parse_cpu_init(void)
{
- double power_peak = 0.0;
- double power_scale = 0.0;
- int core = 0;
- tmgr_trace_t power_trace = NULL;
- e_surf_resource_state_t state_initial = SURF_RESOURCE_OFF;
- tmgr_trace_t state_trace = NULL;
-
- power_peak = get_cpu_power(A_surfxml_host_power);
- surf_parse_get_double(&power_scale, A_surfxml_host_availability);
- power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
- surf_parse_get_int(&core, A_surfxml_host_core);
-
- xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
- (A_surfxml_host_state == A_surfxml_host_state_OFF),
- "Invalid state");
- if (A_surfxml_host_state == A_surfxml_host_state_ON)
- state_initial = SURF_RESOURCE_ON;
- if (A_surfxml_host_state == A_surfxml_host_state_OFF)
- state_initial = SURF_RESOURCE_OFF;
- state_trace = tmgr_trace_new(A_surfxml_host_state_file);
-
- cpu_create_resource(xbt_strdup(A_surfxml_host_id), power_peak, power_scale,
- power_trace, core, state_initial, state_trace, current_property_set);
+ if(strcmp(struct_host->V_host_coord,"")) xbt_die("Coordinates not implemented yet!");
+
+ cpu_create_resource(struct_host->V_host_id,
+ struct_host->V_host_power_peak,
+ struct_host->V_host_power_scale,
+ struct_host->V_host_power_trace,
+ struct_host->V_host_core,
+ struct_host->V_host_state_initial,
+ struct_host->V_host_state_trace,
+ current_property_set);
current_property_set = NULL;
}
static void parse_cpu_im_init(void)
{
- double power_peak = 0.0;
- double power_scale = 0.0;
- int core = 0;
- tmgr_trace_t power_trace = NULL;
- e_surf_resource_state_t state_initial = SURF_RESOURCE_OFF;
- tmgr_trace_t state_trace = NULL;
-
- power_peak = get_cpu_power(A_surfxml_host_power);
- surf_parse_get_double(&power_scale, A_surfxml_host_availability);
- power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
- surf_parse_get_int(&core, A_surfxml_host_core);
-
- xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
- (A_surfxml_host_state == A_surfxml_host_state_OFF),
- "Invalid state");
- if (A_surfxml_host_state == A_surfxml_host_state_ON)
- state_initial = SURF_RESOURCE_ON;
- if (A_surfxml_host_state == A_surfxml_host_state_OFF)
- state_initial = SURF_RESOURCE_OFF;
- state_trace = tmgr_trace_new(A_surfxml_host_state_file);
-
- cpu_im_create_resource(xbt_strdup(A_surfxml_host_id), power_peak, power_scale,
- power_trace, core, state_initial, state_trace,
- current_property_set);
- current_property_set = NULL;
-
+ cpu_im_create_resource(struct_host->V_host_id,
+ struct_host->V_host_power_peak,
+ struct_host->V_host_power_scale,
+ struct_host->V_host_power_trace,
+ struct_host->V_host_core,
+ struct_host->V_host_state_initial,
+ struct_host->V_host_state_trace,
+ current_property_set);
+ current_property_set = NULL;
}
static void cpu_im_add_traces_cpu(void)
#include "cpu_ti_private.h"
#include "xbt/heap.h"
-
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_ti, surf,
"Logging specific to the SURF CPU TRACE INTEGRATION module");
static void parse_cpu_ti_init(void)
{
- double power_peak = 0.0;
- double power_scale = 0.0;
- int core = 0;
- tmgr_trace_t power_trace = NULL;
- e_surf_resource_state_t state_initial = SURF_RESOURCE_OFF;
- tmgr_trace_t state_trace = NULL;
-
- power_peak = get_cpu_power(A_surfxml_host_power);
- surf_parse_get_double(&power_scale, A_surfxml_host_availability);
- power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
- surf_parse_get_int(&core, A_surfxml_host_core);
-
- xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
- (A_surfxml_host_state == A_surfxml_host_state_OFF),
- "Invalid state");
- if (A_surfxml_host_state == A_surfxml_host_state_ON)
- state_initial = SURF_RESOURCE_ON;
- if (A_surfxml_host_state == A_surfxml_host_state_OFF)
- state_initial = SURF_RESOURCE_OFF;
- state_trace = tmgr_trace_new(A_surfxml_host_state_file);
-
- cpu_ti_create_resource(xbt_strdup(A_surfxml_host_id), power_peak, power_scale,
- power_trace, core, state_initial, state_trace,
- current_property_set);
+ cpu_ti_create_resource(struct_host->V_host_id,
+ struct_host->V_host_power_peak,
+ struct_host->V_host_power_scale,
+ struct_host->V_host_power_trace,
+ struct_host->V_host_core,
+ struct_host->V_host_state_initial,
+ struct_host->V_host_state_trace,
+ current_property_set);
current_property_set = NULL;
}
#include "xbt/log.h"
#include "xbt/str.h"
+#include "surf/surfxml_parse_values.h"
+
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
"Logging specific to the SURF network module");
static void net_parse_link_init(void)
{
- char *name_link;
- double bw_initial;
- tmgr_trace_t bw_trace;
- double lat_initial;
- tmgr_trace_t lat_trace;
- e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
- e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
- tmgr_trace_t state_trace;
XBT_DEBUG("link_CM02");
- name_link = xbt_strdup(A_surfxml_link_id);
- surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
- bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
- surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
- lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
-
- xbt_assert((A_surfxml_link_state == A_surfxml_link_state_ON)
- || (A_surfxml_link_state ==
- A_surfxml_link_state_OFF), "Invalid state");
- if (A_surfxml_link_state == A_surfxml_link_state_ON)
- state_initial_link = SURF_RESOURCE_ON;
- else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
- state_initial_link = SURF_RESOURCE_OFF;
-
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
- policy_initial_link = SURF_LINK_SHARED;
- else
- {
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FATPIPE)
- policy_initial_link = SURF_LINK_FATPIPE;
- else if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
- policy_initial_link = SURF_LINK_FULLDUPLEX;
- }
-
- state_trace = tmgr_trace_new(A_surfxml_link_state_file);
- if(policy_initial_link == SURF_LINK_FULLDUPLEX)
+ if(struct_lnk->V_policy_initial_link == SURF_LINK_FULLDUPLEX)
{
- net_create_resource(bprintf("%s_UP",name_link), bw_initial, bw_trace,
- lat_initial, lat_trace, state_initial_link, state_trace,
- policy_initial_link, xbt_dict_new());
- net_create_resource(bprintf("%s_DOWN",name_link), bw_initial, bw_trace,
- lat_initial, lat_trace, state_initial_link, state_trace,
- policy_initial_link, xbt_dict_new());
+ net_create_resource(bprintf("%s_UP",struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, xbt_dict_new());
+ net_create_resource(bprintf("%s_DOWN",struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, xbt_dict_new());
}
else
{
- net_create_resource(name_link, bw_initial, bw_trace,
- lat_initial, lat_trace, state_initial_link, state_trace,
- policy_initial_link, xbt_dict_new());
+ net_create_resource(xbt_strdup(struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, xbt_dict_new());
}
}
#include "network_gtnets_private.h"
#include "gtnets/gtnets_interface.h"
#include "xbt/str.h"
+#include "surf/surfxml_parse_values.h"
static double time_to_next_flow_completion = -1;
/* Parse the XML for a network link */
static void parse_link_init(void)
{
- char *name;
- double bw;
- double lat;
e_surf_resource_state_t state;
- name = xbt_strdup(A_surfxml_link_id);
- surf_parse_get_double(&bw, A_surfxml_link_bandwidth);
- surf_parse_get_double(&lat, A_surfxml_link_latency);
state = SURF_RESOURCE_ON;
XBT_DEBUG("link_gtnets");
- tmgr_trace_t bw_trace;
- tmgr_trace_t state_trace;
- tmgr_trace_t lat_trace;
- bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
- lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
- state_trace = tmgr_trace_new(A_surfxml_link_state_file);
-
- if (bw_trace)
+ if (struct_lnk->V_link_bandwidth_file)
XBT_INFO
("The GTNetS network model doesn't support bandwidth state traces");
- if (lat_trace)
+ if (struct_lnk->V_link_latency_file)
XBT_INFO("The GTNetS network model doesn't support latency state traces");
- if (state_trace)
+ if (struct_lnk->V_link_state_file)
XBT_INFO("The GTNetS network model doesn't support link state traces");
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
+ if (struct_lnk->V_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
{
- link_new(bprintf("%s_UP",name), bw, lat, current_property_set);
- link_new(bprintf("%s_DOWN",name), bw, lat, current_property_set);
+ link_new(bprintf("%s_UP",struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_latency, current_property_set);
+ link_new(bprintf("%s_DOWN",struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_latency, current_property_set);
}
- else link_new(name, bw, lat, current_property_set);
+ else link_new(struct_lnk->V_link_id, struct_lnk->V_link_bandwidth, struct_lnk->V_link_latency, current_property_set);
current_property_set = NULL;
}
static void im_net_parse_link_init(void)
{
- char *name_link;
- double bw_initial;
- tmgr_trace_t bw_trace;
- double lat_initial;
- tmgr_trace_t lat_trace;
- e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
- e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
- tmgr_trace_t state_trace;
- XBT_DEBUG("link_CM02_im");
- name_link = xbt_strdup(A_surfxml_link_id);
- surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
- bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
- surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
- lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
-
- xbt_assert((A_surfxml_link_state == A_surfxml_link_state_ON)
- || (A_surfxml_link_state ==
- A_surfxml_link_state_OFF), "Invalid state");
- if (A_surfxml_link_state == A_surfxml_link_state_ON)
- state_initial_link = SURF_RESOURCE_ON;
- else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
- state_initial_link = SURF_RESOURCE_OFF;
-
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
- policy_initial_link = SURF_LINK_SHARED;
- else
- {
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FATPIPE)
- policy_initial_link = SURF_LINK_FATPIPE;
- else if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
- policy_initial_link = SURF_LINK_FULLDUPLEX;
- }
-
- state_trace = tmgr_trace_new(A_surfxml_link_state_file);
-
- if(policy_initial_link == SURF_LINK_FULLDUPLEX)
+ if(struct_lnk->V_policy_initial_link == SURF_LINK_FULLDUPLEX)
{
- im_net_create_resource(bprintf("%s_UP",name_link), bw_initial, bw_trace,
- lat_initial, lat_trace, state_initial_link, state_trace,
- policy_initial_link, xbt_dict_new());
- im_net_create_resource(bprintf("%s_DOWN",name_link), bw_initial, bw_trace,
- lat_initial, lat_trace, state_initial_link, state_trace,
- policy_initial_link, xbt_dict_new());
+ im_net_create_resource(bprintf("%s_UP",struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, xbt_dict_new());
+ im_net_create_resource(bprintf("%s_DOWN",struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, xbt_dict_new());
}
else
{
- im_net_create_resource(name_link, bw_initial, bw_trace,
- lat_initial, lat_trace, state_initial_link, state_trace,
- policy_initial_link, xbt_dict_new());
+ im_net_create_resource(xbt_strdup(struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, xbt_dict_new());
}
-
}
static void im_net_add_traces(void)
#include "surf/surfxml_parse_private.h"
#include "surf/random_mgr.h"
#include "instr/instr_private.h"
+#include "surf/surfxml_parse_values.h"
#define NO_MAX_DURATION -1.0
/**
* \brief Add a "router" to the network element list
*/
-static void parse_S_router(const char *router_id)
+static void parse_S_router(void)
{
network_element_info_t info = NULL;
-
if (current_routing->hierarchy == SURF_ROUTING_NULL)
current_routing->hierarchy = SURF_ROUTING_BASE;
- xbt_assert(!xbt_lib_get_or_null(as_router_lib,A_surfxml_router_id, ROUTING_ASR_LEVEL),
+ xbt_assert(!xbt_lib_get_or_null(as_router_lib,struct_router->V_router_id, ROUTING_ASR_LEVEL),
"Reading a router, processing unit \"%s\" already exists",
- router_id);
+ struct_router->V_router_id);
xbt_assert(current_routing->set_processing_unit,
"no defined method \"set_processing_unit\" in \"%s\"",
current_routing->name);
(*(current_routing->set_processing_unit)) (current_routing,
- router_id);
+ struct_router->V_router_id);
info = xbt_new0(s_network_element_info_t, 1);
info->rc_component = current_routing;
info->rc_type = SURF_NETWORK_ELEMENT_ROUTER;
- xbt_lib_set(as_router_lib,router_id,ROUTING_ASR_LEVEL,(void *) info);
+ xbt_lib_set(as_router_lib,struct_router->V_router_id,ROUTING_ASR_LEVEL,(void *) info);
if (strcmp(A_surfxml_router_coordinates,"")) {
if(!COORD_ASR_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'");
xbt_dynar_t ctn = xbt_str_split_str(A_surfxml_router_coordinates, " ");
xbt_dynar_shrink(ctn, 0);
- xbt_lib_set(as_router_lib,router_id,COORD_ASR_LEVEL,(void *) ctn);
+ xbt_lib_set(as_router_lib,struct_router->V_router_id,COORD_ASR_LEVEL,(void *) ctn);
}
}
*/
static void parse_S_router_XML(void)
{
- return parse_S_router(A_surfxml_router_id);
+ return parse_S_router();
}
/**
*/
static void parse_S_router_lua(const char* router_id)
{
- return parse_S_router(router_id);
+ struct_router->V_router_id = xbt_strdup(router_id);
+ struct_router->V_router_coord = xbt_strdup("");
+ return parse_S_router();
}
/**
void routing_parse_Scluster(void)
{
static int AX_ptr = 0;
-
- char *cluster_id = A_surfxml_cluster_id;
- char *cluster_prefix = A_surfxml_cluster_prefix;
- char *cluster_suffix = A_surfxml_cluster_suffix;
- char *cluster_radical = A_surfxml_cluster_radical;
- char *cluster_core = A_surfxml_cluster_core;
- char *cluster_bb_bw = A_surfxml_cluster_bb_bw;
- char *cluster_bb_lat = A_surfxml_cluster_bb_lat;
- char *cluster_power = xbt_strdup(A_surfxml_cluster_power);
- char *cluster_bw = xbt_strdup(A_surfxml_cluster_bw);
- char *cluster_lat = xbt_strdup(A_surfxml_cluster_lat);
char *host_id, *groups, *link_id = NULL;
- char *router_id = xbt_strdup(A_surfxml_cluster_router_id);
char *availability_file = xbt_strdup(A_surfxml_cluster_availability_file);
char *state_file = xbt_strdup(A_surfxml_cluster_state_file);
if(xbt_dict_size(patterns)==0)
patterns = xbt_dict_new();
- xbt_dict_set(patterns,"id",cluster_id,NULL);
- xbt_dict_set(patterns,"prefix",cluster_prefix,NULL);
- xbt_dict_set(patterns,"suffix",cluster_suffix,NULL);
-
- cluster_power = replace_random_parameter(cluster_power);
- cluster_bw = replace_random_parameter(cluster_bw);
- cluster_lat = replace_random_parameter(cluster_lat);
+ xbt_dict_set(patterns,"id",struct_cluster->V_cluster_id,NULL);
+ xbt_dict_set(patterns,"prefix",struct_cluster->V_cluster_prefix,NULL);
+ xbt_dict_set(patterns,"suffix",struct_cluster->V_cluster_suffix,NULL);
char *route_src_dst;
unsigned int iter;
surfxml_bufferstack_push(1);
- SURFXML_BUFFER_SET(AS_id, cluster_id);
+ SURFXML_BUFFER_SET(AS_id, struct_cluster->V_cluster_id);
SURFXML_BUFFER_SET(AS_routing, "RuleBased");
- XBT_DEBUG("<AS id=\"%s\"\trouting=\"RuleBased\">", cluster_id);
+ XBT_DEBUG("<AS id=\"%s\"\trouting=\"RuleBased\">", struct_cluster->V_cluster_id);
SURFXML_START_TAG(AS);
- radical_elements = xbt_str_split(cluster_radical, ",");
+ radical_elements = xbt_str_split(struct_cluster->V_cluster_radical, ",");
xbt_dynar_foreach(radical_elements, iter, groups) {
radical_ends = xbt_str_split(groups, "-");
switch (xbt_dynar_length(radical_ends)) {
case 1:
surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
- host_id = bprintf("%s%d%s", cluster_prefix, start, cluster_suffix);
- link_id = bprintf("%s_link_%d", cluster_id, start);
+ host_id = bprintf("%s%d%s", struct_cluster->V_cluster_prefix, start, struct_cluster->V_cluster_suffix);
+ link_id = bprintf("%s_link_%d", struct_cluster->V_cluster_id, start);
xbt_dict_set(patterns, "radical", bprintf("%d", start), xbt_free);
A_surfxml_host_state = A_surfxml_host_state_ON;
- XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, cluster_power);
+ XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, struct_cluster->S_cluster_power);
SURFXML_BUFFER_SET(host_id, host_id);
- SURFXML_BUFFER_SET(host_power, cluster_power);
+ SURFXML_BUFFER_SET(host_power, struct_cluster->S_cluster_power);
if(!strcmp(A_surfxml_cluster_availability_file,"")){
char* tmp_availability_file = xbt_strdup(availability_file);
SURFXML_BUFFER_SET(host_state_file, "");
}
- SURFXML_BUFFER_SET(host_core, cluster_core);
+ SURFXML_BUFFER_SET(host_core, struct_cluster->S_cluster_core);
SURFXML_BUFFER_SET(host_availability, "1.0");
SURFXML_BUFFER_SET(host_coordinates, "");
SURFXML_START_TAG(host);
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FATPIPE)
{A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;}
- XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,cluster_bw, cluster_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,struct_cluster->S_cluster_bw, struct_cluster->S_cluster_lat);
SURFXML_BUFFER_SET(link_id, link_id);
- SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
- SURFXML_BUFFER_SET(link_latency, cluster_lat);
+ SURFXML_BUFFER_SET(link_bandwidth, struct_cluster->S_cluster_bw);
+ SURFXML_BUFFER_SET(link_latency, struct_cluster->S_cluster_lat);
SURFXML_BUFFER_SET(link_bandwidth_file, "");
SURFXML_BUFFER_SET(link_latency_file, "");
SURFXML_BUFFER_SET(link_state_file, "");
xbt_dynar_get_as(radical_ends, 0, char *));
surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *));
for (i = start; i <= end; i++) {
- host_id = bprintf("%s%d%s", cluster_prefix, i, cluster_suffix);
- link_id = bprintf("%s_link_%d", cluster_id, i);
+ host_id = bprintf("%s%d%s", struct_cluster->V_cluster_prefix, i, struct_cluster->V_cluster_suffix);
+ link_id = bprintf("%s_link_%d", struct_cluster->V_cluster_id, i);
xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free);
A_surfxml_host_state = A_surfxml_host_state_ON;
- XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, cluster_power);
+ XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, struct_cluster->S_cluster_power);
SURFXML_BUFFER_SET(host_id, host_id);
- SURFXML_BUFFER_SET(host_power, cluster_power);
+ SURFXML_BUFFER_SET(host_power, struct_cluster->S_cluster_power);
if(!strcmp(A_surfxml_cluster_availability_file,"")){
char* tmp_availability_file = xbt_strdup(availability_file);
SURFXML_BUFFER_SET(host_state_file, "");
}
- SURFXML_BUFFER_SET(host_core, cluster_core);
+ SURFXML_BUFFER_SET(host_core, struct_cluster->S_cluster_core);
SURFXML_BUFFER_SET(host_availability, "1.0");
SURFXML_BUFFER_SET(host_coordinates, "");
SURFXML_START_TAG(host);
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FATPIPE)
{A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;}
- XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,cluster_bw, cluster_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,struct_cluster->S_cluster_bw, struct_cluster->S_cluster_lat);
SURFXML_BUFFER_SET(link_id, link_id);
- SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
- SURFXML_BUFFER_SET(link_latency, cluster_lat);
+ SURFXML_BUFFER_SET(link_bandwidth, struct_cluster->S_cluster_bw);
+ SURFXML_BUFFER_SET(link_latency, struct_cluster->S_cluster_lat);
SURFXML_BUFFER_SET(link_bandwidth_file, "");
SURFXML_BUFFER_SET(link_latency_file, "");
SURFXML_BUFFER_SET(link_state_file, "");
xbt_dynar_free(&radical_elements);
XBT_DEBUG(" ");
- if(!strcmp(router_id,""))
- router_id = bprintf("%s%s_router%s", cluster_prefix, cluster_id, cluster_suffix);
-
- XBT_DEBUG("<router id=\"%s\"/>", router_id);
- SURFXML_BUFFER_SET(router_id, router_id);
+ XBT_DEBUG("<router id=\"%s\"/>", struct_cluster->S_cluster_router_id);
+ SURFXML_BUFFER_SET(router_id, struct_cluster->S_cluster_router_id);
SURFXML_BUFFER_SET(router_coordinates, "");
SURFXML_START_TAG(router);
SURFXML_END_TAG(router);
- if(strcmp(cluster_bb_bw,"") && strcmp(cluster_bb_lat,"")){
- char *link_backbone = bprintf("%s_backbone", cluster_id);
- XBT_DEBUG("<link\tid=\"%s\" bw=\"%s\" lat=\"%s\"/>", link_backbone,cluster_bb_bw, cluster_bb_lat);
+ if(struct_cluster->S_cluster_bb_bw && struct_cluster->S_cluster_bb_lat){
+ char *link_backbone = bprintf("%s_backbone", struct_cluster->V_cluster_id);
+ XBT_DEBUG("<link\tid=\"%s\" bw=\"%s\" lat=\"%s\"/>", link_backbone,struct_cluster->S_cluster_bb_bw, struct_cluster->S_cluster_bb_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(cluster_bb_sharing_policy == A_surfxml_cluster_bb_sharing_policy_FATPIPE)
{A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;}
SURFXML_BUFFER_SET(link_id, link_backbone);
- SURFXML_BUFFER_SET(link_bandwidth, cluster_bb_bw);
- SURFXML_BUFFER_SET(link_latency, cluster_bb_lat);
+ SURFXML_BUFFER_SET(link_bandwidth, struct_cluster->S_cluster_bb_bw);
+ SURFXML_BUFFER_SET(link_latency, struct_cluster->S_cluster_bb_lat);
SURFXML_BUFFER_SET(link_bandwidth_file, "");
SURFXML_BUFFER_SET(link_latency_file, "");
SURFXML_BUFFER_SET(link_state_file, "");
char *new_suffix = xbt_strdup("");
- radical_elements = xbt_str_split(cluster_suffix, ".");
+ radical_elements = xbt_str_split(struct_cluster->V_cluster_suffix, ".");
xbt_dynar_foreach(radical_elements, iter, groups) {
if (strcmp(groups, "")) {
char *old_suffix = new_suffix;
free(old_suffix);
}
}
- route_src_dst = bprintf("%s(.*)%s", cluster_prefix, new_suffix);
+ route_src_dst = bprintf("%s(.*)%s", struct_cluster->V_cluster_prefix, new_suffix);
xbt_dynar_free(&radical_elements);
xbt_free(new_suffix);
- char *pcre_link_src = bprintf("%s_link_$1src", cluster_id);
- char *pcre_link_backbone = bprintf("%s_backbone", cluster_id);
- char *pcre_link_dst = bprintf("%s_link_$1dst", cluster_id);
+ char *pcre_link_src = bprintf("%s_link_$1src", struct_cluster->V_cluster_id);
+ char *pcre_link_backbone = bprintf("%s_backbone", struct_cluster->V_cluster_id);
+ char *pcre_link_dst = bprintf("%s_link_$1dst", struct_cluster->V_cluster_id);
//from router to router
- XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", router_id, router_id);
+ XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", struct_cluster->S_cluster_router_id, struct_cluster->S_cluster_router_id);
XBT_DEBUG("symmetrical=\"NO\">");
- SURFXML_BUFFER_SET(route_src, router_id);
- SURFXML_BUFFER_SET(route_dst, router_id);
+ SURFXML_BUFFER_SET(route_src, struct_cluster->S_cluster_router_id);
+ SURFXML_BUFFER_SET(route_dst, struct_cluster->S_cluster_router_id);
A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_NO;
SURFXML_START_TAG(route);
- if(strcmp(cluster_bb_bw,"") && strcmp(cluster_bb_lat,"")){
+ if(struct_cluster->S_cluster_bb_bw && struct_cluster->S_cluster_bb_lat){
XBT_DEBUG("<link_ctn\tid=\"%s\"/>", pcre_link_backbone);
SURFXML_BUFFER_SET(link_ctn_id, pcre_link_backbone);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
SURFXML_END_TAG(route);
//from host to router
- XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", route_src_dst, router_id);
+ XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", route_src_dst, struct_cluster->S_cluster_router_id);
XBT_DEBUG("symmetrical=\"NO\">");
SURFXML_BUFFER_SET(route_src, route_src_dst);
- SURFXML_BUFFER_SET(route_dst, router_id);
+ SURFXML_BUFFER_SET(route_dst, struct_cluster->S_cluster_router_id);
A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_NO;
SURFXML_START_TAG(route);
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- if(strcmp(cluster_bb_bw,"") && strcmp(cluster_bb_lat,"")){
+ if(struct_cluster->S_cluster_bb_bw && struct_cluster->S_cluster_bb_lat){
XBT_DEBUG("<link_ctn\tid=\"%s\"/>", pcre_link_backbone);
SURFXML_BUFFER_SET(link_ctn_id, pcre_link_backbone);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
SURFXML_END_TAG(route);
//from router to host
- XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", router_id, route_src_dst);
+ XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", struct_cluster->S_cluster_router_id, route_src_dst);
XBT_DEBUG("symmetrical=\"NO\">");
- SURFXML_BUFFER_SET(route_src, router_id);
+ SURFXML_BUFFER_SET(route_src, struct_cluster->S_cluster_router_id);
SURFXML_BUFFER_SET(route_dst, route_src_dst);
A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_NO;
SURFXML_START_TAG(route);
- if(strcmp(cluster_bb_bw,"") && strcmp(cluster_bb_lat,"")){
+ if(struct_cluster->S_cluster_bb_bw && struct_cluster->S_cluster_bb_lat){
XBT_DEBUG("<link_ctn\tid=\"%s\"/>", pcre_link_backbone);
SURFXML_BUFFER_SET(link_ctn_id, pcre_link_backbone);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- if(strcmp(cluster_bb_bw,"") && strcmp(cluster_bb_lat,"")){
+ if(struct_cluster->S_cluster_bb_bw && struct_cluster->S_cluster_bb_lat){
XBT_DEBUG("<link_ctn\tid=\"%s\"/>", pcre_link_backbone);
SURFXML_BUFFER_SET(link_ctn_id, pcre_link_backbone);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
free(pcre_link_src);
free(route_src_dst);
- xbt_free(cluster_bw);
- xbt_free(cluster_lat);
- xbt_free(cluster_power);
xbt_free(availability_file);
xbt_free(state_file);
- xbt_free(router_id);
xbt_dict_free(&patterns);
XBT_DEBUG("</AS>");
static void routing_parse_Speer(void)
{
static int AX_ptr = 0;
-
- char *peer_id = A_surfxml_peer_id;
- char *peer_power = A_surfxml_peer_power;
- char *peer_bw_in = A_surfxml_peer_bw_in;
- char *peer_bw_out = A_surfxml_peer_bw_out;
- char *peer_lat = A_surfxml_peer_lat;
- char *peer_coord = A_surfxml_peer_coordinates;
- char *peer_state_file = A_surfxml_peer_state_file;
- char *peer_availability_file = A_surfxml_peer_availability_file;
-
char *host_id = NULL;
char *router_id, *link_router, *link_backbone, *link_id_up, *link_id_down;
surfxml_bufferstack_push(1);
- SURFXML_BUFFER_SET(AS_id, peer_id);
+ SURFXML_BUFFER_SET(AS_id, struct_peer->V_peer_id);
SURFXML_BUFFER_SET(AS_routing, "Full");
- XBT_DEBUG("<AS id=\"%s\"\trouting=\"Full\">", peer_id);
+ XBT_DEBUG("<AS id=\"%s\"\trouting=\"Full\">", struct_peer->V_peer_id);
SURFXML_START_TAG(AS);
XBT_DEBUG(" ");
- host_id = bprintf("peer_%s", peer_id);
- router_id = bprintf("router_%s", peer_id);
- link_id_up = bprintf("link_%s_up", peer_id);
- link_id_down = bprintf("link_%s_down", peer_id);
+ host_id = bprintf("peer_%s", struct_peer->V_peer_id);
+ router_id = bprintf("router_%s", struct_peer->V_peer_id);
+ link_id_up = bprintf("link_%s_up", struct_peer->V_peer_id);
+ link_id_down = bprintf("link_%s_down", struct_peer->V_peer_id);
- link_router = bprintf("%s_link_router", peer_id);
- link_backbone = bprintf("%s_backbone", peer_id);
+ link_router = bprintf("%s_link_router", struct_peer->V_peer_id);
+ link_backbone = bprintf("%s_backbone", struct_peer->V_peer_id);
- XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\"/>", host_id, peer_power);
+ XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\"/>", host_id, struct_peer->V_peer_power);
A_surfxml_host_state = A_surfxml_host_state_ON;
SURFXML_BUFFER_SET(host_id, host_id);
- SURFXML_BUFFER_SET(host_power, peer_power);
+ SURFXML_BUFFER_SET(host_power, struct_peer->V_peer_power);
SURFXML_BUFFER_SET(host_availability, "1.0");
- SURFXML_BUFFER_SET(host_availability_file, peer_availability_file);
- SURFXML_BUFFER_SET(host_state_file, peer_state_file);
+ SURFXML_BUFFER_SET(host_availability_file, struct_peer->V_peer_availability_trace);
+ SURFXML_BUFFER_SET(host_state_file, struct_peer->V_peer_state_trace);
SURFXML_BUFFER_SET(host_coordinates, "");
SURFXML_BUFFER_SET(host_core, "1.0");
SURFXML_START_TAG(host);
SURFXML_END_TAG(host);
- XBT_DEBUG("<router id=\"%s\"\tcoordinates=\"%s\"/>", router_id, peer_coord);
+ XBT_DEBUG("<router id=\"%s\"\tcoordinates=\"%s\"/>", router_id, struct_peer->V_peer_coord);
SURFXML_BUFFER_SET(router_id, router_id);
- SURFXML_BUFFER_SET(router_coordinates, peer_coord);
+ SURFXML_BUFFER_SET(router_coordinates, struct_peer->V_peer_coord);
SURFXML_START_TAG(router);
SURFXML_END_TAG(router);
- XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_up, peer_bw_in, peer_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_up, struct_peer->V_peer_bw_in, struct_peer->V_peer_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
SURFXML_BUFFER_SET(link_id, link_id_up);
- SURFXML_BUFFER_SET(link_bandwidth, peer_bw_in);
- SURFXML_BUFFER_SET(link_latency, peer_lat);
+ SURFXML_BUFFER_SET(link_bandwidth, struct_peer->V_peer_bw_in);
+ SURFXML_BUFFER_SET(link_latency, struct_peer->V_peer_lat);
SURFXML_BUFFER_SET(link_bandwidth_file, "");
SURFXML_BUFFER_SET(link_latency_file, "");
SURFXML_BUFFER_SET(link_state_file, "");
SURFXML_START_TAG(link);
SURFXML_END_TAG(link);
- XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_down, peer_bw_out, peer_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_down, struct_peer->V_peer_bw_out, struct_peer->V_peer_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
SURFXML_BUFFER_SET(link_id, link_id_down);
- SURFXML_BUFFER_SET(link_bandwidth, peer_bw_out);
- SURFXML_BUFFER_SET(link_latency, peer_lat);
+ SURFXML_BUFFER_SET(link_bandwidth, struct_peer->V_peer_bw_out);
+ SURFXML_BUFFER_SET(link_latency, struct_peer->V_peer_lat);
SURFXML_BUFFER_SET(link_bandwidth_file, "");
SURFXML_BUFFER_SET(link_latency_file, "");
SURFXML_BUFFER_SET(link_state_file, "");
#include "xbt/dict.h"
#include "surf/surfxml_parse_private.h"
#include "surf/surf_private.h"
-#include "surf/surfxml_parse_values.h"
+
+host_t struct_host;
+router_t struct_router;
+cluster_t struct_cluster;
+peer_t struct_peer;
+link_t struct_lnk;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf,
"Logging specific to the SURF parsing module");
}
void STag_surfxml_host(void){
-
- s_host.V_host_id = xbt_strdup(A_surfxml_host_id);
- s_host.V_host_power_peak = get_cpu_power(A_surfxml_host_power);
- surf_parse_get_double(&(s_host.V_host_power_scale), A_surfxml_host_availability);
- surf_parse_get_int(&(s_host.V_host_core),A_surfxml_host_core);
- s_host.V_host_power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
- s_host.V_host_state_trace = tmgr_trace_new(A_surfxml_host_state_file);
+// XBT_INFO("STag_surfxml_host [%s]",A_surfxml_host_id);
+ struct_host = xbt_new0(s_host_t, 1);
+ struct_host->V_host_id = xbt_strdup(A_surfxml_host_id);
+ struct_host->V_host_power_peak = get_cpu_power(A_surfxml_host_power);
+ surf_parse_get_double(&(struct_host->V_host_power_scale), A_surfxml_host_availability);
+ surf_parse_get_int(&(struct_host->V_host_core),A_surfxml_host_core);
+ struct_host->V_host_power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
+ struct_host->V_host_state_trace = tmgr_trace_new(A_surfxml_host_state_file);
xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
(A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state");
if (A_surfxml_host_state == A_surfxml_host_state_ON)
- s_host.V_host_state_initial = SURF_RESOURCE_ON;
+ struct_host->V_host_state_initial = SURF_RESOURCE_ON;
if (A_surfxml_host_state == A_surfxml_host_state_OFF)
- s_host.V_host_state_initial = SURF_RESOURCE_OFF;
- s_host.V_host_coord = xbt_strdup(A_surfxml_host_coordinates);
+ struct_host->V_host_state_initial = SURF_RESOURCE_OFF;
+ struct_host->V_host_coord = xbt_strdup(A_surfxml_host_coordinates);
surfxml_call_cb_functions(STag_surfxml_host_cb_list);
}
void ETag_surfxml_host(void){
- xbt_free(s_host.V_host_id);
- s_host.V_host_power_peak = 0.0;
- s_host.V_host_core = 0;
- s_host.V_host_power_scale = 0.0;
- tmgr_trace_free(s_host.V_host_power_trace);
- s_host.V_host_state_initial = SURF_RESOURCE_ON;
- tmgr_trace_free(s_host.V_host_state_trace);
- xbt_free(s_host.V_host_coord);
-
surfxml_call_cb_functions(ETag_surfxml_host_cb_list);
+ //xbt_free(struct_host->V_host_id);
+ struct_host->V_host_power_peak = 0.0;
+ struct_host->V_host_core = 0;
+ struct_host->V_host_power_scale = 0.0;
+ struct_host->V_host_state_initial = SURF_RESOURCE_ON;
+ struct_host->V_host_power_trace = NULL;
+ struct_host->V_host_state_trace = NULL;
+ xbt_free(struct_host->V_host_coord);
+ //xbt_free(host);
}
void STag_surfxml_router(void){
-
- s_router.V_router_id = xbt_strdup(A_surfxml_router_id);
- s_router.V_router_coord = xbt_strdup(A_surfxml_router_coordinates);
-
+ struct_router = xbt_new0(s_router_t, 1);
+ struct_router->V_router_id = xbt_strdup(A_surfxml_router_id);
+ struct_router->V_router_coord = xbt_strdup(A_surfxml_router_coordinates);
surfxml_call_cb_functions(STag_surfxml_router_cb_list);
}
void ETag_surfxml_router(void){
- xbt_free(s_router.V_router_id);
- xbt_free(s_router.V_router_coord);
-
surfxml_call_cb_functions(ETag_surfxml_router_cb_list);
+ xbt_free(struct_router->V_router_id);
+ xbt_free(struct_router->V_router_coord);
+ xbt_free(struct_router);
}
void STag_surfxml_cluster(void){
-
- s_cluster.V_cluster_id = xbt_strdup(A_surfxml_cluster_id);
- s_cluster.V_cluster_prefix = xbt_strdup(A_surfxml_cluster_prefix);
- s_cluster.V_cluster_suffix = xbt_strdup(A_surfxml_cluster_suffix);
- s_cluster.V_cluster_radical = xbt_strdup(A_surfxml_cluster_radical);
- surf_parse_get_double(&(s_cluster.V_cluster_power), A_surfxml_cluster_power);
- surf_parse_get_int(&(s_cluster.V_cluster_core), A_surfxml_cluster_core);
- surf_parse_get_double(&(s_cluster.V_cluster_bw), A_surfxml_cluster_bw);
- surf_parse_get_double(&(s_cluster.V_cluster_lat), A_surfxml_cluster_lat);
- surf_parse_get_double(&(s_cluster.V_cluster_bb_bw), A_surfxml_cluster_bb_bw);
- surf_parse_get_double(&(s_cluster.V_cluster_bb_lat), A_surfxml_cluster_bb_lat);
- s_cluster.V_cluster_router_id = xbt_strdup(A_surfxml_cluster_router_id);
- s_cluster.V_cluster_sharing_policy = AX_surfxml_cluster_sharing_policy;
- s_cluster.V_cluster_bb_sharing_policy = AX_surfxml_cluster_bb_sharing_policy;
+ struct_cluster = xbt_new0(s_cluster_t, 1);
+ struct_cluster->V_cluster_id = xbt_strdup(A_surfxml_cluster_id);
+ struct_cluster->V_cluster_prefix = xbt_strdup(A_surfxml_cluster_prefix);
+ struct_cluster->V_cluster_suffix = xbt_strdup(A_surfxml_cluster_suffix);
+ struct_cluster->V_cluster_radical = xbt_strdup(A_surfxml_cluster_radical);
+ struct_cluster->S_cluster_power = xbt_strdup(A_surfxml_cluster_power);
+ struct_cluster->S_cluster_core = xbt_strdup(A_surfxml_cluster_core);
+ struct_cluster->S_cluster_bw = xbt_strdup(A_surfxml_cluster_bw);
+ struct_cluster->S_cluster_lat = xbt_strdup(A_surfxml_cluster_lat);
+ struct_cluster->S_cluster_bb_bw = xbt_strdup(A_surfxml_cluster_bb_bw);
+ struct_cluster->S_cluster_bb_lat = xbt_strdup(A_surfxml_cluster_bb_lat);
+ if(!strcmp(A_surfxml_cluster_router_id,""))
+ struct_cluster->S_cluster_router_id = bprintf("%s%s_router%s",
+ struct_cluster->V_cluster_prefix,
+ struct_cluster->V_cluster_id,
+ struct_cluster->V_cluster_suffix);
+ else
+ struct_cluster->S_cluster_router_id = xbt_strdup(A_surfxml_cluster_router_id);
+
+ struct_cluster->V_cluster_sharing_policy = AX_surfxml_cluster_sharing_policy;
+ struct_cluster->V_cluster_bb_sharing_policy = AX_surfxml_cluster_bb_sharing_policy;
surfxml_call_cb_functions(STag_surfxml_cluster_cb_list);
}
void ETag_surfxml_cluster(void){
- xbt_free(s_cluster.V_cluster_id);
- xbt_free(s_cluster.V_cluster_prefix);
- xbt_free(s_cluster.V_cluster_suffix);
- xbt_free(s_cluster.V_cluster_radical);
- s_cluster.V_cluster_power = 0;
- s_cluster.V_cluster_core = 0;
- s_cluster.V_cluster_bw = 0;
- s_cluster.V_cluster_lat = 0;
- s_cluster.V_cluster_bb_bw = 0;
- s_cluster.V_cluster_bb_lat = 0;
- xbt_free(s_cluster.V_cluster_router_id);
- s_cluster.V_cluster_sharing_policy = 0;
- s_cluster.V_cluster_bb_sharing_policy = 0;
-
surfxml_call_cb_functions(ETag_surfxml_cluster_cb_list);
+ xbt_free(struct_cluster->V_cluster_id);
+ xbt_free(struct_cluster->V_cluster_prefix);
+ xbt_free(struct_cluster->V_cluster_suffix);
+ xbt_free(struct_cluster->V_cluster_radical);
+ xbt_free(struct_cluster->S_cluster_power);
+ xbt_free(struct_cluster->S_cluster_core);
+ xbt_free(struct_cluster->S_cluster_bw);
+ xbt_free(struct_cluster->S_cluster_lat);
+ xbt_free(struct_cluster->S_cluster_bb_bw);
+ xbt_free(struct_cluster->S_cluster_bb_lat);
+ xbt_free(struct_cluster->S_cluster_router_id);
+ struct_cluster->V_cluster_sharing_policy = 0;
+ struct_cluster->V_cluster_bb_sharing_policy = 0;
+ xbt_free(struct_cluster);
}
void STag_surfxml_peer(void){
-
- s_peer.V_peer_id = xbt_strdup(A_surfxml_peer_id);
- surf_parse_get_double(&(s_peer.V_peer_power), A_surfxml_peer_power);
- surf_parse_get_double(&(s_peer.V_peer_bw_in), A_surfxml_peer_bw_in);
- surf_parse_get_double(&(s_peer.V_peer_bw_out), A_surfxml_peer_bw_out);
- surf_parse_get_double(&(s_peer.V_peer_lat), A_surfxml_peer_lat);
- s_peer.V_peer_coord = xbt_strdup(A_surfxml_peer_coordinates);
- s_peer.V_peer_availability_trace = tmgr_trace_new(A_surfxml_peer_availability_file);
- s_peer.V_peer_state_trace = tmgr_trace_new(A_surfxml_peer_state_file);
-
+ struct_peer = xbt_new0(s_peer_t, 1);
+ struct_peer->V_peer_id = xbt_strdup(A_surfxml_peer_id);
+ struct_peer->V_peer_power = xbt_strdup(A_surfxml_peer_power);
+ struct_peer->V_peer_bw_in = xbt_strdup(A_surfxml_peer_bw_in);
+ struct_peer->V_peer_bw_out = xbt_strdup(A_surfxml_peer_bw_out);
+ struct_peer->V_peer_lat = xbt_strdup(A_surfxml_peer_lat);
+ struct_peer->V_peer_coord = xbt_strdup(A_surfxml_peer_coordinates);
+ struct_peer->V_peer_availability_trace = xbt_strdup(A_surfxml_peer_availability_file);
+ struct_peer->V_peer_state_trace = xbt_strdup(A_surfxml_peer_state_file);
surfxml_call_cb_functions(STag_surfxml_peer_cb_list);
}
void ETag_surfxml_peer(void){
- xbt_free(s_peer.V_peer_id);
- s_peer.V_peer_power = 0;
- s_peer.V_peer_bw_in = 0;
- s_peer.V_peer_bw_out = 0;
- s_peer.V_peer_lat = 0;
- xbt_free(s_peer.V_peer_coord);
- tmgr_trace_free(s_peer.V_peer_availability_trace);
- tmgr_trace_free(s_peer.V_peer_state_trace);
-
surfxml_call_cb_functions(ETag_surfxml_peer_cb_list);
+ xbt_free(struct_peer->V_peer_id);
+ xbt_free(struct_peer->V_peer_power);
+ xbt_free(struct_peer->V_peer_bw_in);
+ xbt_free(struct_peer->V_peer_bw_out);
+ xbt_free(struct_peer->V_peer_lat);
+ xbt_free(struct_peer->V_peer_coord);
+ xbt_free(struct_peer->V_peer_availability_trace);
+ xbt_free(struct_peer->V_peer_state_trace);
+ xbt_free(struct_peer);
}
void STag_surfxml_link(void){
-
- s_link.V_link_id = xbt_strdup(A_surfxml_link_id);
- surf_parse_get_double(&(s_link.V_link_bandwidth),A_surfxml_link_bandwidth);
- s_link.V_link_bandwidth_file = tmgr_trace_new(A_surfxml_link_bandwidth_file);
- surf_parse_get_double(&(s_link.V_link_latency),A_surfxml_link_latency);
- s_link.V_link_latency_file = tmgr_trace_new(A_surfxml_link_latency_file);
+ struct_lnk = xbt_new0(s_link_t, 1);
+ struct_lnk->V_link_id = xbt_strdup(A_surfxml_link_id);
+ surf_parse_get_double(&(struct_lnk->V_link_bandwidth),A_surfxml_link_bandwidth);
+ struct_lnk->V_link_bandwidth_file = tmgr_trace_new(A_surfxml_link_bandwidth_file);
+ surf_parse_get_double(&(struct_lnk->V_link_latency),A_surfxml_link_latency);
+ struct_lnk->V_link_latency_file = tmgr_trace_new(A_surfxml_link_latency_file);
xbt_assert((A_surfxml_link_state == A_surfxml_link_state_ON) ||
(A_surfxml_link_state == A_surfxml_link_state_OFF), "Invalid state");
if (A_surfxml_link_state == A_surfxml_link_state_ON)
- s_link.V_link_state = SURF_RESOURCE_ON;
+ struct_lnk->V_link_state = SURF_RESOURCE_ON;
if (A_surfxml_link_state == A_surfxml_link_state_OFF)
- s_link.V_link_state = SURF_RESOURCE_OFF;
- s_link.V_link_state_file = tmgr_trace_new(A_surfxml_link_state_file);
- s_link.V_link_sharing_policy = A_surfxml_link_sharing_policy;
+ struct_lnk->V_link_state = SURF_RESOURCE_OFF;
+ struct_lnk->V_link_state_file = tmgr_trace_new(A_surfxml_link_state_file);
+ struct_lnk->V_link_sharing_policy = A_surfxml_link_sharing_policy;
+
+ if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
+ struct_lnk->V_policy_initial_link = SURF_LINK_SHARED;
+ else
+ {
+ if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FATPIPE)
+ struct_lnk->V_policy_initial_link = SURF_LINK_FATPIPE;
+ else if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
+ struct_lnk->V_policy_initial_link = SURF_LINK_FULLDUPLEX;
+ }
+
surfxml_call_cb_functions(STag_surfxml_link_cb_list);
}
void ETag_surfxml_link(void){
- xbt_free(s_link.V_link_id);
- s_link.V_link_bandwidth = 0;
- tmgr_trace_free(s_link.V_link_bandwidth_file);
- s_link.V_link_latency = 0;
- tmgr_trace_free(s_link.V_link_latency_file);
- s_link.V_link_state = SURF_RESOURCE_ON;
- tmgr_trace_free(s_link.V_link_state_file);
- s_link.V_link_sharing_policy = 0;
-
surfxml_call_cb_functions(ETag_surfxml_link_cb_list);
+ xbt_free(struct_lnk->V_link_id);
+ struct_lnk->V_link_bandwidth = 0;
+ struct_lnk->V_link_bandwidth_file = NULL;
+ struct_lnk->V_link_latency = 0;
+ struct_lnk->V_link_latency_file = NULL;
+ struct_lnk->V_link_state = SURF_RESOURCE_ON;
+ struct_lnk->V_link_state_file = NULL;
+ struct_lnk->V_link_sharing_policy = 0;
+ xbt_free(struct_lnk);
}
void STag_surfxml_route(void){
default:
xbt_die("Cannot connect trace %s to %s: kind of trace unknown",
A_surfxml_trace_connect_trace, A_surfxml_trace_connect_element);
+ break;
}
}
static void ptask_parse_cpu_init(void)
{
- double power_scale = 0.0;
- double power_initial = 0.0;
- tmgr_trace_t power_trace = NULL;
- e_surf_resource_state_t state_initial = SURF_RESOURCE_OFF;
- tmgr_trace_t state_trace = NULL;
-
- power_scale = get_cpu_power(A_surfxml_host_power);
- surf_parse_get_double(&power_initial, A_surfxml_host_availability);
- power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
-
- xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
- (A_surfxml_host_state == A_surfxml_host_state_OFF),
- "Invalid state");
- if (A_surfxml_host_state == A_surfxml_host_state_ON)
- state_initial = SURF_RESOURCE_ON;
- if (A_surfxml_host_state == A_surfxml_host_state_OFF)
- state_initial = SURF_RESOURCE_OFF;
- state_trace = tmgr_trace_new(A_surfxml_host_state_file);
-
- ptask_cpu_create_resource(A_surfxml_host_id, power_scale, power_initial, power_trace,
- state_initial, state_trace, current_property_set);
+ ptask_cpu_create_resource(
+ struct_host->V_host_id,
+ struct_host->V_host_power_peak,
+ struct_host->V_host_power_scale,
+ struct_host->V_host_power_trace,
+ struct_host->V_host_state_initial,
+ struct_host->V_host_state_trace,
+ current_property_set);
current_property_set=NULL;
}
static void ptask_parse_link_init(void)
{
- double bw_initial;
- tmgr_trace_t bw_trace;
- double lat_initial;
- tmgr_trace_t lat_trace;
- e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
- e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
- tmgr_trace_t state_trace;
- char *name_link_up = NULL;
- char *name_link_down = NULL;
- char *name_link = NULL;
-
- if(A_surfxml_link_sharing_policy ==
- A_surfxml_link_sharing_policy_FULLDUPLEX) {
- name_link_up = bprintf("%s_UP", A_surfxml_link_id);
- name_link_down = bprintf("%s_DOWN", A_surfxml_link_id);
- } else {
- name_link = xbt_strdup(A_surfxml_link_id);
- }
- surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
- bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
- surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
- lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
-
- xbt_assert((A_surfxml_link_state == A_surfxml_link_state_ON)
- || (A_surfxml_link_state ==
- A_surfxml_link_state_OFF), "Invalid state");
- if (A_surfxml_link_state == A_surfxml_link_state_ON)
- state_initial_link = SURF_RESOURCE_ON;
- else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
- state_initial_link = SURF_RESOURCE_OFF;
-
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
- policy_initial_link = SURF_LINK_SHARED;
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FATPIPE)
- policy_initial_link = SURF_LINK_FATPIPE;
- if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
- policy_initial_link = SURF_LINK_FULLDUPLEX;
-
- state_trace = tmgr_trace_new(A_surfxml_link_state_file);
-
- if(policy_initial_link == SURF_LINK_FULLDUPLEX)
+ if(struct_lnk->V_policy_initial_link == SURF_LINK_FULLDUPLEX)
{
- ptask_link_create_resource(name_link_up, bw_initial, bw_trace, lat_initial, lat_trace,
- state_initial_link, state_trace, policy_initial_link,
- current_property_set);
- ptask_link_create_resource(name_link_down, bw_initial, bw_trace, lat_initial, lat_trace,
- state_initial_link, state_trace, policy_initial_link,
- current_property_set);
+ ptask_link_create_resource(bprintf("%s_UP",struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, current_property_set);
+ ptask_link_create_resource(bprintf("%s_DOWN",struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, current_property_set);
}
else
{
- ptask_link_create_resource(name_link, bw_initial, bw_trace, lat_initial, lat_trace,
- state_initial_link, state_trace, policy_initial_link,
- current_property_set);
+ ptask_link_create_resource(xbt_strdup(struct_lnk->V_link_id), struct_lnk->V_link_bandwidth, struct_lnk->V_link_bandwidth_file,
+ struct_lnk->V_link_latency, struct_lnk->V_link_latency_file, struct_lnk->V_link_state, struct_lnk->V_link_state_file,
+ struct_lnk->V_policy_initial_link, current_property_set);
}
+
current_property_set = NULL;
}