+xbt_dict_t created_categories; //declared in instr_interface.c
+
+int TRACE_start()
+{
+ // 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 */
+ TRACE_activate ();
+
+ /* other trace initialization */
+ created_categories = xbt_dict_new();
+ TRACE_surf_alloc();
+ TRACE_smpi_alloc();
+ return 0;
+}
+
+int TRACE_end()
+{
+ if (!TRACE_is_active())
+ return 1;
+
+ /* 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();
+ }
+
+ /* dump trace buffer */
+ TRACE_last_timestamp_to_dump = surf_get_clock();
+ TRACE_paje_dump_buffer(1);
+
+ /* destroy all data structures of tracing (and free) */
+ destroyAllContainers();
+
+ /* close the trace file */
+ TRACE_paje_end();
+
+ /* activate trace */
+ TRACE_desactivate ();
+ XBT_DEBUG("Tracing system is shutdown");
+ return 0;
+}