SURF_RESOURCE_OFF = 0 /**< Down & broken */
} e_surf_resource_state_t;
+typedef enum {
+ SURF_LINK_FULLDUPLEX = 2,
+ SURF_LINK_SHARED = 1,
+ SURF_LINK_FATPIPE = 0
+} e_surf_link_sharing_policy_t;
/*
* Platform creation functions. Instead of passing 123 arguments to the creation functions
} s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
typedef struct {
- const char* V_link_id;
- double V_link_bandwidth;
- tmgr_trace_t V_link_bandwidth_file;
- double V_link_latency;
- tmgr_trace_t V_link_latency_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;
+ const char* id;
+ double bandwidth;
+ tmgr_trace_t bandwidth_trace;
+ double latency;
+ tmgr_trace_t latency_trace;
+ e_surf_resource_state_t state;
+ tmgr_trace_t state_trace;
+ e_surf_link_sharing_policy_t policy;
xbt_dict_t properties;
} s_sg_platf_link_cbarg_t, *sg_platf_link_cbarg_t;
// get Id Value
lua_pushstring(L, "id");
lua_gettable(L, -2);
- link.V_link_id = lua_tostring(L, -1);
+ link.id = lua_tostring(L, -1);
lua_pop(L, 1);
// get bandwidth value
lua_pushstring(L, "bandwidth");
lua_gettable(L, -2);
- link.V_link_bandwidth = lua_tonumber(L, -1);
+ link.bandwidth = lua_tonumber(L, -1);
lua_pop(L, 1);
//get latency value
lua_pushstring(L, "latency");
lua_gettable(L, -2);
- link.V_link_latency = lua_tonumber(L, -1);
+ link.latency = lua_tonumber(L, -1);
lua_pop(L, 1);
/*Optional Arguments */
//get bandwidth_trace value
lua_pushstring(L, "bandwidth_trace");
lua_gettable(L, -2);
- link.V_link_bandwidth_file = tmgr_trace_new(lua_tostring(L, -1));
+ link.bandwidth_trace = tmgr_trace_new(lua_tostring(L, -1));
lua_pop(L, 1);
//get latency_trace value
lua_pushstring(L, "latency_trace");
lua_gettable(L, -2);
- link.V_link_latency_file = tmgr_trace_new(lua_tostring(L, -1));
+ link.latency_trace = tmgr_trace_new(lua_tostring(L, -1));
lua_pop(L, 1);
//get state_trace value
lua_pushstring(L, "state_trace");
lua_gettable(L, -2);
- link.V_link_state_file = tmgr_trace_new(lua_tostring(L, -1));
+ link.state_trace = tmgr_trace_new(lua_tostring(L, -1));
lua_pop(L, 1);
//get state_initial value
lua_pushstring(L, "state_initial");
lua_gettable(L, -2);
if (lua_tonumber(L, -1))
- link.V_link_state = SURF_RESOURCE_ON;
+ link.state = SURF_RESOURCE_ON;
else
- link.V_link_state = SURF_RESOURCE_OFF;
+ link.state = SURF_RESOURCE_OFF;
lua_pop(L, 1);
//get policy value
policy = lua_tostring(L, -1);
lua_pop(L, 1);
if (policy && !strcmp(policy,"FULLDUPLEX")) {
- link.V_link_sharing_policy = SURF_LINK_FULLDUPLEX;
+ link.policy = SURF_LINK_FULLDUPLEX;
} else if (policy && !strcmp(policy,"FATPIPE")) {
- link.V_link_sharing_policy = SURF_LINK_FATPIPE;
+ link.policy = SURF_LINK_FATPIPE;
} else {
- link.V_link_sharing_policy = SURF_LINK_SHARED;
+ link.policy = SURF_LINK_SHARED;
}
sg_platf_new_link(&link);
SG_BEGIN_DECL()
/* Actions and models are highly connected structures... */
-typedef enum {
- SURF_LINK_FULLDUPLEX = 2,
- SURF_LINK_SHARED = 1,
- SURF_LINK_FATPIPE = 0
-} e_surf_link_sharing_policy_t;
-
typedef enum {
SURF_NETWORK_ELEMENT_NULL = 0, /* NULL */
SURF_NETWORK_ELEMENT_HOST, /* host type */
{
container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
- double bandwidth_value = link->V_link_bandwidth;
- double latency_value = link->V_link_latency;
+ double bandwidth_value = link->bandwidth;
+ double latency_value = link->latency;
xbt_dynar_t links_to_create = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
- if (link->V_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX){
- char *up = bprintf("%s_UP", link->V_link_id);
- char *down = bprintf("%s_DOWN", link->V_link_id);
+ if (link->policy == SURF_LINK_FULLDUPLEX){
+ char *up = bprintf("%s_UP", link->id);
+ char *down = bprintf("%s_DOWN", 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->V_link_id));
+ xbt_dynar_push_as (links_to_create, char*, strdup(link->id));
}
char *link_name = NULL;
{
XBT_DEBUG("link_CM02");
- if(link->V_policy_initial_link == SURF_LINK_FULLDUPLEX)
+ if(link->policy == SURF_LINK_FULLDUPLEX)
{
- net_create_resource(bprintf("%s_UP",link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, link->properties);
- net_create_resource(bprintf("%s_DOWN",link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, NULL); // FIXME: We need to deep copy the properties or we won't be able to free it
+ net_create_resource(bprintf("%s_UP",link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, link->properties);
+ net_create_resource(bprintf("%s_DOWN",link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, NULL); // FIXME: We need to deep copy the properties or we won't be able to free it
}
else
{
- net_create_resource(xbt_strdup(link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, link->properties);
+ net_create_resource(xbt_strdup(link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, link->properties);
}
}
static void im_net_parse_link_init(sg_platf_link_cbarg_t link)
{
- if(link->V_policy_initial_link == SURF_LINK_FULLDUPLEX)
+ if(link->policy == SURF_LINK_FULLDUPLEX)
{
- im_net_create_resource(bprintf("%s_UP",link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, link->properties);
- im_net_create_resource(bprintf("%s_DOWN",link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, NULL); // FIXME: We need to deep copy the properties or we won't be able to free it
+ im_net_create_resource(bprintf("%s_UP",link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, link->properties);
+ im_net_create_resource(bprintf("%s_DOWN",link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, NULL); // FIXME: We need to deep copy the properties or we won't be able to free it
}
else
{
- im_net_create_resource(xbt_strdup(link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, link->properties);
+ im_net_create_resource(xbt_strdup(link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, link->properties);
}
}
XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_id,struct_cluster->S_cluster_bw, struct_cluster->S_cluster_lat);
memset(&link,0,sizeof(link));
- link.V_link_id = link_id;
- link.V_link_bandwidth = struct_cluster->S_cluster_bw;
- link.V_link_latency = struct_cluster->S_cluster_lat;
- link.V_link_bandwidth_file = NULL;
- link.V_link_latency_file = NULL;
- link.V_link_state_file = NULL;
- link.V_link_state = SURF_RESOURCE_ON;
- link.V_link_sharing_policy = A_surfxml_link_sharing_policy;
+ link.id = link_id;
+ link.bandwidth = struct_cluster->S_cluster_bw;
+ link.latency = struct_cluster->S_cluster_lat;
+ link.state = SURF_RESOURCE_ON;
switch (A_surfxml_link_sharing_policy) {
case A_surfxml_link_sharing_policy_SHARED:
- link.V_policy_initial_link = SURF_LINK_SHARED;
+ link.policy = SURF_LINK_SHARED;
break;
case A_surfxml_link_sharing_policy_FATPIPE:
- link.V_policy_initial_link = SURF_LINK_FATPIPE;
+ link.policy = SURF_LINK_FATPIPE;
break;
case A_surfxml_link_sharing_policy_FULLDUPLEX:
- link.V_policy_initial_link = SURF_LINK_FULLDUPLEX;
+ link.policy = SURF_LINK_FULLDUPLEX;
break;
case AU_surfxml_link_sharing_policy:
surf_parse_error(bprintf("Invalid sharing policy in cluster %s (please report this bug, this shouldn't happen)",struct_cluster->V_cluster_id));
XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_id,struct_cluster->S_cluster_bw, struct_cluster->S_cluster_lat);
memset(&link,0,sizeof(link));
- link.V_link_id = link_id;
- link.V_link_bandwidth = struct_cluster->S_cluster_bw;
- link.V_link_latency = struct_cluster->S_cluster_lat;
- link.V_link_bandwidth_file = NULL;
- link.V_link_latency_file = NULL;
- link.V_link_state_file = NULL;
- link.V_link_state = SURF_RESOURCE_ON;
- link.V_link_sharing_policy = A_surfxml_link_sharing_policy;
+ link.id = link_id;
+ link.bandwidth = struct_cluster->S_cluster_bw;
+ link.latency = struct_cluster->S_cluster_lat;
+ link.state = SURF_RESOURCE_ON;
+ /* FIXME: use a switch here */
if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
- link.V_policy_initial_link = SURF_LINK_SHARED;
+ link.policy = SURF_LINK_SHARED;
else
{
if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FATPIPE)
- link.V_policy_initial_link = SURF_LINK_FATPIPE;
+ link.policy = SURF_LINK_FATPIPE;
else if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
- link.V_policy_initial_link = SURF_LINK_FULLDUPLEX;
+ link.policy = SURF_LINK_FULLDUPLEX;
}
sg_platf_new_link(&link);
{A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;}
memset(&link,0,sizeof(link));
- link.V_link_id = link_backbone;
- link.V_link_bandwidth = struct_cluster->S_cluster_bb_bw;
- link.V_link_latency = struct_cluster->S_cluster_bb_lat;
- link.V_link_bandwidth_file = NULL;
- link.V_link_latency_file = NULL;
- link.V_link_state_file = NULL;
- link.V_link_state = SURF_RESOURCE_ON;
- link.V_link_sharing_policy = A_surfxml_link_sharing_policy;
+ link.id = link_backbone;
+ link.bandwidth = struct_cluster->S_cluster_bb_bw;
+ link.latency = struct_cluster->S_cluster_bb_lat;
+ link.state = SURF_RESOURCE_ON;
+ /* FIXME: use a switch, and deal with FULLDUPLEX here */
if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
- link.V_policy_initial_link = SURF_LINK_SHARED;
+ link.policy = SURF_LINK_SHARED;
else
- link.V_policy_initial_link = SURF_LINK_FATPIPE;
+ link.policy = SURF_LINK_FATPIPE;
sg_platf_new_link(&link);
ETag_surfxml_link();
xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
link.properties = current_property_set = xbt_dict_new();
- link.V_link_id = A_surfxml_link_id;
- link.V_link_bandwidth = surf_parse_get_double(A_surfxml_link_bandwidth);
- link.V_link_bandwidth_file = tmgr_trace_new(A_surfxml_link_bandwidth_file);
- link.V_link_latency = surf_parse_get_double(A_surfxml_link_latency);
- link.V_link_latency_file = tmgr_trace_new(A_surfxml_link_latency_file);
+ link.id = A_surfxml_link_id;
+ link.bandwidth = surf_parse_get_double(A_surfxml_link_bandwidth);
+ link.bandwidth_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
+ link.latency = surf_parse_get_double(A_surfxml_link_latency);
+ link.latency_trace = tmgr_trace_new(A_surfxml_link_latency_file);
+ /* FIXME: use a switch here */
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)
- link.V_link_state = SURF_RESOURCE_ON;
+ link.state = SURF_RESOURCE_ON;
if (A_surfxml_link_state == A_surfxml_link_state_OFF)
- link.V_link_state = SURF_RESOURCE_OFF;
- link.V_link_state_file = tmgr_trace_new(A_surfxml_link_state_file);
- link.V_link_sharing_policy = A_surfxml_link_sharing_policy;
+ link.state = SURF_RESOURCE_OFF;
+ link.state_trace = tmgr_trace_new(A_surfxml_link_state_file);
+ /* FIXME: use a switch here */
if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
- link.V_policy_initial_link = SURF_LINK_SHARED;
+ link.policy = SURF_LINK_SHARED;
else
{
if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FATPIPE)
- link.V_policy_initial_link = SURF_LINK_FATPIPE;
+ link.policy = SURF_LINK_FATPIPE;
else if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
- link.V_policy_initial_link = SURF_LINK_FULLDUPLEX;
+ link.policy = SURF_LINK_FULLDUPLEX;
}
sg_platf_new_link(&link);
static void ptask_parse_link_init(sg_platf_link_cbarg_t link)
{
- if(link->V_policy_initial_link == SURF_LINK_FULLDUPLEX)
+ if(link->policy == SURF_LINK_FULLDUPLEX)
{
- ptask_link_create_resource(bprintf("%s_UP",link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, link->properties);
- ptask_link_create_resource(bprintf("%s_DOWN",link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, NULL); // FIXME: We need to deep copy the properties or we won't be able to free it
+ ptask_link_create_resource(bprintf("%s_UP",link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, link->properties);
+ ptask_link_create_resource(bprintf("%s_DOWN",link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, NULL); // FIXME: We need to deep copy the properties or we won't be able to free it
}
else
{
- ptask_link_create_resource(xbt_strdup(link->V_link_id), link->V_link_bandwidth, link->V_link_bandwidth_file,
- link->V_link_latency, link->V_link_latency_file, link->V_link_state, link->V_link_state_file,
- link->V_policy_initial_link, link->properties);
+ ptask_link_create_resource(xbt_strdup(link->id), link->bandwidth, link->bandwidth_trace,
+ link->latency, link->latency_trace, link->state, link->state_trace,
+ link->policy, link->properties);
}
current_property_set = NULL;