A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove features marked with XBT_ATTRIB_DEPRECATED_v325.
[simgrid.git]
/
include
/
simgrid
/
kernel
/
resource
/
Resource.hpp
diff --git
a/include/simgrid/kernel/resource/Resource.hpp
b/include/simgrid/kernel/resource/Resource.hpp
index
551ff4c
..
9f2c97b
100644
(file)
--- a/
include/simgrid/kernel/resource/Resource.hpp
+++ b/
include/simgrid/kernel/resource/Resource.hpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2004-201
8
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-201
9
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-30,42
+30,42
@@
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
*/
* @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 */
virtual ~Resource();
/** @brief Get the Model of the current Resource */
- Model*
model() const;
+ Model*
get_model() const { return model_; }
/** @brief Get the name of the current Resource */
/** @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 */
/** @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
- *
- * @param event What happened
- * @param value [TODO]
- */
- virtual void apply_event(TraceEvent* event, double value) = 0;
+ /** @brief Apply an event of external load event to that resource */
+ virtual void apply_event(profile::Event* event, double value) = 0;
/** @brief Check if the current Resource is used (if it currently serves an action) */
/** @brief Check if the current Resource is used (if it currently serves an action) */
- virtual bool is
U
sed() = 0;
+ virtual bool is
_u
sed() = 0;
- /** @brief returns the current load (in flops per second, byte per second or similar) */
- virtual double getLoad();
+ /** @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;
/** @brief Check if the current Resource is active */
/** @brief Check if the current Resource is active */
- virtual bool isOn() const;
- /** @brief Check if the current Resource is shut down */
- virtual bool isOff() const;
+ virtual bool is_on() const { return is_on_; }
/** @brief Turn on the current Resource */
/** @brief Turn on the current Resource */
- virtual void turn
On();
+ virtual void turn
_on() { is_on_ = true; }
/** @brief Turn off the current Resource */
/** @brief Turn off the current Resource */
- virtual void turnOff();
+ 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);
private:
std::string name_;
private:
std::string name_;
@@
-74,16
+74,19
@@
private:
public: /* LMM */
/** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
public: /* LMM */
/** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
- kernel::lmm::Constraint* constraint() const;
+ lmm::Constraint* get_constraint() const { return constraint_; }
private:
private:
- kernel::lmm::Constraint* const constraint_ = nullptr;
+ kernel::lmm::Constraint* const constraint_;
+
+public:
+ profile::Event* state_event_ = nullptr;
protected:
struct Metric {
double peak; /**< The peak of the metric, ie its max value */
protected:
struct Metric {
double peak; /**< The peak of the metric, ie its max value */
- double scale; /**< Current availability of the metric according to the
trac
es, in [0,1] */
-
TraceEvent* event; /**< The associated trac
e event associated to the metric */
+ double scale; /**< Current availability of the metric according to the
profil
es, in [0,1] */
+
profile::Event* event; /**< The associated profil
e event associated to the metric */
};
};
} // namespace resource
};
};
} // namespace resource
@@
-95,7
+98,7
@@
template <> class hash<simgrid::kernel::resource::Resource> {
public:
std::size_t operator()(const simgrid::kernel::resource::Resource& r) const
{
public:
std::size_t operator()(const simgrid::kernel::resource::Resource& r) const
{
- return (std::size_t)xbt_str_hash(r.get
C
name());
+ return (std::size_t)xbt_str_hash(r.get
_c
name());
}
};
} // namespace std
}
};
} // namespace std