return surf_min;
}
-void routing_get_route_and_latency(sg_routing_edge_t src, sg_routing_edge_t dst,
+void routing_get_route_and_latency(sg_netcard_t src, sg_netcard_t dst,
xbt_dynar_t * route, double *latency){
routing_platf->getRouteAndLatency(src, dst, route, latency);
}
}
surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_host_t src, sg_host_t dst, double size, double rate){
- return model->communicate(sg_host_edge(src), sg_host_edge(dst), size, rate);
+ return model->communicate(src->p_netcard, dst->p_netcard, size, rate);
}
const char *surf_resource_name(surf_cpp_resource_t resource){
return resource->getName();
}
-e_surf_resource_state_t surf_resource_get_state(surf_cpp_resource_t resource){
- return resource->getState();
+int surf_resource_is_on(surf_cpp_resource_t resource){
+ return resource->isOn();
}
-
-void surf_resource_set_state(surf_cpp_resource_t resource, e_surf_resource_state_t state){
- resource->setState(state);
+int surf_resource_is_off(surf_cpp_resource_t resource){
+ return resource->isOff();
+}
+void surf_resource_turn_on(surf_cpp_resource_t resource){
+ resource->turnOn();
+}
+void surf_resource_turn_off(surf_cpp_resource_t resource){
+ resource->turnOff();
}
surf_action_t surf_host_sleep(sg_host_t host, double duration){
return get_casted_host(host)->getProperties();
}
-double surf_host_get_speed(sg_host_t host, double load){
- return host->p_cpu->getSpeed(load);
-}
-
double surf_host_get_available_speed(sg_host_t host){
return host->p_cpu->getAvailableSpeed();
}
-int surf_host_get_core(sg_host_t host){
- return host->p_cpu->getCore();
-}
-
surf_action_t surf_host_execute(sg_host_t host, double size){
return host->p_cpu->execute(size);
}
get_casted_host(host)->setParams(params);
}
-void surf_vm_destroy(sg_host_t resource){
- /* We deregister objects from host_lib, without invoking the freeing callback
- * of each level.
- *
- * Do not call xbt_lib_remove() here. It deletes all levels of the key,
- * including MSG_HOST_LEVEL and others. We should unregister only what we know.
- */
- resource->p_cpu = nullptr; // FIXME: memleaking?
- sg_host_edge_destroy(resource,1);
- resource->extension_set<simgrid::surf::Host>(nullptr);
-
- /* TODO: comment out when VM storage is implemented. */
- // host->extension_set(SURF_STORAGE_LEVEL, nullptr);
+void surf_vm_destroy(sg_host_t vm){
+ vm->p_cpu = nullptr;
+ delete vm->p_netcard;
}
void surf_vm_suspend(sg_host_t vm){
return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->p_attach;
}
-surf_action_t surf_cpu_execute(sg_host_t host, double size){
- xbt_die("FIXME: DEADCODE");
- return host->p_cpu->execute(size);
-}
-
-surf_action_t surf_cpu_sleep(sg_host_t host, double duration){
- xbt_die("FIXME: DEADCODE");
- return host->p_cpu->sleep(duration);
-}
-
double surf_action_get_start_time(surf_action_t action){
return action->getStartTime();
}