Example #1
0
int TRACE_start()
{
  TRACE_getopts();

  // tracing system must be:
  //    - enabled (with --cfg=tracing:1)
  //    - already configured (TRACE_global_init already called)
  if (!(TRACE_is_enabled() && TRACE_is_configured())){
    return 0;
  }

  XBT_DEBUG("Tracing starts");

  /* open the trace file */
  TRACE_paje_start();

  /* activate trace */
  if (trace_active == 1){
    THROWF (tracing_error, 0, "Tracing is already active");
  }
  trace_active = 1;
  XBT_DEBUG ("Tracing is on");

  /* other trace initialization */
  created_categories = xbt_dict_new_homogeneous(xbt_free);
  declared_marks = xbt_dict_new_homogeneous (xbt_free);
  user_host_variables = xbt_dict_new_homogeneous (xbt_free);
  user_link_variables = xbt_dict_new_homogeneous (xbt_free);
  TRACE_surf_alloc();
  TRACE_smpi_alloc();
  return 0;
}
Example #2
0
int TRACE_start()
{
  if (TRACE_is_configured())
    TRACE_getopts();

  // tracing system must be:
  //    - enabled (with --cfg=tracing:yes)
  //    - already configured (TRACE_global_init already called)
  if (TRACE_is_enabled()) {

    XBT_DEBUG("Tracing starts");

    /* init the tracing module to generate the right output */
    /* open internal buffer */
    TRACE_init();

    /* open the trace file(s) */
    const char* format = sg_cfg_get_string(OPT_TRACING_FORMAT);
    XBT_DEBUG("Tracing format %s\n", format);
    if(!strcmp(format, "Paje")){
      TRACE_paje_init();
      TRACE_paje_start();
    }else if (!strcmp(format, "TI")){
      TRACE_TI_init();
      TRACE_TI_start();
    }else{
      xbt_die("Unknown trace format :%s ", format);
    }

    /* activate trace */
    if (trace_active == 1) {
      THROWF(tracing_error, 0, "Tracing is already active");
    }
    trace_active = 1;
    XBT_DEBUG("Tracing is on");

    /* other trace initialization */
    created_categories = xbt_dict_new_homogeneous(xbt_free_f);
    declared_marks = xbt_dict_new_homogeneous(xbt_free_f);
    user_host_variables = xbt_dict_new_homogeneous(xbt_free_f);
    user_vm_variables = xbt_dict_new_homogeneous(xbt_free_f);
    user_link_variables = xbt_dict_new_homogeneous(xbt_free_f);

    if (TRACE_start_functions != NULL) {
      void (*func) ();
      unsigned int iter = xbt_dynar_length(TRACE_start_functions);
      xbt_dynar_foreach(TRACE_start_functions, iter, func) {
        func();
      }
    }
  }