Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "Assert that the log categories are unique"
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 25 Jan 2021 13:58:47 +0000 (14:58 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 25 Jan 2021 14:01:10 +0000 (15:01 +0100)
The proposed method is not reliable, because when log categories are
not unique, there is 2 variables of the same name and 2 constructors
of the same name.

Redefinitions should thus be detected by the linker and we cannot fix
it reliably from our side.

I'll use less common category names in the library to reduce the risk
of conflict.

This reverts commit 7ca53b5ebe9b96f24832b6890a34e13599b254c2.

examples/c/io-disk-raw/io-disk-raw.c
examples/s4u/io-disk-raw/s4u-io-disk-raw.cpp
examples/smpi/replay/replay.cpp
examples/smpi/trace_call_location/trace_call_location.tesh
include/xbt/log.h
src/smpi/internals/smpi_global.cpp
src/xbt/log.cpp
teshsuite/smpi/gh-139/gh-139.tesh
teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.tesh

index 4a09da3..c6e4fa7 100644 (file)
@@ -15,7 +15,7 @@
 #include <stddef.h>
 #include <stdlib.h>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(disk_example, "Messages specific for this simulation");
+XBT_LOG_NEW_DEFAULT_CATEGORY(disk, "Messages specific for this simulation");
 
 static void host(int argc, char* argv[])
 {
index 4b36beb..7d69d36 100644 (file)
@@ -7,7 +7,7 @@
 #include <string>
 #include <unordered_map>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(disk_test, "Messages specific for this simulation");
+XBT_LOG_NEW_DEFAULT_CATEGORY(disk, "Messages specific for this simulation");
 
 static void host()
 {
index a71fd99..441c991 100644 (file)
@@ -10,7 +10,7 @@
 #include "xbt/str.h"
 
 #include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(replay_test, "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /* This shows how to extend the trace format by adding a new kind of events.
    This function is registered through xbt_replay_action_register() below. */
index 3ac6412..cfa3993 100644 (file)
@@ -15,11 +15,11 @@ $ ${bindir:=.}/../../../smpi_script/bin/smpirun -trace-ti -trace-file ${bindir:=
 
 #Test replaying the trace, without altering the time.
 #We disable computation, but leave the sleep.
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile -platform ${platfdir}/small_platform.xml -np 3 -replay ${bindir:=.}/smpi_trace.txt ${bindir:=.}/../replay/smpi_replay --cfg=smpi/host-speed:1f --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/simulate-computation:no --log=log.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile -platform ${platfdir}/small_platform.xml -np 3 -replay ${bindir:=.}/smpi_trace.txt ${bindir:=.}/../replay/smpi_replay --cfg=smpi/host-speed:1f --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/simulate-computation:no
 > [Fafard:2:(3) 1000.007967] [smpi_replay/INFO] Simulation time 1000.007967
 
 #Test replaying the trace, altering the time to have the sleep much faster (1 instead of 1000).
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile -platform ${platfdir}/small_platform.xml --cfg=smpi/comp-adjustment-file:${srcdir:=.}/trace_call_location/adjust -np 3 -replay ${bindir:=.}/smpi_trace.txt ${bindir:=.}/../replay/smpi_replay  --cfg=smpi/host-speed:1f --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning  --log=log.thres:error --cfg=smpi/simulate-computation:no
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile -platform ${platfdir}/small_platform.xml --cfg=smpi/comp-adjustment-file:${srcdir:=.}/trace_call_location/adjust -np 3 -replay ${bindir:=.}/smpi_trace.txt ${bindir:=.}/../replay/smpi_replay  --cfg=smpi/host-speed:1f --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/simulate-computation:no
 > [Fafard:2:(3) 1.007967] [smpi_replay/INFO] Simulation time 1.007967
 
 $ rm -f ${bindir:=.}/smpi_trace.tx*
index 1e6292b..5ee5e4b 100644 (file)
@@ -5,8 +5,25 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-/* Define the XBT_LOG_MAYDAY symbol to change all logging facilities into basic printfs, e.g. to debug the logs
- * themselves. */
+/** @addtogroup XBT_log
+ *  @brief A generic logging facility in the spirit of log4j (grounding feature)
+ *
+ */
+
+/** @defgroup XBT_log_cats Existing log categories
+ *  @ingroup XBT_log
+ *  @brief (automatically extracted)
+ *
+ *  This is the list of all existing log categories in SimGrid.
+ *  This list is automatically extracted from the source code by the tools/doxygen/xbt_log_extract_hierarchy.pl utility.
+ *
+ *  It should thus contain every categories that are defined in the SimGrid library.
+ *  If you want to see the one defined in your code in addition, provide `--help-logs` on the command line of your
+ * simulator.
+ */
+
+/* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic printf function.
+   Useful to debug the logging facilities themselves, or to not make prehistoric source analysis tools mad. */
 //#define XBT_LOG_MAYDAY
 
 #ifndef XBT_LOG_H
@@ -81,9 +98,6 @@ typedef enum {
  * start of main().
  */
 
-/* Asserts that the provided name was not already used for another category */
-void _xbt_log_is_name_unique(const char* name, const char* file, int line);
-
 /* XBT_LOG_NEW_SUBCATEGORY_helper:
  * Implementation of XBT_LOG_NEW_SUBCATEGORY, which must declare "extern parent" in addition to avoid an extra
  * declaration of root when XBT_LOG_NEW_SUBCATEGORY is called by XBT_LOG_NEW_CATEGORY */
@@ -94,7 +108,6 @@ void _xbt_log_is_name_unique(const char* name, const char* file, int line);
   void _XBT_LOGV_CTOR(catName)(void)                                                                                   \
   {                                                                                                                    \
     XBT_LOG_EXTERNAL_CATEGORY(catName);                                                                                \
-    _xbt_log_is_name_unique(_XBT_STRINGIFY(catName), __FILE__, __LINE__);                                              \
     if (!_XBT_LOGV(catName).initialized) {                                                                             \
       _xbt_log_cat_init(&_XBT_LOGV(catName), xbt_log_priority_uninitialized);                                          \
     }                                                                                                                  \
index 2e96efe..ce1c397 100644 (file)
@@ -542,7 +542,7 @@ int smpi_main(const char* executable, int argc, char* argv[])
   simgrid::instr::init();
   SIMIX_global_init(&argc, argv);
 
-  auto engine = simgrid::s4u::Engine::get_instance();
+  auto engine              = simgrid::s4u::Engine::get_instance();
 
   sg_storage_file_system_init();
   // parse the platform file: get the host list
index fa02f97..4819878 100644 (file)
@@ -16,7 +16,6 @@
 #include <array>
 #include <mutex>
 #include <string>
-#include <unordered_set>
 #include <vector>
 
 int xbt_log_no_loc = 0; /* if set to true (with --log=no_loc), file localization will be omitted (for tesh tests) */
@@ -248,16 +247,6 @@ static void _xbt_log_cat_apply_set(xbt_log_category_t category, const xbt_log_se
   }
 }
 
-/** Asserts that the provided name is unique */
-void _xbt_log_is_name_unique(const char* name, const char* file, int line)
-{
-  static std::unordered_set<std::string> used_names;
-
-  if (used_names.find(name) != used_names.end())
-    XBT_WARN("%s:%d: log category redefined: %s", file, line, name);
-  used_names.insert(std::string(name));
-}
-
 /*
  * This gets called the first time a category is referenced and performs the initialization.
  * Also resets threshold to inherited!
@@ -265,7 +254,6 @@ void _xbt_log_is_name_unique(const char* name, const char* file, int line)
 int _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority)
 {
   DISABLE_XBT_LOG_CAT_INIT();
-
   if (category->initialized)
     return priority >= category->threshold;
 
index 2afe088..f9a9233 100644 (file)
@@ -1,4 +1,4 @@
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -np 2 -platform ../../../examples/platforms/small_platform.xml -hostfile ../hostfile ${bindir:=.}/gh-139 --cfg=smpi/simulate-computation:no --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning  --log=log.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -np 2 -platform ../../../examples/platforms/small_platform.xml -hostfile ../hostfile ${bindir:=.}/gh-139 --cfg=smpi/simulate-computation:no --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning
 > [Tremblay:0:(1) 0.000000] [smpi_test/INFO] I'm 0/2
 > [Jupiter:1:(2) 0.000000] [smpi_test/INFO] I'm 1/2
 > [Tremblay:wait send:(3) 0.000000] [smpi_test/INFO] new thread has parameter rank 0 and global variable rank 0
index 789caee..675262e 100644 (file)
@@ -1,6 +1,6 @@
 p Test dsend
 ! output sort
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ${bindir:=.}/../hostfile -platform ${platfdir}/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -s --long --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning --log=log.thres:error --cfg=smpi/simulate-computation:no
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ${bindir:=.}/../hostfile -platform ${platfdir}/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -s --long --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/simulate-computation:no
 > [Jupiter:1:(2) 0.000000] [dsend/INFO] rank 1: data exchanged
 > [Tremblay:0:(1) 0.005896] [dsend/INFO] rank 0: data exchanged
 > [rank 0] -> Tremblay
@@ -11,7 +11,7 @@ p message size is 4 bytes
 p process 1 will finish at 0.5+2*4 (send) + 1+0.1*4 (isend) = 9.9s
 p process 2 will finish at 0.5+2*4 (time before first send) + 2*(1+0.5*4) (recv+irecv) + 0.005890 (network time, same as before) = 14.505890s
 ! output sort
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ${bindir:=.}/../hostfile -platform ${platfdir}/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -s --long --log=smpi_config.thres:warning --cfg=smpi/or:0:1:0.5 --cfg=smpi/os:0:0.5:2 --cfg=smpi/ois:0:1:0.1 --cfg=smpi/simulate-computation:no --log=xbt_cfg.thres:warning --log=log.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ${bindir:=.}/../hostfile -platform ${platfdir}/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -s --long --log=smpi_config.thres:warning --cfg=smpi/or:0:1:0.5 --cfg=smpi/os:0:0.5:2 --cfg=smpi/ois:0:1:0.1 --cfg=smpi/simulate-computation:no --log=xbt_cfg.thres:warning
 > [Jupiter:1:(2) 9.900000] [dsend/INFO] rank 1: data exchanged
 > [Tremblay:0:(1) 14.505896] [dsend/INFO] rank 0: data exchanged
 > [rank 0] -> Tremblay