Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add functions SD_task_get_start_time() and SD_task_get_finish_time() to SimDag
authorthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 12 Jul 2006 12:22:55 +0000 (12:22 +0000)
committerthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 12 Jul 2006 12:22:55 +0000 (12:22 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2541 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/simdag/simdag.h
src/simdag/sd_task.c

index 429618b..effb3eb 100644 (file)
@@ -97,6 +97,8 @@ void              SD_task_schedule(SD_task_t task, int workstation_nb,
                                   const SD_workstation_t *workstation_list, const double *computation_amount,
                                   const double *communication_amount, double rate);
 void              SD_task_unschedule(SD_task_t task);
                                   const SD_workstation_t *workstation_list, const double *computation_amount,
                                   const double *communication_amount, double rate);
 void              SD_task_unschedule(SD_task_t task);
+double            SD_task_get_start_time(SD_task_t task);
+double            SD_task_get_finish_time(SD_task_t task);
 void              SD_task_destroy(SD_task_t task);
 /** @} */
 
 void              SD_task_destroy(SD_task_t task);
 /** @} */
 
index 5d13f2a..236d629 100644 (file)
@@ -564,6 +564,41 @@ static void __SD_task_remove_dependencies(SD_task_t task) {
   }
 }
 
   }
 }
 
+/**
+ * \brief Returns the start time of a task
+ *
+ * The task state must be SD_RUNNING, SD_DONE or SD_FAILED.
+ *
+ * \task a task
+ * \return the start time of this task
+ */
+double SD_task_get_start_time(SD_task_t task) {
+  SD_CHECK_INIT_DONE();
+  xbt_assert0(task != NULL, "Invalid parameter");
+  xbt_assert1(task->surf_action != NULL, "Task '%s' is not started yet!", SD_task_get_name(task));
+
+  return surf_workstation_resource->common_public->action_get_start_time(task->surf_action);
+}
+
+/**
+ * \brief Returns the finish time of a task
+ *
+ * The task state must be SD_RUNNING, SD_DONE or SD_FAILED.
+ * If the state is not completed yet, the returned value is an
+ * estimation of the task finish time. This value can fluctuate 
+ * until the task is completed.
+ *
+ * \task a task
+ * \return the start time of this task
+ */
+double SD_task_get_finish_time(SD_task_t task) {
+  SD_CHECK_INIT_DONE();
+  xbt_assert0(task != NULL, "Invalid parameter");
+  xbt_assert1(task->surf_action != NULL, "Task '%s' is not started yet!", SD_task_get_name(task));
+
+  return surf_workstation_resource->common_public->action_get_finish_time(task->surf_action);  
+}
+
 /**
  * \brief Destroys a task.
  *
 /**
  * \brief Destroys a task.
  *