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
Changes to the Surf LMM:
[simgrid.git]
/
src
/
surf
/
network_cm02.cpp
diff --git
a/src/surf/network_cm02.cpp
b/src/surf/network_cm02.cpp
index
5163c8c
..
e8171bf
100644
(file)
--- a/
src/surf/network_cm02.cpp
+++ b/
src/surf/network_cm02.cpp
@@
-29,7
+29,9
@@
void net_define_callbacks(void)
{
/* Figuring out the network links */
simgrid::surf::on_link.connect(netlink_parse_init);
{
/* Figuring out the network links */
simgrid::surf::on_link.connect(netlink_parse_init);
- simgrid::surf::on_postparse.connect(net_add_traces);
+ simgrid::surf::on_postparse.connect([]() {
+ surf_network_model->addTraces();
+ });
}
/*********
}
/*********
@@
-207,7
+209,7
@@
Link* NetworkCm02Model::createLink(const char *name,
"Link '%s' declared several times in the platform",
name);
"Link '%s' declared several times in the platform",
name);
- Link* link = new NetworkCm02Link(this, name, properties, p_maxminSystem, sg_bandwidth_factor * bw_initial,
history
,
+ Link* link = new NetworkCm02Link(this, name, properties, p_maxminSystem, sg_bandwidth_factor * bw_initial,
future_evt_set
,
initiallyOn, state_trace, bw_initial, bw_trace, lat_initial, lat_trace, policy);
Link::onCreation(link);
return link;
initiallyOn, state_trace, bw_initial, bw_trace, lat_initial, lat_trace, policy);
Link::onCreation(link);
return link;
@@
-372,6
+374,7
@@
Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst,
break;
}
}
break;
}
}
+ lmm_variable_concurrency_share_set(action->getVariable(),2);
}
action = new NetworkCm02Action(this, size, failed);
}
action = new NetworkCm02Action(this, size, failed);
@@
-477,7
+480,7
@@
void NetworkCm02Model::addTraces(){
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
- link->p_stateEvent =
tmgr_history_add_trace(history, trace, 0.0,
0, link);
+ link->p_stateEvent =
future_evt_set->add_trace(trace, 0.
0, link);
}
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
}
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
@@
-490,7
+493,7
@@
void NetworkCm02Model::addTraces(){
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
- link->p_speed.event =
tmgr_history_add_trace(history, trace, 0.0,
0, link);
+ link->p_speed.event =
future_evt_set->add_trace(trace, 0.
0, link);
}
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
}
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
@@
-503,7
+506,7
@@
void NetworkCm02Model::addTraces(){
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
- link->p_latEvent =
tmgr_history_add_trace(history, trace, 0.0,
0, link);
+ link->p_latEvent =
future_evt_set->add_trace(trace, 0.
0, link);
}
}
}
}
@@
-513,7
+516,7
@@
void NetworkCm02Model::addTraces(){
NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
lmm_system_t system,
double constraint_value,
NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
lmm_system_t system,
double constraint_value,
-
tmgr_history_t history
,
+
sg_future_evt_set_t fes
,
int initiallyOn,
tmgr_trace_t state_trace,
double metric_peak,
int initiallyOn,
tmgr_trace_t state_trace,
double metric_peak,
@@
-521,7
+524,7
@@
NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_
double lat_initial,
tmgr_trace_t lat_trace,
e_surf_link_sharing_policy_t policy)
double lat_initial,
tmgr_trace_t lat_trace,
e_surf_link_sharing_policy_t policy)
-: Link(model, name, props, lmm_constraint_new(system, this, constraint_value),
history
, state_trace)
+: Link(model, name, props, lmm_constraint_new(system, this, constraint_value),
fes
, state_trace)
{
if (initiallyOn)
turnOn();
{
if (initiallyOn)
turnOn();
@@
-531,13
+534,13
@@
NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_
p_speed.scale = 1.0;
p_speed.peak = metric_peak;
if (metric_trace)
p_speed.scale = 1.0;
p_speed.peak = metric_peak;
if (metric_trace)
- p_speed.event =
tmgr_history_add_trace(history, metric_trace, 0.0,
0, this);
+ p_speed.event =
fes->add_trace(metric_trace, 0.
0, this);
else
p_speed.event = NULL;
m_latCurrent = lat_initial;
if (lat_trace)
else
p_speed.event = NULL;
m_latCurrent = lat_initial;
if (lat_trace)
- p_latEvent =
tmgr_history_add_trace(history, lat_trace, 0.0,
0, this);
+ p_latEvent =
fes->add_trace(lat_trace, 0.
0, this);
if (policy == SURF_LINK_FATPIPE)
lmm_constraint_shared(getConstraint());
if (policy == SURF_LINK_FATPIPE)
lmm_constraint_shared(getConstraint());
@@
-545,31
+548,26
@@
NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_
-void NetworkCm02Link::updateState(tmgr_trace_
event_t event_type
,
+void NetworkCm02Link::updateState(tmgr_trace_
iterator_t triggered
,
double value, double date)
{
double value, double date)
{
- /* printf("[" "%g" "] Asking to update network card \"%s\" with value " */
- /* "%g" " for event %p\n", surf_get_clock(), nw_link->name, */
- /* value, event_type); */
- if (event_type == p_speed.event) {
+ /* Find out which of my iterators was triggered, and react accordingly */
+ if (triggered == p_speed.event) {
updateBandwidth(value, date);
updateBandwidth(value, date);
- if (tmgr_trace_event_free(event_type))
- p_speed.event = NULL;
- } else if (event_type == p_latEvent) {
+ tmgr_trace_event_unref(&p_speed.event);
+ } else if (triggered == p_latEvent) {
updateLatency(value, date);
updateLatency(value, date);
- if (tmgr_trace_event_free(event_type))
- p_latEvent = NULL;
- } else if (event_type == p_stateEvent) {
+ tmgr_trace_event_unref(&p_latEvent);
+ } else if (triggered == p_stateEvent) {
if (value > 0)
turnOn();
else {
if (value > 0)
turnOn();
else {
- lmm_constraint_t cnst = getConstraint();
lmm_variable_t var = NULL;
lmm_element_t elem = NULL;
turnOff();
lmm_variable_t var = NULL;
lmm_element_t elem = NULL;
turnOff();
- while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(),
cnst
, &elem))) {
+ while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(),
getConstraint()
, &elem))) {
Action *action = static_cast<Action*>( lmm_variable_id(var) );
if (action->getState() == SURF_ACTION_RUNNING ||
Action *action = static_cast<Action*>( lmm_variable_id(var) );
if (action->getState() == SURF_ACTION_RUNNING ||
@@
-579,17
+577,14
@@
void NetworkCm02Link::updateState(tmgr_trace_event_t event_type,
}
}
}
}
}
}
- if (tmgr_trace_event_free(event_type))
- p_stateEvent = NULL;
+ tmgr_trace_event_unref(&p_stateEvent);
} else {
} else {
- XBT_CRITICAL("Unknown event ! \n");
- xbt_abort();
+ xbt_die("Unknown event!\n");
}
XBT_DEBUG
}
XBT_DEBUG
- ("There w
ere
a resource state event, need to update actions related to the constraint (%p)",
+ ("There w
as
a resource state event, need to update actions related to the constraint (%p)",
getConstraint());
getConstraint());
- return;
}
void NetworkCm02Link::updateBandwidth(double value, double date){
}
void NetworkCm02Link::updateBandwidth(double value, double date){