Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
[simgrid.git] / src / surf / host_ptask_L07.cpp
index 9197c4d..298496a 100644 (file)
@@ -202,10 +202,9 @@ L07Action::L07Action(Model *model, int host_nb,
   int nb_used_host = 0; /* Only the hosts with something to compute (>0 flops) are counted) */
   double latency = 0.0;
 
-
   this->p_netcardList->reserve(host_nb);
   for (int i = 0; i<host_nb; i++)
-         this->p_netcardList->push_back(host_list[i]->pimpl_netcard);
+    this->p_netcardList->push_back(host_list[i]->pimpl_netcard);
 
   /* Compute the number of affected resources... */
   if(bytes_amount != NULL) {
@@ -213,20 +212,17 @@ L07Action::L07Action(Model *model, int host_nb,
 
     for (int i = 0; i < host_nb; i++) {
       for (int j = 0; j < host_nb; j++) {
-        xbt_dynar_t route=NULL;
 
         if (bytes_amount[i * host_nb + j] > 0) {
           double lat=0.0;
-          unsigned int cpt;
-          void *_link;
-          LinkL07 *link;
+          xbt_dynar_t route=NULL;
 
-          routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j],
-                                                        &route, &lat);
+          routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], &route, &lat);
           latency = MAX(latency, lat);
 
+          void *_link;
           xbt_dynar_foreach(route, cpt, _link) {
-            link = static_cast<LinkL07*>(_link);
+            LinkL07 *link = static_cast<LinkL07*>(_link);
             xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
           }
         }
@@ -261,15 +257,15 @@ L07Action::L07Action(Model *model, int host_nb,
   if(bytes_amount != NULL) {
     for (int i = 0; i < host_nb; i++) {
       for (int j = 0; j < host_nb; j++) {
-        void *_link;
 
         xbt_dynar_t route=NULL;
         if (bytes_amount[i * host_nb + j] == 0.0)
           continue;
 
-        routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j],
+        routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j],
                                                     &route, NULL);
 
+        void *_link;
         xbt_dynar_foreach(route, cpt, _link) {
           LinkL07 *link = static_cast<LinkL07*>(_link);
           lmm_expand_add(model->getMaxminSystem(), link->getConstraint(),
@@ -283,6 +279,7 @@ L07Action::L07Action(Model *model, int host_nb,
     this->setCost(1.0);
     this->setRemains(0.0);
   }
+  xbt_free(host_list);
 }
 
 Action *NetworkL07Model::communicate(NetCard *src, NetCard *dst,
@@ -551,6 +548,7 @@ void LinkL07::updateLatency(double value, double date)
  **********/
 
 L07Action::~L07Action(){
+  delete p_netcardList;
   free(p_communicationAmount);
   free(p_computationAmount);
 }
@@ -594,7 +592,7 @@ int L07Action::unref()
   m_refcount--;
   if (!m_refcount) {
     if (action_hook.is_linked())
-         p_stateSet->erase(p_stateSet->iterator_to(*this));
+      p_stateSet->erase(p_stateSet->iterator_to(*this));
     if (getVariable())
       lmm_variable_free(getModel()->getMaxminSystem(), getVariable());
     delete this;