lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER,
"Attribute 'speed' must be specified for host and must either be a string (in the correct format; check documentation) or a number.");
if (type == LUA_TNUMBER)
- host.speed_per_pstate->push_back(lua_tointeger(L, -1));
+ host.speed_per_pstate.push_back(lua_tointeger(L, -1));
else // LUA_TSTRING
- host.speed_per_pstate->push_back(surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id));
+ host.speed_per_pstate.push_back(surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id));
lua_pop(L, 1);
// get core
xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->name().c_str());
// Copy the power peak array:
- unsigned long n = speedPerPstate->size();
- for (unsigned long i = 0; i != n; ++i) {
- double value = speedPerPstate->at(i);
+ for (double value : *speedPerPstate) {
speedPerPstate_.push_back(value);
}
speed = PJ_type_variable_new ("power", nullptr, container->type);
}
- double current_speed_state = host->speed_per_pstate->at(host->pstate);
+ double current_speed_state = host->speed_per_pstate[host->pstate];
new_pajeSetVariable (0, container, speed, current_speed_state);
}
if (TRACE_uncategorized()){
h->extension_set(COORD_HOST_LEVEL, (void *) ctn);
}
- simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu( h, host->speed_per_pstate, host->core_amount);
+ simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu( h, &host->speed_per_pstate, host->core_amount);
if (host->state_trace)
cpu->setStateTrace(host->state_trace);
if (host->speed_trace)
}
}
- host.speed_per_pstate = new std::vector<double>();
- host.speed_per_pstate->push_back(cluster->speed);
+ host.speed_per_pstate.push_back(cluster->speed);
host.pstate = 0;
host.core_amount = cluster->core_amount;
host.coord = "";
host.pstate = 0;
host.core_amount = 1;
host.id = hostname;
- host.speed_per_pstate = new std::vector<double>();
- host.speed_per_pstate->push_back(cabinet->speed);
+ host.speed_per_pstate.push_back(cabinet->speed);
sg_platf_new_host(&host);
- delete host.speed_per_pstate;
s_sg_platf_link_cbarg_t link;
memset(&link, 0, sizeof(link));
memset(&host, 0, sizeof(host));
host.id = host_id;
- host.speed_per_pstate = new std::vector<double>();
- host.speed_per_pstate->push_back(peer->speed);
+ host.speed_per_pstate.push_back(peer->speed);
host.pstate = 0;
host.speed_trace = peer->availability_trace;
host.state_trace = peer->state_trace;
host.core_amount = 1;
sg_platf_new_host(&host);
- delete host.speed_per_pstate;
s_sg_platf_link_cbarg_t link;
memset(&link, 0, sizeof(link));
typedef struct {
const char* id;
- std::vector<double> *speed_per_pstate;
+ std::vector<double> speed_per_pstate;
int pstate;
int core_amount;
tmgr_trace_t speed_trace;
buf = A_surfxml_host_speed;
XBT_DEBUG("Buffer: %s", buf);
- host.speed_per_pstate = new std::vector<double>();
if (strchr(buf, ',') == nullptr){
double speed = surf_parse_get_speed(A_surfxml_host_speed,"speed of host", host.id);
- host.speed_per_pstate->push_back(speed);
+ host.speed_per_pstate.push_back(speed);
}
else {
xbt_dynar_t pstate_list = xbt_str_split(buf, ",");
xbt_dynar_foreach(pstate_list, i, speed_str) {
xbt_str_trim(speed_str, nullptr);
double speed = surf_parse_get_speed(speed_str,"speed of host", host.id);
- host.speed_per_pstate->push_back(speed);
+ host.speed_per_pstate.push_back(speed);
XBT_DEBUG("Speed value: %f", speed);
}
xbt_dynar_free(&pstate_list);
host.coord = A_surfxml_host_coordinates;
sg_platf_new_host(&host);
- delete host.speed_per_pstate;
current_property_set = nullptr;
}