X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bfa4e95e4538099a54c5afedd403264c8d99adb6..a73d204e173f35c0abb92b26e061929066b8b283:/include/simgrid/kernel/resource/Resource.hpp diff --git a/include/simgrid/kernel/resource/Resource.hpp b/include/simgrid/kernel/resource/Resource.hpp index ecfd29d182..9f2c97b720 100644 --- a/include/simgrid/kernel/resource/Resource.hpp +++ b/include/simgrid/kernel/resource/Resource.hpp @@ -30,19 +30,22 @@ public: * @param name The name of the Resource * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component */ - Resource(Model* model, const std::string& name, lmm::Constraint* constraint); + Resource(Model* model, const std::string& name, lmm::Constraint* constraint) + : name_(name), model_(model), constraint_(constraint) + { + } virtual ~Resource(); /** @brief Get the Model of the current Resource */ - Model* get_model() const; + Model* get_model() const { return model_; } /** @brief Get the name of the current Resource */ - const std::string& get_name() const; + const std::string& get_name() const { return name_; } /** @brief Get the name of the current Resource */ - const char* get_cname() const; + const char* get_cname() const { return name_.c_str(); } - bool operator==(const Resource& other) const; + bool operator==(const Resource& other) const { return name_ == other.name_; } /** @brief Apply an event of external load event to that resource */ virtual void apply_event(profile::Event* event, double value) = 0; @@ -52,28 +55,18 @@ public: /** @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 trace files is ignored.*/ - virtual double get_load(); + * The load due to external usages modeled by profile files is ignored.*/ + virtual double get_load() const; /** @brief Check if the current Resource is active */ - virtual bool is_on() const; - /** @brief Check if the current Resource is shut down */ - virtual bool is_off() const; + virtual bool is_on() const { return is_on_; } /** @brief Turn on the current Resource */ - virtual void turn_on(); + virtual void turn_on() { is_on_ = true; } /** @brief Turn off the current Resource */ - virtual void turn_off(); - /** @brief setup the trace file with states events (ON or OFF). Trace must contain boolean values. */ + virtual void turn_off() { is_on_ = false; } + /** @brief setup the profile file with states events (ON or OFF). The profile must contain boolean values. */ virtual void set_state_profile(profile::Profile* profile); -#ifndef DOXYGEN - XBT_ATTRIB_DEPRECATED_v325("Please use Resource::set_state_profile()") virtual void set_state_trace( - profile::Profile* profile) - { - set_state_profile(profile); - } -#endif - private: std::string name_; Model* model_; @@ -81,10 +74,10 @@ private: public: /* LMM */ /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */ - lmm::Constraint* get_constraint() const; + lmm::Constraint* get_constraint() const { return constraint_; } private: - kernel::lmm::Constraint* const constraint_ = nullptr; + kernel::lmm::Constraint* const constraint_; public: profile::Event* state_event_ = nullptr; @@ -92,8 +85,8 @@ public: protected: struct Metric { double peak; /**< The peak of the metric, ie its max value */ - double scale; /**< Current availability of the metric according to the traces, in [0,1] */ - profile::Event* event; /**< The associated trace event associated to the metric */ + double scale; /**< Current availability of the metric according to the profiles, in [0,1] */ + profile::Event* event; /**< The associated profile event associated to the metric */ }; }; } // namespace resource