Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/mwapl/simgrid
[simgrid.git] / src / kernel / resource / Resource.hpp
index 0f5bda2883b2a9dc20d84951752ae9af84182ee5..9e2f2842fc290d530ba64a1b033802fed33d92c9 100644 (file)
@@ -20,8 +20,8 @@
 
 namespace simgrid::kernel::resource {
 
-/** @ingroup SURF_interface
- * @brief SURF resource interface class
+/** @ingroup Model_interface
+ * @brief Resource interface class
  * @details This is the ancestor class of every resources in SimGrid, such as links, CPU or disk
  */
 class XBT_PUBLIC Resource : public actor::ObjectAccessSimcallItem {
@@ -101,10 +101,21 @@ public:
 
   lmm::Constraint* get_constraint() const { return constraint_; }
 
+  /** @brief Set the concurrency limit for this resource */
+  virtual void set_concurrency_limit(int limit) const
+  {
+    if (limit != -1)
+      get_constraint()->reset_concurrency_maximum();
+    get_constraint()->set_concurrency_limit(limit);
+  }
+
+  /** @brief Get the concurrency limit of this resource */
+  virtual int get_concurrency_limit() const { return get_constraint()->get_concurrency_limit(); }
+
   /** @brief returns the current load due to activities (in flops per second, byte per second or similar)
    *
    * The load due to external usages modeled by profile files is ignored.*/
-  virtual double get_load() const { return constraint_->get_usage(); }
+  virtual double get_load() const { return constraint_->get_load(); }
 
   bool is_used() const override { return model_->get_maxmin_system()->constraint_used(constraint_); }
 };