From: thiery Date: Wed, 28 Jun 2006 13:26:42 +0000 (+0000) Subject: Finish SimDag documentation X-Git-Tag: v3.3~2898 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3f17e7a2d9e727cf8ba2da354280f3afd329c8a6 Finish SimDag documentation git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2460 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/doc/module-sd.doc b/doc/module-sd.doc index 8de54064d8..ca19b63543 100644 --- a/doc/module-sd.doc +++ b/doc/module-sd.doc @@ -5,8 +5,7 @@ - \ref SD_workstation_management - \ref SD_link_management - \ref SD_task_management - - \ref SD_dependency_management - - \ref SD_platform_management + - \ref SD_task_dependency_management - \ref SD_simulation */ @@ -22,9 +21,7 @@ \ingroup SD_API */ /** \addtogroup SD_task_management \ingroup SD_API */ -/** \addtogroup SD_dependency_management - \ingroup SD_API */ -/** \addtogroup SD_platform_management +/** \addtogroup SD_task_dependency_management \ingroup SD_API */ /** \addtogroup SD_simulation \ingroup SD_API */ diff --git a/include/simdag/datatypes.h b/include/simdag/datatypes.h index 90560351bb..391f469f1b 100644 --- a/include/simdag/datatypes.h +++ b/include/simdag/datatypes.h @@ -27,7 +27,8 @@ typedef struct SD_link *SD_link_t; A task is some computing amount that can be executed in parallel on several workstations. A task may depend on other tasks, this means that the task cannot start until the other tasks are done. - Each task has a \ref e_SD_task_state_t "state" indicating whether the task is scheduled, running, done, etc. + Each task has a \ref e_SD_task_state_t "state" indicating whether + the task is scheduled, running, done, etc. @see SD_task_management */ typedef struct SD_task *SD_task_t; diff --git a/include/simdag/simdag.h b/include/simdag/simdag.h index 6efe56bc0f..9690a03be4 100644 --- a/include/simdag/simdag.h +++ b/include/simdag/simdag.h @@ -8,18 +8,24 @@ SG_BEGIN_DECL() /************************** Link handling ***********************************/ -/* private (called by SD_environment_create) -SD_link_t SD_link_create(void *data, const char *name, -double bandwidth, double latency);*/ +/** @defgroup SD_link_management Links + * @brief Functions for managing the network links + * + * This section describes the functions for managing the network links. + * + * A link is a network node represented as a name, a current + * bandwidth and a current latency. The links are created + * when you call the function SD_create_environment. + * + * @see SD_link_t + * @{ + */ void* SD_link_get_data(SD_link_t link); void SD_link_set_data(SD_link_t link, void *data); const char* SD_link_get_name(SD_link_t link); -double SD_link_get_capacity(SD_link_t link); double SD_link_get_current_bandwidth(SD_link_t link); double SD_link_get_current_latency(SD_link_t link); -/* private (called by SD_clean) -void SD_link_destroy(SD_link_t link); -*/ +/** @} */ /************************** Workstation handling ****************************/ @@ -32,8 +38,9 @@ void SD_link_destroy(SD_link_t link); * A workstation is represented as a physical * resource with computing capabilities and has a name. * - * @see SD_workstation_t + * The workstations are created when you call the function SD_create_environment. * + * @see SD_workstation_t * @{ */ SD_workstation_t SD_workstation_get_by_name(const char *name); @@ -46,41 +53,69 @@ SD_link_t* SD_workstation_route_get_list(SD_workstation_t src, SD_workst int SD_workstation_route_get_size(SD_workstation_t src, SD_workstation_t dst); double SD_workstation_get_power(SD_workstation_t workstation); double SD_workstation_get_available_power(SD_workstation_t workstation); - /** @} */ /************************** Task handling ************************************/ +/** @defgroup SD_task_management Tasks + * @brief Functions for managing the tasks + * + * This section describes the functions for managing the tasks. + * + * A task is some computing amount that can be executed + * in parallel on several workstations. A task may depend on other + * tasks, this means that the task cannot start until the other tasks are done. + * Each task has a \ref e_SD_task_state_t "state" indicating whether + * the task is scheduled, running, done, etc. + * + * @see SD_task_t, SD_task_dependency_management + * @{ + */ SD_task_t SD_task_create(const char *name, void *data, double amount); -void SD_task_schedule(SD_task_t task, int workstation_nb, - const SD_workstation_t *workstation_list, double *computation_amount, - double *communication_amount, double rate); -void SD_task_reset(SD_task_t task); void* SD_task_get_data(SD_task_t task); void SD_task_set_data(SD_task_t task, void *data); +e_SD_task_state_t SD_task_get_state(SD_task_t task); const char* SD_task_get_name(SD_task_t task); double SD_task_get_amount(SD_task_t task); double SD_task_get_remaining_amount(SD_task_t task); -void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst); -void SD_task_dependency_remove(SD_task_t src, SD_task_t dst); -void* SD_task_dependency_get_data(SD_task_t src, SD_task_t dst); -e_SD_task_state_t SD_task_get_state(SD_task_t task); -/* e_SD_task_state_t can be either SD_SCHEDULED, SD_RUNNING, SD_DONE, or SD_FAILED */ - void SD_task_watch(SD_task_t task, e_SD_task_state_t state); -/* SD_simulate will stop as soon as the state of this task is the one given in argument. - Watch-point is then automatically removed */ - void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state); -void SD_task_unschedule(SD_task_t task); /* change state and rerun */ +void SD_task_schedule(SD_task_t task, int workstation_nb, + const SD_workstation_t *workstation_list, double *computation_amount, + double *communication_amount, double rate); +void SD_task_unschedule(SD_task_t task); void SD_task_destroy(SD_task_t task); +/** @} */ + + +/** @defgroup SD_task_dependency_management Tasks dependencies + * @brief Functions for managing the task dependencies + * + * This section describes the functions for managing the dependencies between the tasks. + * + * @see SD_task_management + * @{ + */ +void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst); +void SD_task_dependency_remove(SD_task_t src, SD_task_t dst); +void* SD_task_dependency_get_data(SD_task_t src, SD_task_t dst); +/** @} */ /************************** Global *******************************************/ +/** @defgroup SD_simulation Simulation + * @brief Functions for creating the environment and launching the simulation + * + * This section describes the functions for initialising SimDag, launching + * the simulation and exiting SimDag. + * + * @{ + */ void SD_init(int *argc, char **argv); void SD_create_environment(const char *platform_file); -SD_task_t* SD_simulate(double how_long); /* returns a NULL-terminated array of SD_task_t whose state has changed */ -void SD_exit(void); /* cleans everything */ +SD_task_t* SD_simulate(double how_long); +void SD_exit(void); +/** @} */ SG_END_DECL() diff --git a/src/simdag/private.h b/src/simdag/private.h index d826d3add2..06fe3394dd 100644 --- a/src/simdag/private.h +++ b/src/simdag/private.h @@ -115,5 +115,4 @@ static _XBT_INLINE int __SD_task_is_running(SD_task_t task) { return task->state_set == sd_global->running_task_set; } - #endif diff --git a/src/simdag/sd_global.c b/src/simdag/sd_global.c index 576c163d2c..2e5f3f3ecf 100644 --- a/src/simdag/sd_global.c +++ b/src/simdag/sd_global.c @@ -9,7 +9,15 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_kernel,sd, SD_global_t sd_global = NULL; -/* Initialises SD internal data. This function should be called before any other SD function. +/** + * \brief Initialises SD internal data + * + * This function must be called before any other SD function. Then you + * should call SD_create_environment(). + * + * \param argc argument number + * \param argv argument list + * \see SD_create_environment(), SD_exit() */ void SD_init(int *argc, char **argv) { xbt_assert0(sd_global == NULL, "SD_init already called"); @@ -31,7 +39,23 @@ void SD_init(int *argc, char **argv) { surf_init(argc, argv); } -/* Creates the environnement described in a xml file of a platform description. +/** + * \brief Creates the environment + * + * The environment (i.e. the \ref SD_workstation_management "workstations" and the + * \ref SD_link_management "links") is created with the data stored in the given XML + * platform file. + * + * \param platform_file name of an XML file describing the environment to create + * \see SD_workstation_management, SD_link_management + * + * The XML file follows this DTD: + * + * \include surfxml.dtd + * + * Here is a small example of such a platform: + * + * \include small_platform.xml */ void SD_create_environment(const char *platform_file) { xbt_dict_cursor_t cursor = NULL; @@ -64,7 +88,17 @@ void SD_create_environment(const char *platform_file) { } } -/* Launches the simulation. Returns a NULL-terminated array of SD_task_t whose state has changed. +/** + * \brief Launches the simulation. + * + * The function will execute the \ref SD_READY ready tasks. + * The simulation will be stopped when its time reaches \a how_long, + * when a watch point is reached, or when no more task can be executed. + * Then you can call SD_simulate() again. + * + * \param how_long maximum duration of the simulation + * \return a NULL-terminated array of \ref SD_task_t whose state has changed. + * \see SD_task_schedule(), SD_task_watch() */ SD_task_t* SD_simulate(double how_long) { @@ -137,8 +171,13 @@ SD_task_t* SD_simulate(double how_long) return changed_tasks; } -/* Destroys all SD internal data. This function should be called when the simulation is over. - * The tasks should have been destroyed first. +/** + * \brief Destroys all SD internal data. + * + * This function should be called when the simulation is over. Don't forget also to destroy + * the tasks. + * + * \see SD_init(), SD_task_destroy() */ void SD_exit(void) { if (sd_global != NULL) { diff --git a/src/simdag/sd_link.c b/src/simdag/sd_link.c index 637a6e28eb..0edd95e860 100644 --- a/src/simdag/sd_link.c +++ b/src/simdag/sd_link.c @@ -4,7 +4,7 @@ #include "xbt/sysdep.h" #include "surf/surf.h" -/* Creates a link. +/* Creates a link and registers it in SD. */ SD_link_t __SD_link_create(void *surf_link, void *data) { SD_CHECK_INIT_DONE(); @@ -16,12 +16,17 @@ SD_link_t __SD_link_create(void *surf_link, void *data) { link->data = data; /* user data */ const char *name = SD_link_get_name(link); - xbt_dict_set(sd_global->links, name, link, __SD_link_destroy); /* add the workstation to the dictionary */ + xbt_dict_set(sd_global->links, name, link, __SD_link_destroy); /* add the link to the dictionary */ return link; } -/* Returns the user data of a link. The user data can be NULL. +/** + * \brief Returns the user data of a link + * + * \param link a link + * \return the user data associated with this link (can be \c NULL) + * \see SD_link_set_data() */ void* SD_link_get_data(SD_link_t link) { SD_CHECK_INIT_DONE(); @@ -29,7 +34,15 @@ void* SD_link_get_data(SD_link_t link) { return link->data; } -/* Sets the user data of a link. The new data can be NULL. The old data should have been freed first if it was not NULL. +/** + * \brief Sets the user data of a link + * + * The new data can be \c NULL. The old data should have been freed first + * if it was not \c NULL. + * + * \param link a link + * \param data the new data you want to associate with this link + * \see SD_link_get_data() */ void SD_link_set_data(SD_link_t link, void *data) { SD_CHECK_INIT_DONE(); @@ -37,7 +50,11 @@ void SD_link_set_data(SD_link_t link, void *data) { link->data = data; } -/* Returns the name of a link. The name cannot be NULL. +/** + * \brief Returns the name of a link + * + * \param link a link + * \return the name of this link (cannot be \c NULL) */ const char* SD_link_get_name(SD_link_t link) { SD_CHECK_INIT_DONE(); @@ -45,15 +62,11 @@ const char* SD_link_get_name(SD_link_t link) { return surf_workstation_resource->extension_public->get_link_name(link->surf_link); } -/* Returns the capacity of a link. - */ -/* -double SD_link_get_capacity(SD_link_t link) { - xbt_assert0(link, "Invalid parameter"); - return link->capacity; -}*/ - -/* Return the current bandwidth of a link. +/** + * \brief Returns the current bandwidth of a link + * + * \param link a link + * \return the current bandwidth of this link, in Flops */ double SD_link_get_current_bandwidth(SD_link_t link) { SD_CHECK_INIT_DONE(); @@ -61,7 +74,11 @@ double SD_link_get_current_bandwidth(SD_link_t link) { return surf_workstation_resource->extension_public->get_link_bandwidth(link->surf_link); } -/* Return the current latency of a link. +/** + * \brief Returns the current latency of a link + * + * \param link a link + * \return the current latency of this link, in seconds */ double SD_link_get_current_latency(SD_link_t link) { SD_CHECK_INIT_DONE(); @@ -69,7 +86,7 @@ double SD_link_get_current_latency(SD_link_t link) { return surf_workstation_resource->extension_public->get_link_latency(link->surf_link); } -/* Destroys a link. The user data (if any) should have been destroyed first. +/* Destroys a link. */ void __SD_link_destroy(void *link) { SD_CHECK_INIT_DONE(); diff --git a/src/simdag/sd_task.c b/src/simdag/sd_task.c index 59530d8507..4a046fa6b9 100644 --- a/src/simdag/sd_task.c +++ b/src/simdag/sd_task.c @@ -3,7 +3,14 @@ #include "xbt/sysdep.h" #include "xbt/dynar.h" -/* Creates a task. +/** + * \brief Creates a new task. + * + * \param name the name of the task (can be \c NULL) + * \param data the user data you want to associate with the task (can be \c NULL) + * \param amount the computing amount necessary to do this task + * \return the new task + * \see SD_task_destroy() */ SD_task_t SD_task_create(const char *name, void *data, double amount) { SD_CHECK_INIT_DONE(); @@ -40,7 +47,12 @@ SD_task_t SD_task_create(const char *name, void *data, double amount) { return task; } -/* Returns the data of a task. +/** + * \brief Returns the user data of a task + * + * \param task a task + * \return the user data associated with this task (can be \c NULL) + * \see SD_task_set_data() */ void* SD_task_get_data(SD_task_t task) { SD_CHECK_INIT_DONE(); @@ -48,7 +60,29 @@ void* SD_task_get_data(SD_task_t task) { return task->data; } -/* Returns the state of a task: SD_NOT_SCHEDULED, SD_SCHEDULED, SD_READY, SD_RUNNING, SD_DONE or SD_FAILED. +/** + * \brief Sets the user data of a task + * + * The new data can be \c NULL. The old data should have been freed first + * if it was not \c NULL. + * + * \param task a task + * \param data the new data you want to associate with this task + * \see SD_task_get_data() + */ +void SD_task_set_data(SD_task_t task, void *data) { + SD_CHECK_INIT_DONE(); + xbt_assert0(task != NULL, "Invalid parameter"); + task->data = data; +} + +/** + * \brief Returns the state of a task + * + * \param task a task + * \return the current \ref e_SD_task_state_t "state" of this task: + * #SD_NOT_SCHEDULED, #SD_SCHEDULED, #SD_READY, #SD_RUNNING, #SD_DONE or #SD_FAILED + * \see e_SD_task_state_t */ e_SD_task_state_t SD_task_get_state(SD_task_t task) { SD_CHECK_INIT_DONE(); @@ -93,23 +127,20 @@ void __SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state) { default: xbt_assert0(0, "Invalid state"); } - xbt_swag_insert(task,task->state_set); + xbt_swag_insert(task, task->state_set); if (task->watch_points & new_state) { printf("Watch point reached with task '%s' in state %d!\n", SD_task_get_name(task), new_state); sd_global->watch_point_reached = 1; + SD_task_unwatch(task, new_state); /* remove the watch point */ } } -/* Sets the data of a task. - */ -void SD_task_set_data(SD_task_t task, void *data) { - SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); - task->data = data; -} - -/* Returns the name of a task. The name can be NULL. +/** + * \brief Returns the name of a task + * + * \param task a task + * \return the name of this task (can be \c NULL) */ const char* SD_task_get_name(SD_task_t task) { SD_CHECK_INIT_DONE(); @@ -117,7 +148,12 @@ const char* SD_task_get_name(SD_task_t task) { return task->name; } -/* Returns the computing amount of a task. +/** + * \brief Returns the computing amount of a task + * + * \param task a task + * \return the total computing amount of this task + * \see SD_task_get_remaining_amount() */ double SD_task_get_amount(SD_task_t task) { SD_CHECK_INIT_DONE(); @@ -125,7 +161,12 @@ double SD_task_get_amount(SD_task_t task) { return task->amount; } -/* Returns the remaining computing amount of a task. +/** + * \brief Returns the remaining computing amount of a task + * + * \param task a task + * \return the remaining computing amount of this task + * \see SD_task_get_amount() */ double SD_task_get_remaining_amount(SD_task_t task) { SD_CHECK_INIT_DONE(); @@ -168,8 +209,17 @@ static void __SD_task_dependency_destroy(void *dependency) { xbt_free(dependency); } -/* Adds a dependency between two tasks. Their state must be SD_NOT_SCHEDULED, SD_SCHEDULED - * or SD_READY. +/** + * \brief Adds a dependency between two tasks + * + * \a dst will depend on \a src, ie \a dst will not start before \a src is finished. + * Their \ref e_SD_task_state_t "state" must be #SD_NOT_SCHEDULED, #SD_SCHEDULED or #SD_READY. + * + * \param name the name of the new dependency (can be \c NULL) + * \param data the user data you want to associate with this dependency (can be \c NULL) + * \param src the task which must be executed first + * \param dst the task you want to make depend on \a src + * \see SD_task_dependency_remove() */ void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst) { SD_CHECK_INIT_DONE(); @@ -215,7 +265,12 @@ void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task __SD_print_dependencies(dst); */ } -/* Removes a dependency between two tasks. +/** + * \brief Remove a dependency between two tasks + * + * \param src a task + * \param dst a task depending on \a src + * \see SD_task_dependency_add() */ void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) { SD_CHECK_INIT_DONE(); @@ -261,7 +316,13 @@ void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) { __SD_print_dependencies(dst);*/ } -/* Returns the data associated to a dependency between two tasks. This data can be NULL. +/** + * \brief Returns the user data associated with a dependency between two tasks + * + * \param src a task + * \param dst a task depending on \a src + * \return the user data associated with this dependency (can be \c NULL) + * \see SD_task_dependency_add() */ void *SD_task_dependency_get_data(SD_task_t src, SD_task_t dst) { SD_CHECK_INIT_DONE(); @@ -295,10 +356,15 @@ static void __SD_print_watch_points(SD_task_t task) { printf("\n"); } -/* Adds a watch point to a task. - SD_simulate will stop as soon as the state of this task is the one given in argument. - Watch point is then automatically removed. - The given state must be SD_SCHEDULED, SD_READY, SD_RUNNING, SD_DONE or SD_FAILED. +/** + * \brief Adds a watch point to a task + * + * SD_simulate() will stop as soon as the \ref e_SD_task_state_t "state" of this task becomes the one given in argument. The + * watch point is then automatically removed. + * + * \param task a task + * \param state the \ref e_SD_task_state_t "state" you want to watch (cannot be #SD_NOT_SCHEDULED) + * \see SD_task_unwatch() */ void SD_task_watch(SD_task_t task, e_SD_task_state_t state) { SD_CHECK_INIT_DONE(); @@ -306,11 +372,15 @@ void SD_task_watch(SD_task_t task, e_SD_task_state_t state) { xbt_assert0(state != SD_NOT_SCHEDULED, "Cannot add a watch point for state SD_NOT_SCHEDULED"); task->watch_points = task->watch_points | state; - __SD_print_watch_points(task); + /* __SD_print_watch_points(task);*/ } -/* Removes a watch point from a task. - The given state must be SD_SCHEDULED, SD_READY, SD_RUNNING, SD_DONE or SD_FAILED. +/** + * \brief Removes a watch point from a task + * + * \param task a task + * \param state the \ref e_SD_task_state_t "state" you no longer want to watch + * \see SD_task_watch() */ void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state) { SD_CHECK_INIT_DONE(); @@ -318,7 +388,7 @@ void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state) { xbt_assert0(state != SD_NOT_SCHEDULED, "Cannot have a watch point for state SD_NOT_SCHEDULED"); task->watch_points = task->watch_points & ~state; - __SD_print_watch_points(task); + /* __SD_print_watch_points(task);*/ } /* Destroys the data memorised by SD_task_schedule. Task state must be SD_SCHEDULED or SD_READY. @@ -332,13 +402,20 @@ static void __SD_task_destroy_scheduling_data(SD_task_t task) { xbt_free(task->communication_amount); } -/* Schedules a task. - * task: the task to schedule - * workstation_nb: number of workstations where the task will be executed - * workstation_list: workstations where the task will be executed - * computation_amount: computation amount for each workstation - * communication_amount: communication amount between each pair of workstations - * rate: task execution speed rate +/** + * \brief Schedules a task + * + * The task state must be #SD_NOT_SCHEDULED. + * Once scheduled, a task will be executed as soon as possible in SD_simulate(), + * i.e. when its dependencies are satisfied. + * + * \param task the task you want to schedule + * \param workstation_nb number of workstations on which the task will be executed + * \param workstation_list the workstations on which the task will be executed + * \param computation_amount computation amount for each workstation + * \param communication_amount communication amount between each pair of workstations + * \param rate task execution speed rate + * \see SD_task_unschedule() */ void SD_task_schedule(SD_task_t task, int workstation_nb, const SD_workstation_t *workstation_list, double *computation_amount, @@ -372,9 +449,15 @@ void SD_task_schedule(SD_task_t task, int workstation_nb, __SD_task_set_state(task, SD_SCHEDULED); } -/* Unschedules a task. The state must be SD_SCHEDULED, SD_READY, SD_RUNNING or SD_FAILED. - * The task is reinitialised and its state becomes SD_NOT_SCHEDULED. - * Call SD_task_schedule to schedule it again. +/** + * \brief Unschedules a task + * + * The task state must be #SD_SCHEDULED, #SD_READY, #SD_RUNNING or #SD_FAILED. + * If you call this function, the task state becomes #SD_NOT_SCHEDULED. + * Call SD_task_schedule() to schedule it again. + * + * \param task the task you want to unschedule + * \see SD_task_schedule() */ void SD_task_unschedule(SD_task_t task) { SD_CHECK_INIT_DONE(); @@ -435,7 +518,13 @@ void __SD_task_remove_dependencies(SD_task_t task) { } } -/* Destroys a task. The user data (if any) should have been destroyed first. +/** + * \brief Destroys a task. + * + * The user data (if any) should have been destroyed first. + * + * \param task the task you want to destroy + * \see SD_task_create() */ void SD_task_destroy(SD_task_t task) { SD_CHECK_INIT_DONE(); diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index 05bf3d3bdc..05dab14ecb 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -21,13 +21,13 @@ SD_workstation_t __SD_workstation_create(void *surf_workstation, void *data) { return workstation; } -/** @ingroup SD_workstation_management - * @brief Returns a workstation given its name +/** + * \brief Returns a workstation given its name * - * If there is no such workstation, the function returns NULL. + * If there is no such workstation, the function returns \c NULL. * - * @param name workstation name - * @return the workstation, or NULL if there is no such workstation + * \param name workstation name + * \return the workstation, or \c NULL if there is no such workstation */ SD_workstation_t SD_workstation_get_by_name(const char *name) { SD_CHECK_INIT_DONE(); @@ -37,13 +37,13 @@ SD_workstation_t SD_workstation_get_by_name(const char *name) { return xbt_dict_get_or_null(sd_global->workstations, name); } -/** @ingroup SD_workstation_management - * @brief Returns the workstations list +/** + * \brief Returns the workstations list * - * Use SD_workstation_get_number to known the array size. + * Use SD_workstation_get_number() to know the array size. * - * @return an array of SD_workstation_t containing all workstations - * @see SD_workstation_get_number + * \return an array of \ref SD_workstation_t containing all workstations + * \see SD_workstation_get_number() */ SD_workstation_t* SD_workstation_get_list(void) { SD_CHECK_INIT_DONE(); @@ -63,51 +63,51 @@ SD_workstation_t* SD_workstation_get_list(void) { return array; } -/** @ingroup SD_workstation_management - * @brief Returns the number of workstations +/** + * \brief Returns the number of workstations * - * @return the number of existing workstations - * @see SD_workstation_get_list + * \return the number of existing workstations + * \see SD_workstation_get_list() */ int SD_workstation_get_number(void) { SD_CHECK_INIT_DONE(); return sd_global->workstation_count; } -/** @ingroup SD_workstation_management - * @brief Sets the user data of a workstation +/** + * \brief Returns the user data of a workstation * - * The new data can be NULL. The old data should have been freed first - * if it was not NULL. - * - * @param workstation a workstation - * @param data the new data you want to associate with this workstation - * @see SD_workstation_get_data + * \param workstation a workstation + * \return the user data associated with this workstation (can be \c NULL) + * \see SD_workstation_set_data() */ -void SD_workstation_set_data(SD_workstation_t workstation, void *data) { +void* SD_workstation_get_data(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); xbt_assert0(workstation != NULL, "Invalid parameter"); - workstation->data = data; + return workstation->data; } -/** @ingroup SD_workstation_management - * @brief Returns the user data of a workstation +/** + * \brief Sets the user data of a workstation * - * @param workstation a workstation - * @return the user data associated with this workstation (can be NULL) - * @see SD_workstation_set_data + * The new data can be \c NULL. The old data should have been freed first + * if it was not \c NULL. + * + * \param workstation a workstation + * \param data the new data you want to associate with this workstation + * \see SD_workstation_get_data() */ -void* SD_workstation_get_data(SD_workstation_t workstation) { +void SD_workstation_set_data(SD_workstation_t workstation, void *data) { SD_CHECK_INIT_DONE(); xbt_assert0(workstation != NULL, "Invalid parameter"); - return workstation->data; + workstation->data = data; } -/** @ingroup SD_workstation_management - * @brief Returns the name of a workstation +/** + * \brief Returns the name of a workstation * - * @param workstation a workstation - * @return the name of this workstation (cannot be NULL) + * \param workstation a workstation + * \return the name of this workstation (cannot be \c NULL) */ const char* SD_workstation_get_name(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); @@ -115,15 +115,15 @@ const char* SD_workstation_get_name(SD_workstation_t workstation) { return surf_workstation_resource->common_public->get_resource_name(workstation->surf_workstation); } -/** @ingroup SD_workstation_management - * @brief Returns the route between two workstations +/** + * \brief Returns the route between two workstations * - * Use SD_workstation_route_get_size to known the array size. + * Use SD_workstation_route_get_size() to know the array size. * - * @param src a workstation - * @param dst another workstation - * @return a new array of SD_link_t representating the route between these two workstations - * @see SD_workstation_route_get_size + * \param src a workstation + * \param dst another workstation + * \return a new array of \ref SD_link_t representating the route between these two workstations + * \see SD_workstation_route_get_size(), SD_link_t */ SD_link_t* SD_workstation_route_get_list(SD_workstation_t src, SD_workstation_t dst) { SD_CHECK_INIT_DONE(); @@ -145,13 +145,13 @@ SD_link_t* SD_workstation_route_get_list(SD_workstation_t src, SD_workstation_t return route; } -/** @ingroup SD_workstation_management - * @brief Returns the number of links on the route between two workstations +/** + * \brief Returns the number of links on the route between two workstations * - * @param src a workstation - * @param dst another workstation - * @return the number of links on the route between these two workstations - * @see SD_workstation_route_get_list + * \param src a workstation + * \param dst another workstation + * \return the number of links on the route between these two workstations + * \see SD_workstation_route_get_list() */ int SD_workstation_route_get_size(SD_workstation_t src, SD_workstation_t dst) { SD_CHECK_INIT_DONE(); @@ -159,12 +159,12 @@ int SD_workstation_route_get_size(SD_workstation_t src, SD_workstation_t dst) { get_route_size(src->surf_workstation, dst->surf_workstation); } -/** @ingroup SD_workstation_management - * @brief Returns the total power of a workstation +/** + * \brief Returns the total power of a workstation * - * @param workstation a workstation - * @return the total power of this workstation - * @see SD_workstation_get_available_power + * \param workstation a workstation + * \return the total power of this workstation + * \see SD_workstation_get_available_power() */ double SD_workstation_get_power(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); @@ -172,12 +172,12 @@ double SD_workstation_get_power(SD_workstation_t workstation) { return surf_workstation_resource->extension_public->get_speed(workstation->surf_workstation, 1.0); } -/** @ingroup SD_workstation_management - * @brief Returns the proportion of available power in a workstation +/** + * \brief Returns the proportion of available power in a workstation * - * @param workstation a workstation - * @return the proportion of power currently available in this workstation (normally a number between 0 and 1) - * @see SD_workstation_get_power + * \param workstation a workstation + * \return the proportion of power currently available in this workstation (normally a number between 0 and 1) + * \see SD_workstation_get_power() */ double SD_workstation_get_available_power(SD_workstation_t workstation) { SD_CHECK_INIT_DONE();