Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sed -i -e 's/\t/ /g' *.[ch] Please people, stop using tabs in your source
[simgrid.git] / src / simdag / sd_task.c
index e7bd309..977e38e 100644 (file)
@@ -174,7 +174,7 @@ SD_task_t SD_task_create_comp_par_amdahl(const char *name, void *data,
 {
   xbt_assert(alpha < 1. && alpha >= 0.,
               "Invalid parameter: alpha must be in [0.;1.[");
-       
+  
   SD_task_t res = SD_task_create(name, data, amount);
   res->alpha = alpha;
   res->kind = SD_TASK_COMP_PAR_AMDAHL;
@@ -249,6 +249,20 @@ void SD_task_set_data(SD_task_t task, void *data)
   task->data = data;
 }
 
+/**
+ * \brief Sets the rate of a task
+ *
+ * This will change the percentage of the available power or network bandwidth
+ * a task can use.
+ *
+ * \param task a task
+ * \param rate the new rate you want to associate with this task
+ */
+void SD_task_set_rate(SD_task_t task, double rate)
+{
+  task->rate = rate;
+}
+
 /**
  * \brief Returns the state of a task
  *
@@ -538,7 +552,7 @@ void SD_task_dependency_add(const char *name, void *data, SD_task_t src,
       && !__SD_task_is_scheduled_or_runnable(src) && !__SD_task_is_running(src))
     THROWF(arg_error, 0,
            "Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULABLE, SD_SCHEDULED or SD_RUNNABLE"
-          " or SD_RUNNING",
+     " or SD_RUNNING",
            SD_task_get_name(src));
 
   if (!__SD_task_is_not_scheduled(dst) && !__SD_task_is_schedulable(dst)
@@ -1342,7 +1356,7 @@ void SD_task_distribute_comp_amdhal(SD_task_t task, int ws_count)
   
   for(i=0;i<ws_count;i++){
     task->computation_amount[i] = 
-       (task->alpha + (1 - task->alpha)/ws_count) * task->amount;
+      (task->alpha + (1 - task->alpha)/ws_count) * task->amount;
   }
 } 
 
@@ -1397,10 +1411,10 @@ void SD_task_schedulev(SD_task_t task, int count,
 
   }
  if (task->kind == SD_TASK_COMP_PAR_AMDAHL) {
-         XBT_VERB("Schedule computation task %s on %d hosts. It costs %.f flops on each host",
-           SD_task_get_name(task),
-               task->workstation_nb,
-               task->computation_amount[0]);
+     XBT_VERB("Schedule computation task %s on %d hosts. It costs %.f flops on each host",
+          SD_task_get_name(task),
+          task->workstation_nb,
+            task->computation_amount[0]);
  } 
 
   /* Iterate over all childs and parent being COMM_E2E to say where I am located (and start them if runnable) */