Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Make trace_call_location a member
[simgrid.git] / src / smpi / smpi_global.cpp
index db6e796..595b879 100644 (file)
 #include "src/msg/msg_private.h"
 #include "src/simix/SynchroComm.hpp"
 
-
-#include <float.h>              /* DBL_MAX */
+#include <float.h> /* DBL_MAX */
+#include <fstream>
+#include <map>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <fstream>
+#include <string>
+#include <vector>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)");
 #include <boost/tokenizer.hpp>
@@ -59,7 +61,7 @@ typedef struct s_smpi_process_data {
   bool replaying;                /* is the process replaying a trace */
   xbt_bar_t finalization_barrier;
   int return_value;
-  smpi_trace_call_location_t* trace_call_loc;
+  smpi_trace_call_location_t trace_call_loc;
 #if HAVE_PAPI
   /** Contains hardware data as read by PAPI **/
   int papi_event_set;
@@ -256,7 +258,7 @@ int smpi_process_count()
 smpi_trace_call_location_t* smpi_process_get_call_location()
 {
   smpi_process_data_t process_data = smpi_process_data();
-  return process_data->trace_call_loc;
+  return &process_data->trace_call_loc;
 }
 
 int smpi_process_index()
@@ -567,10 +569,6 @@ void smpi_global_init()
     process_data[i]->finalization_barrier = nullptr;
     process_data[i]->return_value         = 0;
 
-    if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
-      process_data[i]->trace_call_loc     = xbt_new(smpi_trace_call_location_t, 1);
-    }
-
 #if HAVE_PAPI
     if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0') {
       // TODO: Implement host/process/thread based counters. This implementation
@@ -624,12 +622,9 @@ void smpi_global_destroy()
     }
     xbt_os_timer_free(process_data[i]->timer);
     xbt_mutex_destroy(process_data[i]->mailboxes_mutex);
-    if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
-      xbt_free(process_data[i]->trace_call_loc);
-    }
     delete process_data[i];
   }
-  delete process_data;
+  delete[] process_data;
   process_data = nullptr;
 
   if (MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED){