From: Martin Quinson Date: Mon, 11 Dec 2017 00:40:29 +0000 (+0100) Subject: Pliz don't have two log channels with the same name X-Git-Tag: v3.18~51 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a119bf80e0223355fb2b6addb71abd562f36c1d7 Pliz don't have two log channels with the same name This was breaking in a weird way. On Linux, the internal replay channel was used for both the parameter setting and the use (it resulted in more things to be shown when setting replay.thres:verb). On Mac, the parameter setting did not reach the channel usage, and nothing was shown. The fact that the linker accepted these two competing definitions of strong identifiers is weird. According to my teachings, this should have failed :) --- diff --git a/examples/s4u/replay-comm/s4u-replay-comm.cpp b/examples/s4u/replay-comm/s4u-replay-comm.cpp index 5d5b515a4c..4c5db1efdc 100644 --- a/examples/s4u/replay-comm/s4u-replay-comm.cpp +++ b/examples/s4u/replay-comm/s4u-replay-comm.cpp @@ -8,10 +8,10 @@ #include "xbt/str.h" #include -XBT_LOG_NEW_DEFAULT_CATEGORY(replay, "Messages specific for this msg example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(replay_comm, "Messages specific for this msg example"); #define ACT_DEBUG(...) \ - if (XBT_LOG_ISENABLED(replay, xbt_log_priority_verbose)) { \ + if (XBT_LOG_ISENABLED(replay_comm, xbt_log_priority_verbose)) { \ char* NAME = xbt_str_join_array(action, " "); \ XBT_DEBUG(__VA_ARGS__); \ xbt_free(NAME); \ @@ -20,7 +20,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(replay, "Messages specific for this msg example"); static void log_action(const char* const* action, double date) { - if (XBT_LOG_ISENABLED(replay, xbt_log_priority_verbose)) { + if (XBT_LOG_ISENABLED(replay_comm, xbt_log_priority_verbose)) { char* name = xbt_str_join_array(action, " "); XBT_VERB("%s %f", name, date); xbt_free(name); diff --git a/examples/s4u/replay-comm/s4u-replay-comm.tesh b/examples/s4u/replay-comm/s4u-replay-comm.tesh index 6409afa6fa..00006b27fc 100644 --- a/examples/s4u/replay-comm/s4u-replay-comm.tesh +++ b/examples/s4u/replay-comm/s4u-replay-comm.tesh @@ -1,14 +1,12 @@ ! output sort 19 -$ ${bindir:=.}/s4u-replay-comm --log=replay.thres=verbose ${platfdir}/small_platform_fatpipe.xml s4u-replay-comm-split_d.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n" -> [ 0.000000] (p0@Tremblay) Prepare to replay file 's4u-replay-comm-split-p0.txt' -> [ 0.000000] (p1@Ruby) Prepare to replay file 's4u-replay-comm-split-p1.txt' +$ ${bindir:=.}/s4u-replay-comm --log=replay_comm.thres=verbose ${platfdir}/small_platform_fatpipe.xml s4u-replay-comm-split_d.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n" > [ 20.703314] (p0@Tremblay) p0 recv p1 20.703314 > [ 20.703314] (p1@Ruby) p1 send p0 1e10 20.703314 > [ 30.897513] (p0@Tremblay) p0 compute 1e9 10.194200 > [ 30.897513] (p1@Ruby) p1 compute 1e9 10.194200 > [ 30.897513] (maestro@) Simulation time 30.8975 -$ ${bindir:=.}/s4u-replay-comm --log=replay.thres=verbose ${platfdir}/small_platform_fatpipe.xml s4u-replay-comm_d.xml s4u-replay-comm.txt "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n" +$ ${bindir:=.}/s4u-replay-comm --log=replay_comm.thres=verbose ${platfdir}/small_platform_fatpipe.xml s4u-replay-comm_d.xml s4u-replay-comm.txt "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n" > [ 20.703314] (p0@Tremblay) p0 recv p1 20.703314 > [ 20.703314] (p1@Ruby) p1 send p0 1e10 20.703314 > [ 30.897513] (p0@Tremblay) p0 compute 1e9 10.194200 diff --git a/examples/s4u/replay-storage/s4u-replay-storage.cpp b/examples/s4u/replay-storage/s4u-replay-storage.cpp index 8d84d0a17c..543b21e31b 100644 --- a/examples/s4u/replay-storage/s4u-replay-storage.cpp +++ b/examples/s4u/replay-storage/s4u-replay-storage.cpp @@ -10,12 +10,12 @@ #include #include -XBT_LOG_NEW_DEFAULT_CATEGORY(storage_replay, "Messages specific for this example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(replay_storage, "Messages specific for this example"); static std::unordered_map opened_files; #define ACT_DEBUG(...) \ - if (XBT_LOG_ISENABLED(storage_replay, xbt_log_priority_verbose)) { \ + if (XBT_LOG_ISENABLED(replay_storage, xbt_log_priority_verbose)) { \ char* NAME = xbt_str_join_array(action, " "); \ XBT_DEBUG(__VA_ARGS__); \ xbt_free(NAME); \ @@ -24,7 +24,7 @@ static std::unordered_map opened_files; static void log_action(const char* const* action, double date) { - if (XBT_LOG_ISENABLED(storage_replay, xbt_log_priority_verbose)) { + if (XBT_LOG_ISENABLED(replay_storage, xbt_log_priority_verbose)) { char* name = xbt_str_join_array(action, " "); XBT_VERB("%s %f", name, date); xbt_free(name); diff --git a/examples/s4u/replay-storage/s4u-replay-storage.tesh b/examples/s4u/replay-storage/s4u-replay-storage.tesh index de046436e4..a7a63a1808 100644 --- a/examples/s4u/replay-storage/s4u-replay-storage.tesh +++ b/examples/s4u/replay-storage/s4u-replay-storage.tesh @@ -1,5 +1,5 @@ ! output sort 19 -$ ${bindir:=.}/s4u-replay-storage --log=storage_replay.thres=verbose ${platfdir}/storage/storage.xml s4u-replay-storage_d.xml s4u-replay-storage.txt "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n" +$ ${bindir:=.}/s4u-replay-storage --log=replay_storage.thres=verbose ${platfdir}/storage/storage.xml s4u-replay-storage_d.xml s4u-replay-storage.txt "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n" > [ 0.000000] (p0@denise) p0 open /home/lib/libsimgrid.so.3.6.2 0.000000 > [ 0.063552] (p0@denise) p0 read /home/lib/libsimgrid.so.3.6.2 12710497 0.063552 > [ 0.063552] (p0@denise) p0 close /home/lib/libsimgrid.so.3.6.2 0.000000