--- /dev/null
+/* Copyright (c) 2004-2018. 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. */
+
+#include "src/kernel/model/Resource.hpp"
+#include "src/kernel/lmm/maxmin.hpp" // Constraint
+#include "src/surf/surf_interface.hpp"
+
+namespace simgrid {
+namespace kernel {
+namespace model {
+
+Resource::Resource(surf::Model* model, const std::string& name, lmm::Constraint* constraint)
+ : name_(name), model_(model), constraint_(constraint)
+{
+}
+
+Resource::~Resource() = default;
+
+bool Resource::isOn() const
+{
+ return isOn_;
+}
+bool Resource::isOff() const
+{
+ return not isOn_;
+}
+
+void Resource::turnOn()
+{
+ isOn_ = true;
+}
+
+void Resource::turnOff()
+{
+ isOn_ = false;
+}
+
+double Resource::getLoad()
+{
+ return constraint_->get_usage();
+}
+
+surf::Model* Resource::model() const
+{
+ return model_;
+}
+
+const std::string& Resource::getName() const
+{
+ return name_;
+}
+
+const char* Resource::getCname() const
+{
+ return name_.c_str();
+}
+
+bool Resource::operator==(const Resource& other) const
+{
+ return name_ == other.name_;
+}
+
+kernel::lmm::Constraint* Resource::constraint() const
+{
+ return const_cast<kernel::lmm::Constraint*>(constraint_);
+}
+
+} // namespace model
+} // namespace kernel
+} // namespace simgrid
--- /dev/null
+/* Copyright (c) 2004-2018. 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. */
+
+#ifndef SIMGRID_KERNEL_MODEL_RESOURCE_HPP
+#define SIMGRID_KERNEL_MODEL_RESOURCE_HPP
+
+#include "src/surf/surf_interface.hpp"
+
+namespace simgrid {
+namespace kernel {
+namespace model {
+
+/** @ingroup SURF_interface
+ * @brief SURF resource interface class
+ * @details This is the ancestor class of every resources in SimGrid, such as links, CPU or storage
+ */
+XBT_PUBLIC_CLASS Resource
+{
+public:
+ /**
+ * @brief Constructor of LMM Resources
+ *
+ * @param model Model associated to this Resource
+ * @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(surf::Model * model, const std::string& name, lmm::Constraint* constraint);
+
+ virtual ~Resource();
+
+ /** @brief Get the Model of the current Resource */
+ surf::Model* model() const;
+
+ /** @brief Get the name of the current Resource */
+ const std::string& getName() const;
+ /** @brief Get the name of the current Resource */
+ const char* getCname() const;
+
+ bool operator==(const Resource& other) const;
+
+ /**
+ * @brief Apply an event of external load event to that resource
+ *
+ * @param event What happened
+ * @param value [TODO]
+ */
+ virtual void apply_event(tmgr_trace_event_t event, double value) = 0;
+
+ /** @brief Check if the current Resource is used (if it currently serves an action) */
+ virtual bool isUsed() = 0;
+
+ /** @brief returns the current load (in flops per second, byte per second or similar) */
+ virtual double getLoad();
+
+ /** @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;
+ /** @brief Turn on the current Resource */
+ virtual void turnOn();
+ /** @brief Turn off the current Resource */
+ virtual void turnOff();
+
+private:
+ std::string name_;
+ surf::Model* model_;
+ bool isOn_ = true;
+
+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;
+
+protected:
+ const kernel::lmm::Constraint* constraint_ = nullptr;
+};
+} // namespace model
+} // namespace kernel
+} // namespace simgrid
+
+namespace std {
+template <> class hash<simgrid::kernel::model::Resource> {
+public:
+ std::size_t operator()(const simgrid::kernel::model::Resource& r) const
+ {
+ return (std::size_t)xbt_str_hash(r.getCname());
+ }
+};
+} // namespace std
+
+#endif
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Storage.hpp"
#include "simgrid/simix.hpp"
+#include "src/kernel/model/Resource.hpp"
#include "src/plugins/file_system/FileSystem.hpp"
#include "src/surf/StorageImpl.hpp"
#include <unordered_map>
#include <xbt/signal.hpp>
#include "simgrid/s4u/Storage.hpp"
+#include "src/kernel/model/Resource.hpp"
#include "src/surf/PropertyHolder.hpp"
#include "surf_interface.hpp"
#include <map>
#include "simgrid/s4u/Host.hpp"
#include "src/kernel/lmm/maxmin.hpp"
+#include "src/kernel/model/Resource.hpp"
#include <list>
#include "simgrid/s4u/Link.hpp"
#include "src/kernel/lmm/maxmin.hpp"
+#include "src/kernel/model/Resource.hpp"
#include "src/surf/PropertyHolder.hpp"
#include "src/surf/surf_interface.hpp"
#include "xbt/base.h"
* Resource *
************/
-namespace simgrid {
-namespace kernel {
-namespace model {
-
-Resource::Resource(surf::Model* model, const std::string& name, lmm::Constraint* constraint)
- : name_(name), model_(model), constraint_(constraint)
-{}
-
-Resource::~Resource() = default;
-
-bool Resource::isOn() const {
- return isOn_;
-}
-bool Resource::isOff() const {
- return not isOn_;
-}
-
-void Resource::turnOn()
-{
- isOn_ = true;
-}
-
-void Resource::turnOff()
-{
- isOn_ = false;
-}
-
-double Resource::getLoad()
-{
- return constraint_->get_usage();
-}
-
-surf::Model* Resource::model() const
-{
- return model_;
-}
-
-const std::string& Resource::getName() const
-{
- return name_;
-}
-
-const char* Resource::getCname() const
-{
- return name_.c_str();
-}
-
-bool Resource::operator==(const Resource &other) const {
- return name_ == other.name_;
-}
-
-kernel::lmm::Constraint* Resource::constraint() const
-{
- return const_cast<kernel::lmm::Constraint*>(constraint_);
-}
-
-}
-} // namespace kernel
-}
-
/**********
* Action *
**********/
tmgr_trace_event_t event; /**< The associated trace event associated to the metric */
};
-namespace simgrid {
-namespace kernel {
-namespace model {
-
-/** @ingroup SURF_interface
- * @brief SURF resource interface class
- * @details This is the ancestor class of every resources in SimGrid, such as links, CPU or storage
- */
-XBT_PUBLIC_CLASS Resource {
-public:
- /**
- * @brief Constructor of LMM Resources
- *
- * @param model Model associated to this Resource
- * @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(surf::Model * model, const std::string& name, lmm::Constraint* constraint);
-
- virtual ~Resource();
-
- /** @brief Get the Model of the current Resource */
- surf::Model* model() const;
-
- /** @brief Get the name of the current Resource */
- const std::string& getName() const;
- /** @brief Get the name of the current Resource */
- const char* getCname() const;
-
- bool operator==(const Resource &other) const;
-
- /**
- * @brief Apply an event of external load event to that resource
- *
- * @param event What happened
- * @param value [TODO]
- */
- virtual void apply_event(tmgr_trace_event_t event, double value) = 0;
-
- /** @brief Check if the current Resource is used (if it currently serves an action) */
- virtual bool isUsed()=0;
-
- /** @brief returns the current load (in flops per second, byte per second or similar) */
- virtual double getLoad();
-
- /** @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;
- /** @brief Turn on the current Resource */
- virtual void turnOn();
- /** @brief Turn off the current Resource */
- virtual void turnOff();
-
-private:
- std::string name_;
- surf::Model* model_;
- bool isOn_ = true;
-
-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;
-
-protected:
- const kernel::lmm::Constraint* constraint_ = nullptr;
-};
-} // namespace model
-}
-}
-
-namespace std {
-template <> class hash<simgrid::kernel::model::Resource> {
-public:
- std::size_t operator()(const simgrid::kernel::model::Resource& r) const
- {
- return (std::size_t)xbt_str_hash(r.getCname());
- }
-};
-}
#endif /* SURF_MODEL_H_ */
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
+#include "src/kernel/model/Resource.hpp"
#include "src/surf/surf_interface.hpp"
#include "src/surf/trace_mgr.hpp"
src/kernel/lmm/maxmin.hpp
src/kernel/lmm/maxmin.cpp
+ src/kernel/model/Resource.hpp
+ src/kernel/model/Resource.cpp
+
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/ClusterZone.hpp
src/kernel/routing/DijkstraZone.cpp