+ print_line (OPT_TRIVA_UNCAT_CONF, "Generate graph configuration for Triva",
+ " This option can be used in all types of simulators build with SimGrid\n"
+ " to generate a uncategorized resource utilization graph to be used as\n"
+ " configuration for the Triva visualization analysis. This option\n"
+ " can be used with tracing/categorized:1 and tracing:1 options to\n"
+ " analyze an unmodified simulator before changing it to contain\n"
+ " categories.",
+ detailed);
+ print_line (OPT_TRIVA_CAT_CONF, "generate uncategorized graph configuration for Triva",
+ " This option can be used if this simulator uses tracing categories\n"
+ " in its code. The file specified by this option holds a graph configuration\n"
+ " file for the Triva visualization tool that can be used to analyze a categorized\n"
+ " resource utilization.",
+ detailed);
+}
+
+void TRACE_generate_triva_uncat_conf (void)
+{
+ char *output = TRACE_get_triva_uncat_conf ();
+ if (output && strlen(output) > 0){
+ FILE *file = fopen (output, "w");
+ xbt_assert1 (file != NULL,
+ "Unable to open file (%s) for writing triva graph "
+ "configuration (uncategorized).", output);
+ fprintf (file,
+ "{\n"
+ " node = (HOST);\n"
+ " edge = (LINK);\n"
+ "\n"
+ " HOST = {\n"
+ " size = power;\n"
+ " scale = global;\n"
+ " host_sep = {\n"
+ " type = separation;\n"
+ " size = power;\n"
+ " values = (power_used);\n"
+ " };\n"
+ " };\n"
+ " LINK = {\n"
+ " src = source;\n"
+ " dst = destination;\n"
+ " size = bandwidth;\n"
+ " scale = global;\n"
+ " link_sep = {\n"
+ " type = separation;\n"
+ " size = bandwidth;\n"
+ " values = (bandwidth_used);\n"
+ " };\n"
+ " };\n"
+ " graphviz-algorithm = neato;\n"
+ "}\n"
+ );
+ fclose (file);
+ }
+}
+
+void TRACE_generate_triva_cat_conf (void)
+{
+ char *output = TRACE_get_triva_cat_conf();
+ if (output && strlen(output) > 0){
+ //check if we do have categories declared
+ if (xbt_dict_length(created_categories) == 0){
+ INFO0("No categories declared, ignoring generation of triva graph configuration");
+ return;
+ }
+ xbt_dict_cursor_t cursor=NULL;
+ char *key, *data;
+ FILE *file = fopen (output, "w");
+ xbt_assert1 (file != NULL,
+ "Unable to open file (%s) for writing triva graph "
+ "configuration (categorized).", output);
+ fprintf (file,
+ "{\n"
+ " node = (HOST);\n"
+ " edge = (LINK);\n"
+ "\n"
+ " HOST = {\n"
+ " size = power;\n"
+ " scale = global;\n"
+ " host_sep = {\n"
+ " type = separation;\n"
+ " size = power;\n"
+ " values = (");
+ xbt_dict_foreach(created_categories,cursor,key,data) {
+ fprintf(file, "%s, ",key);
+ }
+ fprintf (file,
+ ");\n"
+ " };\n"
+ " };\n"
+ " LINK = {\n"
+ " src = source;\n"
+ " dst = destination;\n"
+ " size = bandwidth;\n"
+ " scale = global;\n"
+ " link_sep = {\n"
+ " type = separation;\n"
+ " size = bandwidth;\n"
+ " values = (");
+ xbt_dict_foreach(created_categories,cursor,key,data) {
+ fprintf(file, "%s, ",key);
+ }
+ fprintf (file,
+ ");\n"
+ " };\n"
+ " };\n"
+ " graphviz-algorithm = neato;\n"
+ "}\n"
+ );
+ fclose(file);
+ }