-static xbt_dict_t defined_types;
-static xbt_dict_t created_categories;
-
-int TRACE_start()
-{
- if (!TRACE_is_configured()) {
- THROW0(tracing_error, TRACE_ERROR_START,
- "TRACE_start should be called after SimGrid initialization functions.");
- return 0;
- }
-
- if (!TRACE_is_enabled()){
- return 0;
- }
-
- if (IS_TRACING) { /* what? trace is already active... ignore.. */
- THROW0(tracing_error, TRACE_ERROR_START,
- "TRACE_start called, but tracing is already active.");
- return 0;
- }
-
- 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_create_header();
-
- /* define paje hierarchy for tracing */
- pajeDefineContainerType("PLATFORM", "0", "platform");
- pajeDefineContainerType("HOST", "PLATFORM", "HOST");
- pajeDefineContainerType("LINK", "PLATFORM", "LINK");
- pajeDefineVariableType("power", "HOST", "power");
- pajeDefineVariableType("bandwidth", "LINK", "bandwidth");
- pajeDefineVariableType("latency", "LINK", "latency");
- pajeDefineEventType("source", "LINK", "source");
- pajeDefineEventType("destination", "LINK", "destination");
-
- if (IS_TRACING_PLATFORM) {
- if (TRACE_uncategorized()){
- pajeDefineVariableType("power_used", "HOST", "power_used");
- pajeDefineVariableType("bandwidth_used", "LINK", "bandwidth_used");
- }
- }
-
- if (IS_TRACING_PROCESSES || IS_TRACING_VOLUME) {
- //processes grouped by host
- pajeDefineContainerType("PROCESS", "HOST", "PROCESS");
- }
-
- if (IS_TRACING_PROCESSES) {
- pajeDefineStateType("category", "PROCESS", "category");
- pajeDefineStateType("presence", "PROCESS", "presence");
- }
-
- if (IS_TRACING_VOLUME) {
- pajeDefineLinkType("volume", "0", "PROCESS", "PROCESS", "volume");
- }
-
- if (IS_TRACING_TASKS) {
- //tasks grouped by host
- pajeDefineContainerType("TASK", "HOST", "TASK");
- pajeDefineStateType("category", "TASK", "category");
- pajeDefineStateType("presence", "TASK", "presence");
- }
-
- if (IS_TRACING_SMPI) {
- if (TRACE_smpi_is_grouped()){
- pajeDefineContainerType("MPI_PROCESS", "HOST", "MPI_PROCESS");
- }else{
- pajeDefineContainerType("MPI_PROCESS", "PLATFORM", "MPI_PROCESS");
- }
- pajeDefineStateType("MPI_STATE", "MPI_PROCESS", "MPI_STATE");
- pajeDefineLinkType("MPI_LINK", "0", "MPI_PROCESS", "MPI_PROCESS",
- "MPI_LINK");
- }
-
- /* creating the platform */
- pajeCreateContainer(MSG_get_clock(), "platform", "PLATFORM", "0",
- "simgrid-platform");
-
- /* other trace initialization */
- defined_types = xbt_dict_new();
- created_categories = xbt_dict_new();
- TRACE_msg_task_alloc();
- TRACE_category_alloc();
- TRACE_surf_alloc();
- TRACE_msg_process_alloc();
- TRACE_smpi_alloc();
-
- return 0;
-}
-
-int TRACE_end()