Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] new tracing options to generate graph configurations for triva
[simgrid.git] / src / instr / instr_interface.c
index 1c5f19e..550e2b9 100644 (file)
@@ -13,7 +13,7 @@
 XBT_LOG_NEW_DEFAULT_CATEGORY(tracing, "Tracing Interface");
 
 static xbt_dict_t defined_types;
-static xbt_dict_t created_categories;
+xbt_dict_t created_categories;
 
 int TRACE_start()
 {
@@ -25,27 +25,14 @@ int TRACE_start()
   }
 
   /* open the trace file */
-  char *filename = TRACE_get_filename();
-  if (!filename) {
-    THROW0(tracing_error, TRACE_ERROR_START,
-           "Trace filename is not initialized.");
-    return 0;
-  }
-  FILE *file = fopen(filename, "w");
-  if (!file) {
-    THROW1(tracing_error, TRACE_ERROR_START,
-           "Tracefile %s could not be opened for writing.", filename);
-  } else {
-    TRACE_paje_start(file);
-  }
+  TRACE_paje_start();
 
   /* activate trace */
   TRACE_activate ();
 
-  /* output header */
-  TRACE_paje_create_header();
-
-  /* define paje hierarchy for tracing */
+  /* base type hierarchy:
+   * --cfg=tracing
+   */
   pajeDefineContainerType("PLATFORM", "0", "platform");
   pajeDefineContainerType("HOST", "PLATFORM", "HOST");
   pajeDefineContainerType("LINK", "PLATFORM", "LINK");
@@ -55,13 +42,18 @@ int TRACE_start()
   pajeDefineEventType("source", "LINK", "source");
   pajeDefineEventType("destination", "LINK", "destination");
 
-  if (TRACE_platform_is_enabled()) {
-    if (TRACE_uncategorized()){
-      pajeDefineVariableType("power_used", "HOST", "power_used");
-      pajeDefineVariableType("bandwidth_used", "LINK", "bandwidth_used");
-    }
+  /* type hierarchy for:
+   * --cfg=tracing/uncategorized
+   */
+  if (TRACE_uncategorized()){
+    pajeDefineVariableTypeWithColor("power_used", "HOST", "power_used", "0.5 0.5 0.5");
+    pajeDefineVariableTypeWithColor("bandwidth_used", "LINK", "bandwidth_used", "0.5 0.5 0.5");
   }
 
+  /* type hierarchy for:
+   * --cfg=tracing/msg/process
+   * --cfg=tracing/msg/volume
+   */
   if (TRACE_msg_process_is_enabled() || TRACE_msg_volume_is_enabled()) {
     //processes grouped by host
     pajeDefineContainerType("PROCESS", "HOST", "PROCESS");
@@ -76,6 +68,9 @@ int TRACE_start()
     pajeDefineLinkType("volume", "0", "PROCESS", "PROCESS", "volume");
   }
 
+  /* type hierarchy for:
+   * --cfg=tracing/msg/task
+   */
   if (TRACE_msg_task_is_enabled()) {
     //tasks grouped by host
     pajeDefineContainerType("TASK", "HOST", "TASK");
@@ -83,6 +78,10 @@ int TRACE_start()
     pajeDefineStateType("presence", "TASK", "presence");
   }
 
+  /* type hierarchy for
+   * --cfg=tracing/smpi
+   * --cfg=tracing/smpi/group
+   */
   if (TRACE_smpi_is_enabled()) {
     if (TRACE_smpi_is_grouped()){
       pajeDefineContainerType("MPI_PROCESS", "HOST", "MPI_PROCESS");
@@ -113,9 +112,21 @@ int TRACE_end()
 {
   if (!TRACE_is_active())
     return 1;
-  FILE *file = TRACE_paje_end();
-  fclose(file);
 
+  /* close the trace file */
+  TRACE_paje_end();
+
+  /* generate uncategorized graph configuration for triva */
+  if (TRACE_get_triva_uncat_conf()){
+    TRACE_generate_triva_uncat_conf();
+  }
+
+  /* generate categorized graph configuration for triva */
+  if (TRACE_get_triva_cat_conf()){
+    TRACE_generate_triva_cat_conf();
+  }
+
+  /* activate trace */
   TRACE_desactivate ();
   return 0;
 }