Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Have trace-call-location work with filenames and not full paths.
authorAugustin Degomme <adegomme@gmail.com>
Thu, 3 Oct 2019 12:57:12 +0000 (14:57 +0200)
committerAugustin Degomme <adegomme@gmail.com>
Thu, 3 Oct 2019 14:27:04 +0000 (16:27 +0200)
It's much easier this way to use adjustment files, and name collisions in a given code are not common.
If it's still needed, previous behaviour can be restored using "smpi/trace-call-use-absolute-path" option

src/simgrid/sg_config.cpp
src/smpi/internals/smpi_bench.cpp

index 2acb020..e736195 100644 (file)
@@ -406,7 +406,8 @@ void sg_config_init(int *argc, char **argv)
 
   simgrid::config::declare_flag<bool>("smpi/trace-call-location",
                                       "Should filename and linenumber of MPI calls be traced?", false);
 
   simgrid::config::declare_flag<bool>("smpi/trace-call-location",
                                       "Should filename and linenumber of MPI calls be traced?", false);
-
+  simgrid::config::declare_flag<bool>("smpi/trace-call-use-absolute-path",
+                                      "Should filenames for trace-call tracing be absolute or not?", false);
   simgrid::config::declare_flag<int>(
       "smpi/send-is-detached-thresh",
       "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend", 65536);
   simgrid::config::declare_flag<int>(
       "smpi/send-is-detached-thresh",
       "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend", 65536);
index 20e22c7..84fbe20 100644 (file)
@@ -12,6 +12,7 @@
 #include "src/internal_config.h"
 #include "src/mc/mc_replay.hpp"
 #include "xbt/config.hpp"
 #include "src/internal_config.h"
 #include "src/mc/mc_replay.hpp"
 #include "xbt/config.hpp"
+#include "xbt/file.hpp"
 
 #include "src/smpi/include/smpi_actor.hpp"
 #include <unordered_map>
 
 #include "src/smpi/include/smpi_actor.hpp"
 #include <unordered_map>
@@ -470,8 +471,11 @@ void smpi_trace_set_call_location(const char* file, const int line)
 
   loc->previous_filename   = loc->filename;
   loc->previous_linenumber = loc->linenumber;
 
   loc->previous_filename   = loc->filename;
   loc->previous_linenumber = loc->linenumber;
-  loc->filename            = file;
-  loc->linenumber          = line;
+  if(not simgrid::config::get_value<bool>("smpi/trace-call-use-absolute-path"))
+    loc->filename = simgrid::xbt::Path(file).get_base_name();
+  else
+    loc->filename = file;
+  loc->linenumber = line;
 }
 
 /** Required for Fortran bindings */
 }
 
 /** Required for Fortran bindings */