[ofa-general] [PATCH] opensm/osm_mesh.c: Add dump_mesh routine at OSM_LOG_DEBUG log level
Hal Rosenstock
hnrose at comcast.net
Tue Sep 22 11:38:58 PDT 2009
Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
diff --git a/opensm/opensm/osm_mesh.c b/opensm/opensm/osm_mesh.c
index 260e2f8..beb6bd7 100644
--- a/opensm/opensm/osm_mesh.c
+++ b/opensm/opensm/osm_mesh.c
@@ -1565,6 +1565,39 @@ err:
return -1;
}
+static void dump_mesh(lash_t *p_lash)
+{
+ osm_log_t *p_log = &p_lash->p_osm->log;
+ int sw;
+ int num_switches = p_lash->num_switches;
+ int dimension;
+ int i, j, k;
+ switch_t *s, *s2;
+ char buf[256], *p;
+
+ OSM_LOG_ENTER(p_log);
+
+ for (sw = 0; sw < num_switches; sw++) {
+ p = buf;
+ s = p_lash->switches[sw];
+ dimension = s->node->dimension;
+ p += sprintf(p, "[");
+ for (i = 0; i < dimension; i++)
+ p += sprintf(p, "%2d%s", s->node->coord[i],
+ (i == dimension - 1) ? "]" : ",");
+ for (j = 0; j < s->node->num_links; j++) {
+ s2 = p_lash->switches[s->node->links[j]->switch_id];
+ p += sprintf(p, " [%d]->[", j);
+ for (k = 0; k < dimension; k++)
+ p += sprintf(p, "%2d%s", s2->node->coord[k],
+ (k == dimension - 1) ? "] " : ",");
+ }
+ OSM_LOG(p_log, OSM_LOG_DEBUG, "%s\n", buf);
+ }
+
+ OSM_LOG_EXIT(p_log);
+}
+
/*
* osm_do_mesh_analysis
*/
@@ -1653,6 +1686,9 @@ int osm_do_mesh_analysis(lash_t *p_lash)
OSM_LOG(p_log, OSM_LOG_INFO, "%s", buf);
}
+ if (osm_log_is_active(p_log, OSM_LOG_DEBUG))
+ dump_mesh(p_lash);
+
done:
mesh_delete(mesh);
OSM_LOG_EXIT(p_log);
More information about the general
mailing list