*/
static void create_host(const char *id, double power_peak, double power_sc,
- const char *power_tr, int state_init,
+ const char *power_tr,int core,int state_init,
const char *state_tr)
{
double power_scale = 1.0;
+ int core_nb = 1; //default value
tmgr_trace_t power_trace = NULL;
e_surf_resource_state_t state_initial;
tmgr_trace_t state_trace;
if (power_sc) // !=0
power_scale = power_sc;
+ if (core)
+ core_nb = core; //default value
+ else
if (state_init == -1)
state_initial = SURF_RESOURCE_OFF;
else
state_trace = tmgr_trace_new("");
current_property_set = xbt_dict_new();
surf_host_create_resource(xbt_strdup(id), power_peak, power_scale,
- power_trace, state_initial, state_trace,
+ power_trace, core_nb, state_initial, state_trace,
current_property_set);
}
mode = lua_tostring(L, -1);
lua_pop(L, 1);
} else {
- ERROR0
+ XBT_ERROR
("Bad Arguments to AS.new, Should be a table with named arguments");
return -1;
}
const char *power_trace;
const char *state_trace;
double power, power_scale;
- int state_initial;
+ int state_initial,core;
//get values from the table passed as argument
if (lua_istable(L, -1)) {
power_trace = lua_tostring(L, -1);
lua_pop(L, 1);
+ lua_pushstring(L, "core");
+ lua_gettable(L, -2);
+ core = lua_tonumber(L, -1);
+ lua_pop(L, 1);
+
//get state initial
lua_pushstring(L, "state_initial");
lua_gettable(L, -2);
lua_pop(L, 1);
} else {
- ERROR0
+ XBT_ERROR
("Bad Arguments to create host, Should be a table with named arguments");
return -1;
}
host->power_peak = power;
host->power_scale = power_scale;
host->power_trace = power_trace;
+ host->core = core;
host->state_initial = state_initial;
host->state_trace = state_trace;
host->function = NULL;
lua_pop(L, 1);
} else {
- ERROR0
+ XBT_ERROR
("Bad Arguments to create link, Should be a table with named arguments");
return -1;
}
link->policy = policy;
xbt_dynar_push(link_list_d, &link);
-
- //TEST1
- unsigned int i;
- p_link_attr p_link;
- xbt_dynar_foreach(link_list_d, i, p_link) {
- }
return 0;
}
route->links_id = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
- char *tmp_links = malloc(sizeof(char)*strlen(links)+1);//use xbt
- strcpy(tmp_links,links);
+ char *tmp_links = xbt_strdup(links);
link_id = strtok(tmp_links,","); //tmp_link = strtok((char*)links,",");
while(link_id != NULL)
{
{
link_id = lua_tostring(L, -1);
xbt_dynar_push(route->links_id, &link_id);
- DEBUG2("index = %f , Link_id = %s \n", lua_tonumber(L, -2),
+ XBT_DEBUG("index = %f , Link_id = %s \n", lua_tonumber(L, -2),
lua_tostring(L, -1));
lua_pop(L, 1);
}
lua_pop(L, 1);
}
else {
- ERROR0("Bad Arguments to create link, Should be a table with named arguments");
+ XBT_ERROR("Bad Arguments to create link, Should be a table with named arguments");
return -1;
}
return 0;
}
}
- ERROR1("Host : %s Not Found !!", host);
+ XBT_ERROR("Host : %s Not Found !!", host);
return 1;
}
// Add Hosts
xbt_dynar_foreach(host_list_d, i, p_host) {
create_host(p_host->id, p_host->power_peak, p_host->power_scale,
- p_host->power_trace, p_host->state_initial,
+ p_host->power_trace, p_host->core, p_host->state_initial,
p_host->state_trace);
//add to routing model host list
surf_route_add_host((char *) p_host->id);