if (type != LUA_TSTRING && type != LUA_TNUMBER) {
XBT_ERROR("Attribute 'speed' must be specified for host and must either be a string (in the correct format; check documentation) or a number.");
}
- host.speed_peak = xbt_dynar_new(sizeof(double), NULL);
+ host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL);
if (type == LUA_TNUMBER)
- xbt_dynar_push_as(host.speed_peak, double, lua_tointeger(L, -1));
+ xbt_dynar_push_as(host.speed_per_pstate, double, lua_tointeger(L, -1));
else // LUA_TSTRING
- xbt_dynar_push_as(host.speed_peak, double, surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id));
+ xbt_dynar_push_as(host.speed_per_pstate, double, surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id));
lua_pop(L, 1);
// get core
//get power_trace
lua_pushstring(L, "availability_file");
lua_gettable(L, -2);
- host.speed_trace = tmgr_trace_new_from_file(lua_tostring(L, -1));
+ const char *filename = lua_tostring(L, -1);
+ if (filename)
+ host.speed_trace = tmgr_trace_new_from_file(filename);
lua_pop(L, 1);
//get trace state
lua_pushstring(L, "state_file");
lua_gettable(L, -2);
- host.state_trace = tmgr_trace_new_from_file(lua_tostring(L, -1));
+ filename = lua_tostring(L, -1);
+ if (filename)
+ host.state_trace = tmgr_trace_new_from_file(filename);
lua_pop(L, 1);
sg_platf_new_host(&host);
- xbt_dynar_free(&host.speed_peak);
+ xbt_dynar_free(&host.speed_per_pstate);
return 0;
}
//get bandwidth_trace value
lua_pushstring(L, "bandwidth_file");
lua_gettable(L, -2);
- link.bandwidth_trace = tmgr_trace_new_from_file(lua_tostring(L, -1));
+ const char *filename = lua_tostring(L, -1);
+ if (filename)
+ link.bandwidth_trace = tmgr_trace_new_from_file(filename);
lua_pop(L, 1);
//get latency_trace value
lua_pushstring(L, "latency_file");
lua_gettable(L, -2);
- link.latency_trace = tmgr_trace_new_from_file(lua_tostring(L, -1));
+ filename = lua_tostring(L, -1);
+ if (filename)
+ link.latency_trace = tmgr_trace_new_from_file(filename);
lua_pop(L, 1);
//get state_trace value
lua_pushstring(L, "state_file");
lua_gettable(L, -2);
- link.state_trace = tmgr_trace_new_from_file(lua_tostring(L, -1));
+ filename = lua_tostring(L, -1);
+ if (filename)
+ link.state_trace = tmgr_trace_new_from_file(filename);
lua_pop(L, 1);
//get policy value
else if(!strcmp(mode,"none")) mode_int = A_surfxml_AS_routing_None;
else xbt_die("Don't have the model name '%s'",mode);
- s_sg_platf_AS_cbarg_t AS = SG_PLATF_AS_INITIALIZER;
+ s_sg_platf_AS_cbarg_t AS;
AS.id = id;
AS.routing = mode_int;
-
sg_platf_new_AS_begin(&AS);
return 0;