X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a279c221114b93985c6aa249e71cc4141082b310..28c07426861c6c0b4e2333b803bf67f643b4a1c2:/src/surf/network_constant.cpp diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index e813122ade..f9ffcb6761 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014. The SimGrid Team. +/* Copyright (c) 2013-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -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,14 +74,14 @@ 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); @@ -145,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() { @@ -163,11 +157,6 @@ void NetworkConstantAction::resume() m_suspended = false; } -void NetworkConstantAction::recycle() -{ - return; -} - bool NetworkConstantAction::isSuspended() { return m_suspended;