From: Martin Quinson Date: Fri, 1 Apr 2016 18:57:36 +0000 (+0200) Subject: Add a way to set a property on s4u::Host X-Git-Tag: v3_13~180^2~16 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9a696a7603f2d24e7f7e00f599362f0cc0620382 Add a way to set a property on s4u::Host --- diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index 2e5144a0ca..04ce05eb24 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -70,6 +70,8 @@ public: double speed(); int core_count(); xbt_dict_t properties(); + const char*property(const char*key); + void setProperty(const char*key, const char *value); xbt_swag_t processes(); double currentPowerPeak(); double powerPeakAt(int pstate_index); diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index d28b2a6743..8d5788d0ec 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -117,6 +117,18 @@ xbt_dict_t Host::properties() { }); } +/** Retrieve the property value (or NULL if not set) */ +const char*Host::property(const char*key) { + simgrid::surf::HostImpl* surf_host = this->extension(); + return surf_host->getProperty(key); +} +void Host::setProperty(const char*key, const char *value){ + simgrid::simix::kernel([&] { + simgrid::surf::HostImpl* surf_host = this->extension(); + surf_host->setProperty(key,value); + }); +} + /** Get the processes attached to the host */ xbt_swag_t Host::processes() {