Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Minimize forking effort in network_model.
authorvelho <velho@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 25 Jun 2008 15:08:25 +0000 (15:08 +0000)
committervelho <velho@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 25 Jun 2008 15:08:25 +0000 (15:08 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5821 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/network_gtnets.c

index 778c3f3..d1c58eb 100644 (file)
@@ -9,6 +9,9 @@
 #include "gtnets/gtnets_interface.h"
 #include "xbt/str.h"
 
+
+static   double time_to_next_flow_completion=-1;
+
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets, surf,
                                "Logging specific to the SURF network module");
 
@@ -346,7 +349,11 @@ static double share_resources(double now)
   if (!xbt_swag_size(running_actions))
     return -1.0;
 
-  return gtnets_get_time_to_next_flow_completion();
+  xbt_assert0(time_to_next_flow_completion, "Time to next flow completion not initialized!\n");
+  
+  time_to_next_flow_completion = gtnets_get_time_to_next_flow_completion();
+
+  return time_to_next_flow_completion;
 }
 
 /* delta: by how many time units the simulation must advance */
@@ -363,9 +370,6 @@ static void update_actions_state(double now, double delta)
   xbt_swag_t running_actions =
       surf_network_model->common_public->states.running_action_set;
 
-  double time_to_next_flow_completion =
-      gtnets_get_time_to_next_flow_completion();
-
   /* If there are no renning flows, just return */
   if (time_to_next_flow_completion < 0.0) {
     return;