X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6de03ecc4e630732984a0673512a5d15fd75e270..4436adf7710dc39c6555fcd87701db50c654bf71:/src/surf/network_constant.cpp diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index d9f36dddcf..47f923fd31 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -24,25 +24,21 @@ void surf_network_model_init_Constant() sg_platf_host_add_cb(netcste_count_hosts); - ModelPtr model = static_cast(surf_network_model); + Model *model = surf_network_model; xbt_dynar_push(model_list, &model); } double NetworkConstantModel::shareResources(double /*now*/) { - NetworkConstantActionPtr action = NULL; + NetworkConstantAction *action = NULL; double min = -1.0; - ActionListPtr actionSet = getRunningActionSet(); + ActionList *actionSet = getRunningActionSet(); for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end()) ; it != itend ; ++it) { - action = static_cast(&*it); - if (action->m_latency > 0) { - if (min < 0) - min = action->m_latency; - else if (action->m_latency < min) - min = action->m_latency; - } + action = static_cast(&*it); + if (action->m_latency > 0 && (min < 0 || action->m_latency < min)) + min = action->m_latency; } return min; @@ -50,15 +46,15 @@ double NetworkConstantModel::shareResources(double /*now*/) void NetworkConstantModel::updateActionsState(double /*now*/, double delta) { - NetworkConstantActionPtr action = NULL; - ActionListPtr actionSet = getRunningActionSet(); + NetworkConstantAction *action = NULL; + ActionList *actionSet = getRunningActionSet(); for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end()) ; it != itend ; it=itNext) { ++itNext; - action = static_cast(&*it); + action = static_cast(&*it); if (action->m_latency > 0) { if (action->m_latency > delta) { - double_update(&(action->m_latency), delta); + double_update(&(action->m_latency), delta, sg_surf_precision); } else { action->m_latency = 0.0; } @@ -78,16 +74,17 @@ void NetworkConstantModel::updateActionsState(double /*now*/, double delta) } } -ActionPtr NetworkConstantModel::communicate(RoutingEdgePtr src, RoutingEdgePtr dst, +Action *NetworkConstantModel::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate) { char *src_name = src->getName(); char *dst_name = dst->getName(); XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate); - NetworkConstantActionPtr action = new NetworkConstantAction(this, size, sg_latency_factor); + NetworkConstantAction *action = new NetworkConstantAction(this, size, sg_latency_factor); XBT_OUT(); + surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate); return action; } @@ -144,12 +141,10 @@ void NetworkConstantAction::cancel() return; } -#ifdef HAVE_TRACING void NetworkConstantAction::setCategory(const char */*category*/) { //ignore completely the categories in constant model, they are not traced } -#endif void NetworkConstantAction::suspend() { @@ -162,11 +157,6 @@ void NetworkConstantAction::resume() m_suspended = false; } -void NetworkConstantAction::recycle() -{ - return; -} - bool NetworkConstantAction::isSuspended() { return m_suspended;