Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
placing instrumentation of network utilization on better place
[simgrid.git] / testsuite / surf / surf_usage2.c
index 6f77366..8be876d 100644 (file)
@@ -1,8 +1,7 @@
-/*     $Id$     */
-
 /* A few basic tests for the surf library                                   */
 
-/* Copyright (c) 2004 Arnaud Legrand. All rights reserved.                  */
+/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -46,6 +45,7 @@ void test(char *platform)
   surf_action_t actionC = NULL;
   surf_action_t commAB = NULL;
   double now = -1.0;
+  int running;
 
   int workstation_id =
     find_model_description(surf_workstation_model_description, "CLM03");
@@ -81,6 +81,7 @@ void test(char *platform)
     surf_action_t action = NULL;
     unsigned int iter;
     surf_model_t model = NULL;
+    running = 0;
 
     now = surf_get_clock();
     DEBUG1("Next Event : %g", now);
@@ -97,8 +98,12 @@ void test(char *platform)
         DEBUG1("\t * Done : %p", action);
         model->action_unref(action);
       }
+      if (xbt_swag_size(model->states.running_action_set)) {
+        DEBUG1("running %s", model->name);
+        running = 1;
+      }
     }
-  } while (surf_solve() >= 0.0);
+  } while (running && surf_solve() >= 0.0);
 
   DEBUG0("Simulation Terminated");