From fe657d473727f5f9e71ab147673d902bef1a54d4 Mon Sep 17 00:00:00 2001 From: suter Date: Mon, 10 May 2010 20:11:02 +0000 Subject: [PATCH 1/1] Add a SD_workstation_get_current_task function 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 | 1 + src/simdag/sd_workstation.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/simdag/simdag.h b/include/simdag/simdag.h index c52e51575d..a050ae069f 100644 --- a/include/simdag/simdag.h +++ b/include/simdag/simdag.h @@ -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 ************************************/ diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index 9e9b2a868d..d2a00e1a7a 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -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); +} -- 2.20.1