Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a SD_workstation_get_current_task function
authorsuter <suter@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 10 May 2010 20:11:02 +0000 (20:11 +0000)
committersuter <suter@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 10 May 2010 20:11:02 +0000 (20:11 +0000)
returns the currently executed task in the SD_SEQUENTIAL_ACCESSED_MODE
Then it's easy to get the kind of this task with SD_task_get_kind

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7734 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/simdag/simdag.h
src/simdag/sd_workstation.c

index c52e515..a050ae0 100644 (file)
@@ -95,6 +95,7 @@ XBT_PUBLIC(double) SD_route_get_communication_time(SD_workstation_t src,
                                                    double
                                                    communication_amount);
 
+XBT_PUBLIC(SD_task_t) SD_workstation_get_current_task (SD_workstation_t workstation);
 /** @} */
 
 /************************** Task handling ************************************/
index 9e9b2a8..d2a00e1 100644 (file)
@@ -498,3 +498,18 @@ void __SD_workstation_destroy(void *workstation)
   }
   xbt_free(w);
 }
+
+/** 
+ * \brief Returns the kind of the task currently running on a workstation
+ * Only call this with sequential access mode set
+ * \param workstation a workstation */
+SD_task_t SD_workstation_get_current_task(SD_workstation_t workstation)
+{
+  SD_CHECK_INIT_DONE();
+  xbt_assert0(workstation != NULL, "Invalid parameter");
+  xbt_assert0(workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS, 
+             "Access mode must be set to SD_WORKSTATION_SEQUENTIAL_ACCESS"
+             " to use this function");
+  
+  return (workstation->current_task);
+}