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
SIMIX must be initialized now to use parmaps.
[simgrid.git]
/
src
/
surf
/
surf_routing_cluster.c
diff --git
a/src/surf/surf_routing_cluster.c
b/src/surf/surf_routing_cluster.c
index
3ba6ccc
..
fbd7b42
100644
(file)
--- a/
src/surf/surf_routing_cluster.c
+++ b/
src/surf/surf_routing_cluster.c
@@
-23,13
+23,27
@@
static void cluster_get_route_and_latency(AS_t as,
{
s_surf_parsing_link_up_down_t info;
- XBT_
DEBUG
("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
+ XBT_
VERB
("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
src->name, src->id, dst->name, dst->id);
if (src->rc_type != SURF_NETWORK_ELEMENT_ROUTER) { // No specific link for router
info =
xbt_dynar_get_as(as->link_up_down_list, src->id,
s_surf_parsing_link_up_down_t);
+
+ if((src->id == dst->id) && info.loopback_link ){
+ xbt_dynar_push_as(route->link_list, void *, info.loopback_link);
+ if (lat)
+ *lat +=
+ surf_network_model->extension.network.get_link_latency(info.
+ loopback_link);
+ return;
+ }
+
+
+ if (info.limiter_link) // limiter for sender
+ xbt_dynar_push_as(route->link_list, void *, info.limiter_link);
+
if (info.link_up) { // link up
xbt_dynar_push_as(route->link_list, void *, info.link_up);
if (lat)
@@
-58,6
+72,10
@@
static void cluster_get_route_and_latency(AS_t as,
surf_network_model->extension.network.get_link_latency(info.
link_down);
}
+
+ if (info.limiter_link) // limiter for receiver
+ xbt_dynar_push_as(route->link_list, void *, info.limiter_link);
+
}
}
@@
-68,159
+86,61
@@
static void cluster_get_graph(xbt_graph_t graph, xbt_dict_t nodes,
int table_size = xbt_dynar_length(rc->index_network_elm);
sg_routing_edge_t src;
- xbt_node_t current, previous, backboneNode
,
routerNode;
+ xbt_node_t current, previous, backboneNode
= NULL,
routerNode;
s_surf_parsing_link_up_down_t info;
xbt_assert(((as_cluster_t) rc)->router,"Malformed cluster");
/* create the router */
char *link_name =
-
((sg_routing_edge_t) ((as_cluster_t) rc)->router)->name;
+ ((sg_routing_edge_t) ((as_cluster_t) rc)->router)->name;
routerNode = new_xbt_graph_node(graph, link_name, nodes);
if(((as_cluster_t) rc)->backbone) {
-
char *link_nameR =
-
((surf_resource_t) ((as_cluster_t) rc)->backbone)->name;
-
backboneNode = new_xbt_graph_node(graph, link_nameR, nodes);
+ char *link_nameR =
+ ((surf_resource_t) ((as_cluster_t) rc)->backbone)->name;
+ backboneNode = new_xbt_graph_node(graph, link_nameR, nodes);
-
new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
+ new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
}
for (isrc = 0; isrc < table_size; isrc++) {
- src = xbt_dynar_get_as(rc->index_network_elm, isrc, sg_routing_edge_t);
-
- if (src->rc_type != SURF_NETWORK_ELEMENT_ROUTER) {
- previous = new_xbt_graph_node(graph, src->name, nodes);
-
- info = xbt_dynar_get_as(rc->link_up_down_list, src->id,
- s_surf_parsing_link_up_down_t);
-
- if (info.link_up) { // link up
-
- char *link_name = ((surf_resource_t) info.link_up)->name;
- current = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, previous, current, edges);
-
- if (((as_cluster_t) rc)->backbone) {
- new_xbt_graph_edge(graph, current, backboneNode, edges);
- } else {
- new_xbt_graph_edge(graph, current, routerNode, edges);
- }
-
- }
+ src = xbt_dynar_get_as(rc->index_network_elm, isrc, sg_routing_edge_t);
- if (info.link_down) { // link down
- char *link_name = ((surf_resource_t) info.link_down)->name;
- current = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, previous, current, edges);
+ if (src->rc_type != SURF_NETWORK_ELEMENT_ROUTER) {
+ previous = new_xbt_graph_node(graph, src->name, nodes);
- if (((as_cluster_t) rc)->backbone) {
- new_xbt_graph_edge(graph, current, backboneNode, edges);
- } else {
- new_xbt_graph_edge(graph, current, routerNode, edges);
- }
+ info = xbt_dynar_get_as(rc->link_up_down_list, src->id,
+ s_surf_parsing_link_up_down_t);
- }
- }
- }
+ if (info.link_up) { // link up
-/*
- if (((as_cluster_t) rc)->backbone) {
- char *link_name =
- ((surf_resource_t) ((as_cluster_t) rc)->backbone)->name;
-
- current = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, previous, current, edges);
- previous = current;
-
- revCurrent = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, revCurrent, revPrevious, edges);
- revPrevious = revCurrent;
- } else {
- info = xbt_dynar_get_as(rc->link_up_down_list, dst->id,
- s_surf_parsing_link_up_down_t);
-
- if (info.link_up) { // link up
- char *link_name = ((surf_resource_t) info.link_up)->name;
- current = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, previous, current, edges);
- previous = current;
- } else if (info.link_down) { // link down
- char *link_name = ((surf_resource_t) info.link_down)->name;
- revCurrent = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, revCurrent, revPrevious, edges);
- revPrevious = revCurrent;
- }
- }
-
- }
- }*/
-/*
- if(rc->)
- for (isrc = 0; isrc < table_size; isrc++) {
- src = xbt_dynar_get_as(rc->index_network_elm, isrc, sg_routing_edge_t);
+ char *link_name = ((surf_resource_t) info.link_up)->name;
+ current = new_xbt_graph_node(graph, link_name, nodes);
+ new_xbt_graph_edge(graph, previous, current, edges);
- previous = new_xbt_graph_node(graph, src->name, nodes);
- revPrevious = new_xbt_graph_node(graph, src->name, nodes);
-
- for (idst = isrc + 1; idst < table_size; idst++) {
- dst = xbt_dynar_get_as(rc->index_network_elm, idst, sg_routing_edge_t);
-
- s_surf_parsing_link_up_down_t info;
-
- if (src->rc_type != SURF_NETWORK_ELEMENT_ROUTER) { // No specific link for router
- info =
- xbt_dynar_get_as(rc->link_up_down_list, src->id,
- s_surf_parsing_link_up_down_t);
-
- if (info.link_up) { // link up
- char *link_name = ((surf_resource_t) info.link_up)->name;
- current = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, previous, current, edges);
- previous = current;
- } else if (info.link_down) { // link down
- char *link_name = ((surf_resource_t) info.link_down)->name;
- revCurrent = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, revCurrent, revPrevious, edges);
- revPrevious = revCurrent;
+ if (((as_cluster_t) rc)->backbone) {
+ new_xbt_graph_edge(graph, current, backboneNode, edges);
+ } else {
+ new_xbt_graph_edge(graph, current, routerNode, edges);
}
- }
-
-
- if (((as_cluster_t) rc)->backbone) {
- char *link_name =
- ((surf_resource_t) ((as_cluster_t) rc)->backbone)->name;
+ }
+ if (info.link_down) { // link down
+ char *link_name = ((surf_resource_t) info.link_down)->name;
current = new_xbt_graph_node(graph, link_name, nodes);
new_xbt_graph_edge(graph, previous, current, edges);
- previous = current;
-
- revCurrent = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, revCurrent, revPrevious, edges);
- revPrevious = revCurrent;
- }
- if (dst->rc_type != SURF_NETWORK_ELEMENT_ROUTER) { // No specific link for router
- info =
- xbt_dynar_get_as(rc->link_up_down_list, dst->id,
- s_surf_parsing_link_up_down_t);
-
- if (info.link_up) { // link up
- char *link_name = ((surf_resource_t) info.link_up)->name;
- current = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, previous, current, edges);
- previous = current;
- } else if (info.link_down) { // link down
- char *link_name = ((surf_resource_t) info.link_down)->name;
- revCurrent = new_xbt_graph_node(graph, link_name, nodes);
- new_xbt_graph_edge(graph, revCurrent, revPrevious, edges);
- revPrevious = revCurrent;
+ if (((as_cluster_t) rc)->backbone) {
+ new_xbt_graph_edge(graph, current, backboneNode, edges);
+ } else {
+ new_xbt_graph_edge(graph, current, routerNode, edges);
}
}
-
}
- }*/
+
+ }
}
static void model_cluster_finalize(AS_t as)