#include "xbt/graph.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
static int platform_created = 0; /* indicate whether the platform file has been traced */
#include "xbt/graph.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
static int platform_created = 0; /* indicate whether the platform file has been traced */
int i = xbt_dynar_length (ancestors_a1) - 1;
int j = xbt_dynar_length (ancestors_a2) - 1;
while (i >= 0 && j >= 0){
int i = xbt_dynar_length (ancestors_a1) - 1;
int j = xbt_dynar_length (ancestors_a2) - 1;
while (i >= 0 && j >= 0){
//check if we already register this pair (we only need one direction)
char aux1[INSTR_DEFAULT_STR_SIZE], aux2[INSTR_DEFAULT_STR_SIZE];
snprintf (aux1, INSTR_DEFAULT_STR_SIZE, "%s%s", src->name, dst->name);
//check if we already register this pair (we only need one direction)
char aux1[INSTR_DEFAULT_STR_SIZE], aux2[INSTR_DEFAULT_STR_SIZE];
snprintf (aux1, INSTR_DEFAULT_STR_SIZE, "%s%s", src->name, dst->name);
- xbt_dict_set (filter, aux1, xbt_strdup ("1"), NULL);
- xbt_dict_set (filter, aux2, xbt_strdup ("1"), NULL);
+ xbt_dict_set (filter, aux1, xbt_strdup ("1"), nullptr);
+ xbt_dict_set (filter, aux2, xbt_strdup ("1"), nullptr);
src->type->name, src->type->id,
dst->type->name, dst->type->id);
type_t link_type = PJ_type_get_or_null (link_typename, father->type);
src->type->name, src->type->id,
dst->type->name, dst->type->id);
type_t link_type = PJ_type_get_or_null (link_typename, father->type);
link_type = PJ_type_link_new (link_typename, father->type, src->type, dst->type);
}
//register EDGE types for triva configuration
link_type = PJ_type_link_new (link_typename, father->type, src->type, dst->type);
}
//register EDGE types for triva configuration
- xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), NULL);
+ xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), nullptr);
- XBT_DEBUG ("Graph extraction for routing_component = %s", surf_AS_get_name(rc));
- if (!xbt_dict_is_empty(surf_AS_get_routing_sons(rc))){
- xbt_dict_cursor_t cursor = NULL;
+ XBT_DEBUG ("Graph extraction for routing_component = %s", as->name());
+ if (!xbt_dict_is_empty(as->children())){
+ xbt_dict_cursor_t cursor = nullptr;
- xbt_dict_foreach(surf_AS_get_routing_sons(rc), cursor, child_name, rc_son) {
- container_t child_container = (container_t) xbt_dict_get (
- container->children, surf_AS_get_name(rc_son));
+ xbt_dict_foreach(as->children(), cursor, child_name, rc_son) {
+ container_t child_container = (container_t) xbt_dict_get (container->children, rc_son->name());
- xbt_graph_t graph = xbt_graph_new_graph (0, NULL);
- xbt_dict_t nodes = xbt_dict_new_homogeneous(NULL);
- xbt_dict_t edges = xbt_dict_new_homogeneous(NULL);
- xbt_edge_t edge = NULL;
+ xbt_graph_t graph = xbt_graph_new_graph (0, nullptr);
+ xbt_dict_t nodes = xbt_dict_new_homogeneous(nullptr);
+ xbt_dict_t edges = xbt_dict_new_homogeneous(nullptr);
+ xbt_edge_t edge = nullptr;
- surf_AS_get_graph(rc, graph, nodes, edges);
+ static_cast<simgrid::routing::AsImpl*>(as)->getGraph(graph, nodes, edges);
xbt_dict_foreach(edges,cursor,edge_name,edge) {
linkContainers(
PJ_container_get((const char*) edge->src->data),
xbt_dict_foreach(edges,cursor,edge_name,edge) {
linkContainers(
PJ_container_get((const char*) edge->src->data),
- xbt_graph_free_graph(graph, xbt_free_f, xbt_free_f, NULL);
+ xbt_graph_free_graph(graph, xbt_free_f, xbt_free_f, nullptr);
PJ_container_set_root (root);
if (TRACE_smpi_is_enabled()) {
if (!TRACE_smpi_is_grouped()){
type_t mpi = PJ_type_get_or_null ("MPI", root->type);
PJ_container_set_root (root);
if (TRACE_smpi_is_enabled()) {
if (!TRACE_smpi_is_grouped()){
type_t mpi = PJ_type_get_or_null ("MPI", root->type);
mpi = PJ_type_container_new("MPI", root->type);
PJ_type_state_new ("MPI_STATE", mpi);
PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
mpi = PJ_type_container_new("MPI", root->type);
PJ_type_state_new ("MPI_STATE", mpi);
PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_link())) {
type_t bandwidth = PJ_type_get_or_null ("bandwidth", container->type);
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_link())) {
type_t bandwidth = PJ_type_get_or_null ("bandwidth", container->type);
- if (bandwidth == NULL){
- bandwidth = PJ_type_variable_new ("bandwidth", NULL, container->type);
+ if (bandwidth == nullptr){
+ bandwidth = PJ_type_variable_new ("bandwidth", nullptr, container->type);
- if (latency == NULL){
- latency = PJ_type_variable_new ("latency", NULL, container->type);
+ if (latency == nullptr){
+ latency = PJ_type_variable_new ("latency", nullptr, container->type);
}
new_pajeSetVariable (0, container, bandwidth, bandwidth_value);
new_pajeSetVariable (0, container, latency, latency_value);
}
if (TRACE_uncategorized()){
type_t bandwidth_used = PJ_type_get_or_null ("bandwidth_used", container->type);
}
new_pajeSetVariable (0, container, bandwidth, bandwidth_value);
new_pajeSetVariable (0, container, latency, latency_value);
}
if (TRACE_uncategorized()){
type_t bandwidth_used = PJ_type_get_or_null ("bandwidth_used", container->type);
{
container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
container_t container = PJ_container_new (host->id, INSTR_HOST, father);
{
container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
container_t container = PJ_container_new (host->id, INSTR_HOST, father);
- if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_power())) {
- type_t power = PJ_type_get_or_null ("power", container->type);
- if (power == NULL){
- power = PJ_type_variable_new ("power", NULL, container->type);
+ if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_speed())) {
+ type_t speed = PJ_type_get_or_null ("power", container->type);
+ if (speed == nullptr){
+ speed = PJ_type_variable_new ("power", nullptr, container->type);
- double current_power_state;
- xbt_dynar_get_cpy(host->power_peak, host->pstate, ¤t_power_state);
- new_pajeSetVariable (0, container, power, current_power_state);
+ double current_speed_state;
+ xbt_dynar_get_cpy(host->speed_per_pstate, host->pstate, ¤t_speed_state);
+ new_pajeSetVariable (0, container, speed, current_speed_state);
- type_t power_used = PJ_type_get_or_null ("power_used", container->type);
- if (power_used == NULL){
+ type_t speed_used = PJ_type_get_or_null ("power_used", container->type);
+ if (speed_used == nullptr){
PJ_type_variable_new ("power_used", "0.5 0.5 0.5", container->type);
}
}
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()){
type_t mpi = PJ_type_get_or_null ("MPI", container->type);
PJ_type_variable_new ("power_used", "0.5 0.5 0.5", container->type);
}
}
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()){
type_t mpi = PJ_type_get_or_null ("MPI", container->type);
mpi = PJ_type_container_new("MPI", container->type);
PJ_type_state_new ("MPI_STATE", mpi);
PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
mpi = PJ_type_container_new("MPI", container->type);
PJ_type_state_new ("MPI_STATE", mpi);
PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
if (TRACE_msg_process_is_enabled()) {
type_t msg_process = PJ_type_get_or_null ("MSG_PROCESS", container->type);
if (TRACE_msg_process_is_enabled()) {
type_t msg_process = PJ_type_get_or_null ("MSG_PROCESS", container->type);
msg_process = PJ_type_container_new("MSG_PROCESS", container->type);
type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
PJ_value_new ("suspend", "1 0 1", state);
msg_process = PJ_type_container_new("MSG_PROCESS", container->type);
type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
PJ_value_new ("suspend", "1 0 1", state);
if (TRACE_msg_vm_is_enabled()) {
type_t msg_vm = PJ_type_get_or_null ("MSG_VM", container->type);
if (TRACE_msg_vm_is_enabled()) {
type_t msg_vm = PJ_type_get_or_null ("MSG_VM", container->type);
msg_vm = PJ_type_container_new("MSG_VM", container->type);
type_t state = PJ_type_state_new ("MSG_VM_STATE", msg_vm);
PJ_value_new ("suspend", "1 0 1", state);
msg_vm = PJ_type_container_new("MSG_VM", container->type);
type_t state = PJ_type_state_new ("MSG_VM_STATE", msg_vm);
PJ_value_new ("suspend", "1 0 1", state);
- recursiveGraphExtraction (surf_platf_get_root(routing_platf), PJ_container_get_root(), filter);
+ recursiveGraphExtraction (simgrid::s4u::Engine::instance()->rootAs(), PJ_container_get_root(), filter);
if (!TRACE_is_enabled()) return;
//always need the call backs to ASes (we need only the root AS),
//to create the rootContainer and the rootType properly
if (!TRACE_is_enabled()) return;
//always need the call backs to ASes (we need only the root AS),
//to create the rootContainer and the rootType properly
- sg_platf_link_add_cb(instr_routing_parse_start_link);
- sg_platf_host_add_cb(instr_routing_parse_start_host);
-
- sg_platf_postparse_add_cb(instr_routing_parse_end_platform);
+ simgrid::surf::on_link.connect(instr_routing_parse_start_link);
+ simgrid::surf::on_postparse.connect(instr_routing_parse_end_platform);
snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename);
PJ_type_variable_new (tnstr, color, root);
}
snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename);
PJ_type_variable_new (tnstr, color, root);
}
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
if (!strcmp (root->name, father_type)){
PJ_type_variable_new (new_typename, color, root);
}
if (!strcmp (root->name, father_type)){
PJ_type_variable_new (new_typename, color, root);
}
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
if (!strcmp (root->name, father_type)){
PJ_type_state_new (new_typename, root);
}
if (!strcmp (root->name, father_type)){
PJ_type_state_new (new_typename, root);
}
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
if (!strcmp (root->name, type_name)){
PJ_value_new (value, color, root);
}
if (!strcmp (root->name, type_name)){
PJ_value_new (value, color, root);
}
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges,
static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges,
- xbt_dict_foreach(surf_AS_get_routing_sons(rc), cursor, child_name, rc_son) {
+ xbt_dict_foreach(as->children(), cursor, child_name, as_child) {
- container->children, surf_AS_get_name(rc_son));
- recursiveXBTGraphExtraction (graph, nodes, edges, rc_son, child_container);
+ container->children, as_child->name());
+ recursiveXBTGraphExtraction (graph, nodes, edges, as_child, child_container);
- surf_AS_get_graph(rc, graph, nodes, edges);
+ static_cast<simgrid::routing::AsImpl*>(as)->getGraph(graph, nodes, edges);
- xbt_graph_t ret = xbt_graph_new_graph (0, NULL);
- xbt_dict_t nodes = xbt_dict_new_homogeneous(NULL);
- xbt_dict_t edges = xbt_dict_new_homogeneous(NULL);
- recursiveXBTGraphExtraction (ret, nodes, edges, surf_platf_get_root(routing_platf), PJ_container_get_root());
+ xbt_graph_t ret = xbt_graph_new_graph (0, nullptr);
+ xbt_dict_t nodes = xbt_dict_new_homogeneous(nullptr);
+ xbt_dict_t edges = xbt_dict_new_homogeneous(nullptr);
+ recursiveXBTGraphExtraction (ret, nodes, edges, simgrid::s4u::Engine::instance()->rootAs(), PJ_container_get_root());
file = fopen(filename, "w");
xbt_assert(file, "Failed to open %s \n", filename);
file = fopen(filename, "w");
xbt_assert(file, "Failed to open %s \n", filename);