-
-/*FIXME:remove static void ptask_finalize(void)
-{
- xbt_dict_free(&ptask_parallel_task_link_set);
-
- delete surf_workstation_model;
- surf_workstation_model = NULL;
- delete surf_network_model;
- surf_network_model = NULL;
-
- ptask_host_count = 0;
-
- if (ptask_maxmin_system) {
- lmm_system_free(ptask_maxmin_system);
- ptask_maxmin_system = NULL;
- }
- }*/
-
-/**************************************/
-/******* Resource Private **********/
-/**************************************/
-
-/**************************************/
-/*** Resource Creation & Destruction **/
-/**************************************/
-
-static void ptask_parse_workstation_init(sg_platf_host_cbarg_t host)
-{
- double power_peak = xbt_dynar_get_as(host->power_peak, host->pstate, double);
- //cpu->power_peak = power_peak;
- xbt_dynar_free(&(host->power_peak)); /* kill memory leak */
- static_cast<WorkstationL07ModelPtr>(surf_workstation_model)->createResource(
- host->id,
- power_peak,
- host->power_scale,
- host->power_trace,
- host->initial_state,
- host->state_trace,
- host->properties);
-}
-
-static void ptask_parse_link_init(sg_platf_link_cbarg_t link)
-{
- if (link->policy == SURF_LINK_FULLDUPLEX) {
- char *link_id;
- link_id = bprintf("%s_UP", link->id);
- static_cast<NetworkL07ModelPtr>(surf_network_model)->createResource(link_id,
- link->bandwidth,
- link->bandwidth_trace,
- link->latency,
- link->latency_trace,
- link->state,
- link->state_trace,
- link->policy,
- link->properties);
- xbt_free(link_id);
- link_id = bprintf("%s_DOWN", link->id);
- static_cast<NetworkL07ModelPtr>(surf_network_model)->createResource(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 */
- xbt_free(link_id);
- } else {
- static_cast<NetworkL07ModelPtr>(surf_network_model)->createResource(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;
-}
-
-static void ptask_add_traces(){
- static_cast<WorkstationL07ModelPtr>(surf_workstation_model)->addTraces();
-}
-
-static void ptask_define_callbacks()
-{
- sg_platf_host_add_cb(parse_cpu_init);
- sg_platf_host_add_cb(ptask_parse_workstation_init);
- sg_platf_link_add_cb(ptask_parse_link_init);
- sg_platf_postparse_add_cb(ptask_add_traces);
-}
-
-/**************************************/
-/*************** Generic **************/
-/**************************************/
-void surf_workstation_model_init_ptask_L07(void)
-{
- XBT_INFO("surf_workstation_model_init_ptask_L07");
- xbt_assert(!surf_cpu_model_pm, "CPU model type already defined");
- xbt_assert(!surf_network_model, "network model type already defined");
- ptask_define_callbacks();
- surf_workstation_model = new WorkstationL07Model();
- ModelPtr model = static_cast<ModelPtr>(surf_workstation_model);
- xbt_dynar_push(model_list, &model);
- xbt_dynar_push(model_list_invoke, &model);
-}