X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/413534bc9aac9b6a61840de0a20f933534552fd7..abf7c33aff8279f498000149d39448946c3297b3:/src/surf/workstation_ptask_L07.cpp diff --git a/src/surf/workstation_ptask_L07.cpp b/src/surf/workstation_ptask_L07.cpp index 0bc8e02132..f7b460abf8 100644 --- a/src/surf/workstation_ptask_L07.cpp +++ b/src/surf/workstation_ptask_L07.cpp @@ -52,11 +52,11 @@ WorkstationL07Model::WorkstationL07Model() : WorkstationModel("Workstation ptask surf_workstation_model = NULL; surf_network_model = new NetworkL07Model(); surf_cpu_model_pm = new CpuL07Model(); - routing_model_create(static_cast(surf_network_model->createNetworkLink("__loopback__", + routing_model_create(surf_network_model->createNetworkLink("__loopback__", 498000000, NULL, 0.000015, NULL, SURF_RESOURCE_ON, NULL, - SURF_LINK_FATPIPE, NULL))); + SURF_LINK_FATPIPE, NULL)); p_cpuModel = surf_cpu_model_pm; } @@ -239,7 +239,7 @@ ActionPtr WorkstationL07Model::executeParallelTask(int workstation_nb, for (i = 0; i < workstation_nb; i++) lmm_expand(ptask_maxmin_system, - static_cast(static_cast(workstation_list[i])->p_cpu)->getConstraint(), + static_cast(workstation_list[i])->p_cpu->getConstraint(), action->getVariable(), computation_amount[i]); for (i = 0; i < workstation_nb; i++) { @@ -269,7 +269,7 @@ ActionPtr WorkstationL07Model::executeParallelTask(int workstation_nb, action->setRemains(0.0); } - return static_cast(action); + return action; } WorkstationPtr WorkstationL07Model::createWorkstation(const char *name) @@ -283,7 +283,7 @@ WorkstationPtr WorkstationL07Model::createWorkstation(const char *name) static_cast(xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL)), static_cast(xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL))); - xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, static_cast(wk)); + xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, wk); return wk;//FIXME:xbt_lib_get_elm_or_null(host_lib, name); } @@ -296,8 +296,8 @@ ActionPtr WorkstationL07Model::communicate(WorkstationPtr src, WorkstationPtr ds double *communication_amount = xbt_new0(double, 4); ActionPtr res = NULL; - workstation_list[0] = static_cast(src); - workstation_list[1] = static_cast(dst); + workstation_list[0] = src; + workstation_list[1] = dst; communication_amount[1] = size; res = executeParallelTask(2, workstation_list, @@ -322,6 +322,7 @@ CpuPtr CpuL07Model::createCpu(const char *name, xbt_dynar_t powerPeak, xbt_dict_t cpu_properties) { double power_initial = xbt_dynar_get_as(powerPeak, pstate, double); + xbt_dynar_free(&powerPeak); // kill memory leak xbt_assert(!surf_workstation_resource_priv(surf_workstation_resource_by_name(name)), "Host '%s' declared several times in the platform file.", @@ -331,9 +332,9 @@ CpuPtr CpuL07Model::createCpu(const char *name, xbt_dynar_t powerPeak, power_initial, power_scale, power_trace, core, state_initial, state_trace); - xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, static_cast(cpu)); + xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu); - return cpu;//FIXME:xbt_lib_get_elm_or_null(host_lib, name); + return cpu; } NetworkLinkPtr NetworkL07Model::createNetworkLink(const char *name, @@ -357,7 +358,7 @@ NetworkLinkPtr NetworkL07Model::createNetworkLink(const char *name, state_initial, state_trace, policy); - xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, static_cast(nw_link)); + xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, nw_link); return nw_link; } @@ -377,7 +378,7 @@ void WorkstationL07Model::addTraces() xbt_assert(host, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - host->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(host)); + host->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, host); } xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) { @@ -387,7 +388,7 @@ void WorkstationL07Model::addTraces() xbt_assert(host, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - host->p_powerEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(host)); + host->p_powerEvent = tmgr_history_add_trace(history, trace, 0.0, 0, host); } /* Connect traces relative to network */ @@ -398,7 +399,7 @@ void WorkstationL07Model::addTraces() xbt_assert(link, "Link %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - link->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(link)); + link->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link); } xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) { @@ -408,7 +409,7 @@ void WorkstationL07Model::addTraces() xbt_assert(link, "Link %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - link->p_bwEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(link)); + link->p_bwEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link); } xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) { @@ -418,7 +419,7 @@ void WorkstationL07Model::addTraces() xbt_assert(link, "Link %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - link->p_latEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(link)); + link->p_latEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link); } } @@ -463,14 +464,13 @@ CpuL07::CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t props, xbt_assert(m_powerScale > 0, "Power has to be >0"); if (power_trace) - p_powerEvent = tmgr_history_add_trace(history, power_trace, 0.0, 0, - static_cast(this)); + p_powerEvent = tmgr_history_add_trace(history, power_trace, 0.0, 0, this); else p_powerEvent = NULL; setState(state_initial); if (state_trace) - p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, static_cast(this)); + p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this); } LinkL07::LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props, @@ -485,13 +485,13 @@ LinkL07::LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props, { m_bwCurrent = bw_initial; if (bw_trace) - p_bwEvent = tmgr_history_add_trace(history, bw_trace, 0.0, 0, static_cast(this)); + p_bwEvent = tmgr_history_add_trace(history, bw_trace, 0.0, 0, this); setState(state_initial); m_latCurrent = lat_initial; if (lat_trace) - p_latEvent = tmgr_history_add_trace(history, lat_trace, 0.0, 0, static_cast(this)); + p_latEvent = tmgr_history_add_trace(history, lat_trace, 0.0, 0, this); if (policy == SURF_LINK_FATPIPE) lmm_constraint_shared(getConstraint()); @@ -561,7 +561,7 @@ ActionPtr WorkstationL07::execute(double size) double *computation_amount = xbt_new0(double, 1); double *communication_amount = xbt_new0(double, 1); - workstation_list[0] = static_cast(this); + workstation_list[0] = this; communication_amount[0] = 0.0; computation_amount[0] = size;