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
Replace a function by its contents
[simgrid.git]
/
src
/
surf
/
surf_interface.hpp
diff --git
a/src/surf/surf_interface.hpp
b/src/surf/surf_interface.hpp
index
3fda8ac
..
b9e8b2c
100644
(file)
--- a/
src/surf/surf_interface.hpp
+++ b/
src/surf/surf_interface.hpp
@@
-6,21
+6,14
@@
#ifndef SURF_MODEL_H_
#define SURF_MODEL_H_
#ifndef SURF_MODEL_H_
#define SURF_MODEL_H_
-#include
<cstddef>
+#include
"xbt/signal.hpp"
-#include
<xbt.h>
-#include
<memory>
-#include
<utility>
+#include
"src/surf/surf_private.h"
+#include
"surf/surf.h"
+#include
"xbt/str.h"
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/list.hpp>
-
-#include <xbt/signal.hpp>
-
-#include "xbt/lib.h"
-#include "surf/surf_routing.h"
-#include "surf/surf.h"
-#include "src/surf/surf_private.h"
-#include "src/internal_config.h"
+#include <string>
#define NO_MAX_DURATION -1.0
#define NO_MAX_DURATION -1.0
@@
-35,10
+28,10
@@
extern XBT_PRIVATE double sg_latency_factor;
extern XBT_PRIVATE double sg_bandwidth_factor;
extern XBT_PRIVATE double sg_weight_S_parameter;
extern XBT_PRIVATE int sg_network_crosstraffic;
extern XBT_PRIVATE double sg_bandwidth_factor;
extern XBT_PRIVATE double sg_weight_S_parameter;
extern XBT_PRIVATE int sg_network_crosstraffic;
-extern XBT_PRIVATE
xbt_dynar_t
surf_path;
+extern XBT_PRIVATE
std::vector<std::string>
surf_path;
extern "C" {
extern "C" {
-XBT_PUBLIC(double) surf_get_clock(
void
);
+XBT_PUBLIC(double) surf_get_clock();
}
/** \ingroup SURF_simulation
* \brief List of hosts that have just restarted and whose autorestart process should be restarted.
}
/** \ingroup SURF_simulation
* \brief List of hosts that have just restarted and whose autorestart process should be restarted.
@@
-51,17
+44,12
@@
extern XBT_PRIVATE double sg_sender_gap;
namespace simgrid {
namespace surf {
namespace simgrid {
namespace surf {
-extern XBT_PRIVATE simgrid::xbt::signal<void(void)> surfExitCallbacks;
-
+extern XBT_PRIVATE simgrid::xbt::signal<void()> surfExitCallbacks;
}
}
int XBT_PRIVATE __surf_is_absolute_file_path(const char *file_path);
}
}
int XBT_PRIVATE __surf_is_absolute_file_path(const char *file_path);
-static inline char* sg_storage_name(sg_storage_t storage) {
- return storage->key;
-}
-
/***********
* Classes *
***********/
/***********
* Classes *
***********/
@@
-114,14
+102,6
@@
public:
not_in_the_system /**< Not in the system anymore. Why did you ask ? */
};
not_in_the_system /**< Not in the system anymore. Why did you ask ? */
};
-private:
- /**
- * @brief Common initializations for the constructors
- */
- void initialize(simgrid::surf::Model *model, double cost, bool failed,
- lmm_variable_t var = nullptr);
-
-public:
/**
* @brief Action constructor
*
/**
* @brief Action constructor
*
@@
-220,20
+200,20
@@
public:
void setCategory(const char *category);
/** @brief Get the priority of the current Action */
void setCategory(const char *category);
/** @brief Get the priority of the current Action */
- double getPriority() {
return priority_;
};
+ double getPriority() {
return sharingWeight_;
};
/** @brief Set the priority of the current Action */
/** @brief Set the priority of the current Action */
- virtual void set
Priority
(double priority);
+ virtual void set
SharingWeight
(double priority);
/** @brief Get the state set in which the action is */
ActionList* getStateSet() {return stateSet_;};
s_xbt_swag_hookup_t stateHookup_ = {nullptr,nullptr};
/** @brief Get the state set in which the action is */
ActionList* getStateSet() {return stateSet_;};
s_xbt_swag_hookup_t stateHookup_ = {nullptr,nullptr};
- simgrid::surf::Model
*getModel() {return model_;
}
+ simgrid::surf::Model
* getModel() { return model_;
}
protected:
ActionList* stateSet_;
protected:
ActionList* stateSet_;
- double
priority
_ = 1.0; /**< priority (1.0 by default) */
+ double
sharingWeight
_ = 1.0; /**< priority (1.0 by default) */
int refcount_ = 1;
double remains_; /**< How much of that cost remains to be done in the currently running task */
double maxDuration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
int refcount_ = 1;
double remains_; /**< How much of that cost remains to be done in the currently running task */
double maxDuration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
@@
-277,13
+257,6
@@
typedef boost::intrusive::member_hook<
typedef boost::intrusive::list<Action, ActionLmmOptions> ActionLmmList;
typedef ActionLmmList* ActionLmmListPtr;
typedef boost::intrusive::list<Action, ActionLmmOptions> ActionLmmList;
typedef ActionLmmList* ActionLmmListPtr;
-/********************
- * Helper functions *
- ********************/
-
-double shareResourcesMaxMin(ActionList* runningActions, lmm_system_t sys);
-
-
/*********
* Model *
*********/
/*********
* Model *
*********/
@@
-330,9
+303,9
@@
public:
* @param now The current time of the simulation
* @return The delta of time till the next action will finish
*/
* @param now The current time of the simulation
* @return The delta of time till the next action will finish
*/
- virtual double next
_occuring_e
vent(double now);
- virtual double next
_occuring_event_l
azy(double now);
- virtual double next
_occuring_event_f
ull(double now);
+ virtual double next
OccuringE
vent(double now);
+ virtual double next
OccuringEventL
azy(double now);
+ virtual double next
OccuringEventF
ull(double now);
/**
* @brief Update action to the current time
/**
* @brief Update action to the current time
@@
-349,13
+322,13
@@
public:
* The only model that is not is NS3: computing the next timestamp moves the model up to that point,
* so we need to call it only when the next timestamp of other sources is computed.
*/
* The only model that is not is NS3: computing the next timestamp moves the model up to that point,
* so we need to call it only when the next timestamp of other sources is computed.
*/
- virtual bool next
_occuring_event_isIdempotent()=0;
+ virtual bool next
OccuringEventIsIdempotent() { return true;}
protected:
ActionLmmListPtr modifiedSet_;
lmm_system_t maxminSystem_ = nullptr;
e_UM_t updateMechanism_ = UM_UNDEFINED;
protected:
ActionLmmListPtr modifiedSet_;
lmm_system_t maxminSystem_ = nullptr;
e_UM_t updateMechanism_ = UM_UNDEFINED;
-
int
selectiveUpdate_;
+
bool
selectiveUpdate_;
xbt_heap_t actionHeap_;
private:
xbt_heap_t actionHeap_;
private:
@@
-378,7
+351,7
@@
private:
typedef struct {
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] */
typedef struct {
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] */
- tmgr_trace_
iterator
_t event; /**< The associated trace event associated to the metric */
+ tmgr_trace_
event
_t event; /**< The associated trace event associated to the metric */
} s_surf_metric_t;
namespace simgrid {
} s_surf_metric_t;
namespace simgrid {
@@
-390,14
+363,6
@@
namespace surf {
*/
XBT_PUBLIC_CLASS Resource {
public:
*/
XBT_PUBLIC_CLASS Resource {
public:
- /**
- * @brief Constructor of non-LMM Resources
- *
- * @param model Model associated to this Resource
- * @param name The name of the Resource
- */
- Resource(Model *model, const char *name);
-
/**
* @brief Constructor of LMM Resources
*
/**
* @brief Constructor of LMM Resources
*
@@
-410,10
+375,10
@@
public:
virtual ~Resource();
/** @brief Get the Model of the current Resource */
virtual ~Resource();
/** @brief Get the Model of the current Resource */
- Model
*getM
odel() const;
+ Model
* m
odel() const;
/** @brief Get the name of the current Resource */
/** @brief Get the name of the current Resource */
- const char
*getN
ame() const;
+ const char
* cn
ame() const;
bool operator==(const Resource &other) const;
bool operator==(const Resource &other) const;
@@
-423,7
+388,7
@@
public:
* @param event What happened
* @param value [TODO]
*/
* @param event What happened
* @param value [TODO]
*/
- virtual void apply_event(tmgr_trace_
iterator_t event, double value)=
0;
+ 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 Check if the current Resource is used (if it currently serves an action) */
virtual bool isUsed()=0;
@@
-438,15
+403,16
@@
public:
virtual void turnOff();
private:
virtual void turnOff();
private:
-
const char *
name_;
+
std::string
name_;
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) */
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) */
- lmm_constraint_t getConstraint() const;
+ lmm_constraint_t constraint() const;
+
protected:
protected:
- lmm_constraint_t constraint_ = nullptr;
+
const
lmm_constraint_t constraint_ = nullptr;
};
}
};
}
@@
-458,7
+424,7
@@
namespace std {
{
std::size_t operator()(const simgrid::surf::Resource& r) const
{
{
std::size_t operator()(const simgrid::surf::Resource& r) const
{
- return (std::size_t) xbt_str_hash(r.
getN
ame());
+ return (std::size_t) xbt_str_hash(r.
cn
ame());
}
};
}
}
};
}