Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a way to set a property on s4u::Host
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 1 Apr 2016 18:57:36 +0000 (20:57 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 1 Apr 2016 18:57:36 +0000 (20:57 +0200)
include/simgrid/s4u/host.hpp
src/s4u/s4u_host.cpp

index 2e5144a..04ce05e 100644 (file)
@@ -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);
index d28b2a6..8d5788d 100644 (file)
@@ -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<simgrid::surf::HostImpl>();
+  return surf_host->getProperty(key);
+}
+void Host::setProperty(const char*key, const char *value){
+  simgrid::simix::kernel([&] {
+    simgrid::surf::HostImpl* surf_host = this->extension<simgrid::surf::HostImpl>();
+    surf_host->setProperty(key,value);
+  });
+}
+
 /** Get the processes attached to the host */
 xbt_swag_t Host::processes()
 {