X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4f23353a43b551cca580fbf043df1c38f5fb18d4..a59892e02855ae21ccf6abd4925d962f81b384b2:/src/surf/ptask_L07.cpp diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index d7cf81c4dd..408873cd3f 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -45,15 +45,11 @@ namespace simgrid { namespace surf { HostL07Model::HostL07Model() : HostModel() { - p_maxminSystem = lmm_system_new(1); - surf_network_model = new NetworkL07Model(this,p_maxminSystem); - surf_cpu_model_pm = new CpuL07Model(this,p_maxminSystem); - - routing_model_create(surf_network_model->createLink("__loopback__", - 498000000, NULL, - 0.000015, NULL, - NULL, - SURF_LINK_FATPIPE, NULL)); + maxminSystem_ = lmm_system_new(1); + surf_network_model = new NetworkL07Model(this,maxminSystem_); + surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_); + + routing_model_create(surf_network_model->createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, NULL)); } HostL07Model::~HostL07Model() { @@ -65,23 +61,23 @@ CpuL07Model::CpuL07Model(HostL07Model *hmodel,lmm_system_t sys) : CpuModel() , p_hostModel(hmodel) { - p_maxminSystem = sys; + maxminSystem_ = sys; } CpuL07Model::~CpuL07Model() { surf_cpu_model_pm = NULL; - lmm_system_free(p_maxminSystem); - p_maxminSystem = NULL; + lmm_system_free(maxminSystem_); + maxminSystem_ = NULL; } NetworkL07Model::NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys) : NetworkModel() , p_hostModel(hmodel) { - p_maxminSystem = sys; + maxminSystem_ = sys; } NetworkL07Model::~NetworkL07Model() { surf_network_model = NULL; - p_maxminSystem = NULL; // Avoid multi-free + maxminSystem_ = NULL; // Avoid multi-free } @@ -91,7 +87,7 @@ double HostL07Model::next_occuring_event(double /*now*/) ActionList *running_actions = getRunningActionSet(); double min = this->shareResourcesMaxMin(running_actions, - p_maxminSystem, + maxminSystem_, bottleneck_solve); for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end()) @@ -133,7 +129,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) { } if ((action->m_latency == 0.0) && (action->isSuspended() == 0)) { action->updateBound(); - lmm_update_variable_weight(p_maxminSystem, action->getVariable(), 1.0); + lmm_update_variable_weight(maxminSystem_, action->getVariable(), 1.0); } } XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", @@ -164,7 +160,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) { lmm_constraint_t cnst = NULL; int i = 0; - while ((cnst = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i++))) { + while ((cnst = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i++))) { void *constraint_id = lmm_constraint_id(cnst); if (static_cast(constraint_id)->isOff()) { @@ -293,23 +289,13 @@ Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t powerPeakList return cpu; } -Link* NetworkL07Model::createLink(const char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t policy, - xbt_dict_t properties) +Link* NetworkL07Model::createLink(const char *name, double bandwidth, double latency, + e_surf_link_sharing_policy_t policy, xbt_dict_t properties) { xbt_assert(!Link::byName(name), - "Link '%s' declared several times in the platform file.", name); + "Link '%s' declared several times in the platform.", name); - Link* link = new LinkL07(this, name, properties, - bw_initial, bw_trace, - lat_initial, lat_trace, - state_trace, - policy); + Link* link = new LinkL07(this, name, properties, bandwidth, latency, policy); Link::onCreation(link); return link; } @@ -337,20 +323,12 @@ CpuL07::~CpuL07() { } -LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props, - double bw_initial, tmgr_trace_t bw_trace, - double lat_initial, tmgr_trace_t lat_trace, - tmgr_trace_t state_trace, +LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props, double bandwidth, double latency, e_surf_link_sharing_policy_t policy) - : Link(model, name, props, lmm_constraint_new(model->getMaxminSystem(), this, bw_initial), state_trace) + : Link(model, name, props, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth)) { - m_bandwidth.peak = bw_initial; - if (bw_trace) - m_bandwidth.event = future_evt_set->add_trace(bw_trace, 0.0, this); - - m_latency.peak = lat_initial; - if (lat_trace) - m_latency.event = future_evt_set->add_trace(lat_trace, 0.0, this); + m_bandwidth.peak = bandwidth; + m_latency.peak = latency; if (policy == SURF_LINK_FATPIPE) lmm_constraint_shared(getConstraint());