Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Improve the doc and checkings of SD_task_set_rate.
authorArnaud Legrand <arnaud.legrand@imag.fr>
Thu, 25 Jun 2015 06:55:09 +0000 (08:55 +0200)
committerArnaud Legrand <arnaud.legrand@imag.fr>
Thu, 25 Jun 2015 06:56:21 +0000 (08:56 +0200)
src/simdag/sd_task.c

index 9ab54e6..4673948 100644 (file)
@@ -292,9 +292,10 @@ void SD_task_set_data(SD_task_t task, void *data)
  * \brief Sets the rate of a task
  *
  * This will change the network bandwidth a task can use. This rate
- * depends on both the nominal bandwidth on the route onto which the task is
- * scheduled (\see SD_task_get_current_bandwidth) and the amount of data to
- * transfer.
+ * cannot be dynamically changed. Once the task has started, this call
+ * is ineffective. This rate depends on both the nominal bandwidth on
+ * the route onto which the task is scheduled (\see
+ * SD_task_get_current_bandwidth) and the amount of data to transfer.
  *
  * To divide the nominal bandwidth by 2, the rate then has to be :
  *    rate = bandwidth/(2*amount)
@@ -306,8 +307,11 @@ void SD_task_set_rate(SD_task_t task, double rate)
 {
   xbt_assert(task->kind == SD_TASK_COMM_E2E,
              "The rate can be modified for end-to-end communications only.");
-
-  task->rate = rate;
+  if(task->start_time<0) {
+    task->rate = rate;
+  } else {
+    XBT_WARN("Task %p has started. Changing rate is ineffective.", task);
+  }
 }
 
 /**