Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix SD_task_get_execution_time() when communication or computation arrays are NULL
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 30 Mar 2010 08:46:00 +0000 (08:46 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 30 Mar 2010 08:46:00 +0000 (08:46 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7391 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/simdag/sd_task.c

index b5728f1..a313d5e 100644 (file)
@@ -644,25 +644,27 @@ double SD_task_get_execution_time(SD_task_t task,
   double time, max_time = 0.0;
   int i, j;
   SD_CHECK_INIT_DONE();
-  xbt_assert0(task != NULL && workstation_nb > 0 && workstation_list != NULL
-              && computation_amount != NULL
-              && communication_amount != NULL, "Invalid parameter");
+  xbt_assert0(task != NULL && workstation_nb > 0 && workstation_list != NULL,
+              "Invalid parameter");
 
   /* the task execution time is the maximum execution time of the parallel tasks */
 
   for (i = 0; i < workstation_nb; i++) {
-    time =
-      SD_workstation_get_computation_time(workstation_list[i],
-                                          computation_amount[i]);
-
-    for (j = 0; j < workstation_nb; j++) {
-      time +=
-        SD_route_get_communication_time(workstation_list[i],
-                                        workstation_list[j],
-                                        communication_amount[i *
-                                                             workstation_nb +
-                                                             j]);
-    }
+    time = 0.0;
+    if (computation_amount != NULL)
+      time =
+          SD_workstation_get_computation_time(workstation_list[i],
+              computation_amount[i]);
+
+    if (communication_amount != NULL)
+      for (j = 0; j < workstation_nb; j++) {
+        time +=
+            SD_route_get_communication_time(workstation_list[i],
+                workstation_list[j],
+                communication_amount[i *
+                                     workstation_nb +
+                                     j]);
+      }
 
     if (time > max_time) {
       max_time = time;