#include <boost/intrusive_ptr.hpp>
namespace simgrid {
+namespace config {
+template <class T> class Flag;
+}
namespace kernel {
class EngineImpl;
namespace context {
simgrid::config::bindFlag(value_, name, desc);
}
+ /** Constructor taking an array of aliases as name */
+ Flag(std::initializer_list<const char*> names, const char* desc, T value) : value_(value)
+ {
+ simgrid::config::bindFlag(value_, names, desc);
+ }
+
/* A constructor accepting a callback that will be passed the parameter.
* It can either return a boolean (informing whether the parameter is valid), or returning void.
*/
describe_model(description, descsize, surf_host_model_description, "model", "The model to use for the host");
xbt_cfg_register_string("host/model", "default", &_sg_cfg_cb__host_model, description);
- sg_tcp_gamma = 4194304.0;
- simgrid::config::bindFlag(sg_tcp_gamma, {"network/TCP-gamma", "network/TCP_gamma"},
- "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; "
- "Use the last given value, which is the max window size)");
-
simgrid::config::bindFlag(sg_surf_precision, "surf/precision",
"Numerical precision used when updating simulation times (in seconds)");
double sg_bandwidth_factor = 1.0; /* default value; can be set by model or from command line */
double sg_weight_S_parameter = 0.0; /* default value; can be set by model or from command line */
-double sg_tcp_gamma = 0.0;
int sg_network_crosstraffic = 0;
/************************************************************************/
if (action->rate_ < 0) {
get_maxmin_system()->update_variable_bound(
- action->get_variable(), (action->lat_current_ > 0) ? sg_tcp_gamma / (2.0 * action->lat_current_) : -1.0);
+ action->get_variable(), (action->lat_current_ > 0) ? cfg_tcp_gamma / (2.0 * action->lat_current_) : -1.0);
} else {
get_maxmin_system()->update_variable_bound(
action->get_variable(), (action->lat_current_ > 0)
- ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->lat_current_))
+ ? std::min(action->rate_, cfg_tcp_gamma / (2.0 * action->lat_current_))
: action->rate_);
}
action->lat_current_ += delta;
action->weight_ += delta;
if (action->rate_ < 0)
- get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
- sg_tcp_gamma / (2.0 * action->lat_current_));
+ get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), NetworkModel::cfg_tcp_gamma /
+ (2.0 * action->lat_current_));
else {
get_model()->get_maxmin_system()->update_variable_bound(
- action->get_variable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->lat_current_)));
+ action->get_variable(), std::min(action->rate_, NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)));
- if (action->rate_ < sg_tcp_gamma / (2.0 * action->lat_current_)) {
+ if (action->rate_ < NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)) {
XBT_INFO("Flow is limited BYBANDWIDTH");
} else {
XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->lat_current_);
namespace simgrid {
namespace surf {
+ /** Value of the command-line option 'network/TCP-gamma' -- see \ref options_model_network_gamma */
+ simgrid::config::Flag<double> NetworkModel::cfg_tcp_gamma(
+ {"network/TCP-gamma", "network/TCP_gamma"},
+ "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; "
+ "Use the last given value, which is the max window size)",
+ 4194304.0);
+
NetworkModel::~NetworkModel() = default;
double NetworkModel::latencyFactor(double /*size*/) {
*/
class NetworkModel : public kernel::resource::Model {
public:
- /** @brief Constructor */
- explicit NetworkModel(kernel::resource::Model::UpdateAlgo algo) : Model(algo) {}
+ static simgrid::config::Flag<double> cfg_tcp_gamma;
- /** @brief Destructor */
+ explicit NetworkModel(kernel::resource::Model::UpdateAlgo algo) : Model(algo) {}
~NetworkModel() override;
/**
#include "ptask_L07.hpp"
#include "cpu_interface.hpp"
+#include "xbt/config.hpp"
#include "xbt/utility.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
}
}
}
- double lat_bound = sg_tcp_gamma / (2.0 * lat_current);
+ double lat_bound = NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
if ((latency_ <= 0.0) && (suspended_ == Action::SuspendStates::not_suspended)) {
if (rate_ < 0)
XBT_PUBLIC_DATA double sg_surf_precision;
XBT_PUBLIC_DATA int sg_concurrency_limit;
-extern XBT_PRIVATE double sg_tcp_gamma;
extern XBT_PRIVATE double sg_latency_factor;
extern XBT_PRIVATE double sg_bandwidth_factor;
extern XBT_PRIVATE double sg_weight_S_parameter;