X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f155d2d76b81d5d14090941da900f78335080930..1037987174e34ec2ea483da79d651c7e2e16e83e:/src/simdag/sd_link.c diff --git a/src/simdag/sd_link.c b/src/simdag/sd_link.c index 0fbe322d27..07e0fa8a52 100644 --- a/src/simdag/sd_link.c +++ b/src/simdag/sd_link.c @@ -17,6 +17,10 @@ SD_link_t __SD_link_create(void *surf_link, void *data) { link = xbt_new(s_SD_link_t, 1); link->surf_link = surf_link; link->data = data; /* user data */ + if(surf_workstation_model->extension_public->link_shared(surf_link)) + link->sharing_policy=SD_LINK_SHARED; + else + link->sharing_policy=SD_LINK_FATPIPE; name = SD_link_get_name(link); xbt_dict_set(sd_global->links, name, link, __SD_link_destroy); /* add the link to the dictionary */ @@ -109,7 +113,7 @@ const char* SD_link_get_name(SD_link_t link) { * \brief Returns the current bandwidth of a link * * \param link a link - * \return the current bandwidth of this link, in Flops + * \return the current bandwidth of this link, in bytes per second */ double SD_link_get_current_bandwidth(SD_link_t link) { SD_CHECK_INIT_DONE(); @@ -117,6 +121,33 @@ double SD_link_get_current_bandwidth(SD_link_t link) { return surf_workstation_model->extension_public->get_link_bandwidth(link->surf_link); } +/** + * \brief Returns the value of a given link property + * + * \param link the inspected link + * \param name a property name + * \return value of a property (or NULL if property not set) + */ +const char* SD_link_get_property_value(SD_link_t link, const char* name) +{ + return xbt_dict_get_or_null(SD_link_get_properties(link), name); +} + +/** + * \brief Returns a #xbt_dict_t consisting of the list of properties assigned to a link + * + * \param link a link + * \return the dictionary containing the properties associated with the link + */ +xbt_dict_t SD_link_get_properties(SD_link_t link) +{ + SD_CHECK_INIT_DONE(); + xbt_assert0((link != NULL), "Invalid parameters"); + + return (surf_workstation_model->common_public->get_properties(link->surf_link)); + +} + /** * \brief Returns the current latency of a link * @@ -129,6 +160,21 @@ double SD_link_get_current_latency(SD_link_t link) { return surf_workstation_model->extension_public->get_link_latency(link->surf_link); } +/** + * \brief Returns the sharing policy of this workstation. + * + * \param link a link + * \return the sharing policyfor the flows going through this link: + * SD_LINK_SHARED or SD_LINK_FATPIPE + * + */ +e_SD_link_sharing_policy_t SD_link_get_sharing_policy (SD_link_t link) { + SD_CHECK_INIT_DONE(); + xbt_assert0(link != NULL, "Invalid parameter"); + return link->sharing_policy; +} + + /* Destroys a link. */ void __SD_link_destroy(void *link) {