]> AND Private Git Repository - loba.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Use new defined variadic logging macros.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 4 Feb 2011 07:38:53 +0000 (08:38 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 4 Feb 2011 07:54:43 +0000 (08:54 +0100)
12 files changed:
Makefile
communicator.cpp
deployment.cpp
hostdata.cpp
loba_fairstrategy.cpp
loba_simple.cpp
main.cpp
neighbor.cpp
options.cpp
process.cpp
process.h
simple_async.cpp

index f142b37f9a5cb264d081d135237dc2510802ce14..ce4b7c46f39e4132c433a26396ca42746fd15f26 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,6 @@ CC := gcc
 CXX := g++
 
 CPPFLAGS += -I $(SIMGRID_INSTALL_DIR)/include
 CXX := g++
 
 CPPFLAGS += -I $(SIMGRID_INSTALL_DIR)/include
-CPPFLAGS += -D XBT_LOG_OLD_STYLE
 CPPFLAGS += $(CHECK_FLAGS)
 
 #CFLAGS += -std=c99
 CPPFLAGS += $(CHECK_FLAGS)
 
 #CFLAGS += -std=c99
index e30d73187dc8e184ece920423ed33cca03e16454..080842619541038f29bba85cfc051a28a8a531d5 100644 (file)
@@ -44,31 +44,31 @@ communicator::~communicator()
 {
     m_task_t task;
 
 {
     m_task_t task;
 
-    DEBUG0("send finalize to receiver/ctrl");
+    XBT_DEBUG("send finalize to receiver/ctrl");
     task = MSG_task_create("finalize", 0.0, 0, NULL);
     MSG_task_send(task, get_ctrl_mbox());
 
     task = MSG_task_create("finalize", 0.0, 0, NULL);
     MSG_task_send(task, get_ctrl_mbox());
 
-    DEBUG0("send finalize to receiver/data");
+    XBT_DEBUG("send finalize to receiver/data");
     task = MSG_task_create("finalize", 0.0, 0, NULL);
     MSG_task_send(task, get_data_mbox());
 
     xbt_mutex_acquire(mutex);
     while (receiver_process) {
     task = MSG_task_create("finalize", 0.0, 0, NULL);
     MSG_task_send(task, get_data_mbox());
 
     xbt_mutex_acquire(mutex);
     while (receiver_process) {
-        DEBUG0("waiting for receiver to terminate");
+        XBT_DEBUG("waiting for receiver to terminate");
         xbt_cond_wait(cond, mutex);
     }
     xbt_mutex_release(mutex);
 
     if (ctrl_comm)
         xbt_cond_wait(cond, mutex);
     }
     xbt_mutex_release(mutex);
 
     if (ctrl_comm)
-        WARN0("ctrl_comm is pending!");
+        XBT_WARN("ctrl_comm is pending!");
     if (data_comm)
     if (data_comm)
-        WARN0("data_comm is pending!");
+        XBT_WARN("data_comm is pending!");
     if (!received.empty())
     if (!received.empty())
-        WARN2("lost %lu received message%s!",
-              (unsigned long )received.size(), ESSE(received.size()));
+        XBT_WARN("lost %lu received message%s!",
+                 (unsigned long )received.size(), ESSE(received.size()));
     if (!sent_comm.empty())
     if (!sent_comm.empty())
-        WARN2("lost %lu sent message%s!",
-              (unsigned long )sent_comm.size(), ESSE(sent_comm.size()));
+        XBT_WARN("lost %lu sent message%s!",
+                 (unsigned long )sent_comm.size(), ESSE(sent_comm.size()));
 
     xbt_cond_destroy(cond);
     xbt_mutex_destroy(mutex);
 
     xbt_cond_destroy(cond);
     xbt_mutex_destroy(mutex);
@@ -76,7 +76,7 @@ communicator::~communicator()
 
 void communicator::send(const char* dest, message* msg)
 {
 
 void communicator::send(const char* dest, message* msg)
 {
-    DEBUG2("send %s to %s", msg->to_string().c_str(), dest);
+    XBT_DEBUG("send %s to %s", msg->to_string().c_str(), dest);
     double msg_size = sizeof *msg;
     if (msg->get_type() == message::LOAD)
         msg_size += opt::comm_cost(msg->get_amount());
     double msg_size = sizeof *msg;
     if (msg->get_type() == message::LOAD)
         msg_size += opt::comm_cost(msg->get_amount());
@@ -96,7 +96,7 @@ bool communicator::recv(message*& msg, m_host_t& from, double timeout)
         xbt_mutex_acquire(mutex);
         while (received.empty() && (!deadline || deadline > MSG_get_clock())) {
             xbt_ex_t e;
         xbt_mutex_acquire(mutex);
         while (received.empty() && (!deadline || deadline > MSG_get_clock())) {
             xbt_ex_t e;
-            DEBUG0("waiting for a message to come");
+            XBT_DEBUG("waiting for a message to come");
             TRY {
                 if (deadline)
                     xbt_cond_timedwait(cond, mutex, deadline - MSG_get_clock());
             TRY {
                 if (deadline)
                     xbt_cond_timedwait(cond, mutex, deadline - MSG_get_clock());
@@ -121,7 +121,7 @@ bool communicator::recv(message*& msg, m_host_t& from, double timeout)
     from = MSG_task_get_source(task);
     MSG_task_destroy(task);
 
     from = MSG_task_get_source(task);
     MSG_task_destroy(task);
 
-    DEBUG2("received %s from %s",
+    XBT_DEBUG("received %s from %s",
            msg->to_string().c_str(), MSG_host_get_name(from));
 
     return true;
            msg->to_string().c_str(), MSG_host_get_name(from));
 
     return true;
@@ -155,7 +155,7 @@ int communicator::receiver_wrapper(int, char* [])
     comm = static_cast<communicator*>(MSG_process_get_data(MSG_process_self()));
     int result = comm->receiver();
 
     comm = static_cast<communicator*>(MSG_process_get_data(MSG_process_self()));
     int result = comm->receiver();
 
-    DEBUG0("terminate");
+    XBT_DEBUG("terminate");
     xbt_mutex_acquire(comm->mutex);
     comm->receiver_process = NULL;
     xbt_cond_signal(comm->cond);
     xbt_mutex_acquire(comm->mutex);
     comm->receiver_process = NULL;
     xbt_cond_signal(comm->cond);
@@ -168,7 +168,7 @@ int communicator::receiver()
 {
     ctrl_comm = MSG_task_irecv(&ctrl_task, get_ctrl_mbox());
     data_comm = MSG_task_irecv(&data_task, get_data_mbox());
 {
     ctrl_comm = MSG_task_irecv(&ctrl_task, get_ctrl_mbox());
     data_comm = MSG_task_irecv(&data_task, get_data_mbox());
-    DEBUG0("receiver ready");
+    XBT_DEBUG("receiver ready");
     xbt_mutex_acquire(mutex);
     xbt_cond_signal(cond);      // signal master that we are ready
     xbt_mutex_release(mutex);
     xbt_mutex_acquire(mutex);
     xbt_cond_signal(cond);      // signal master that we are ready
     xbt_mutex_release(mutex);
@@ -185,14 +185,14 @@ int communicator::receiver()
 
         if (ctrl_comm && comm_test_n_destroy(ctrl_comm)) {
             if (strcmp(MSG_task_get_name(ctrl_task), "finalize")) {
 
         if (ctrl_comm && comm_test_n_destroy(ctrl_comm)) {
             if (strcmp(MSG_task_get_name(ctrl_task), "finalize")) {
-                DEBUG0("received message from ctrl");
+                XBT_DEBUG("received message from ctrl");
                 xbt_mutex_acquire(mutex);
                 received.push(ctrl_task);
                 xbt_mutex_release(mutex);
                 ctrl_task = NULL;
                 ctrl_comm = MSG_task_irecv(&ctrl_task, get_ctrl_mbox());
             } else {
                 xbt_mutex_acquire(mutex);
                 received.push(ctrl_task);
                 xbt_mutex_release(mutex);
                 ctrl_task = NULL;
                 ctrl_comm = MSG_task_irecv(&ctrl_task, get_ctrl_mbox());
             } else {
-                DEBUG0("received finalize from ctrl");
+                XBT_DEBUG("received finalize from ctrl");
                 MSG_task_destroy(ctrl_task);
                 ctrl_task = NULL;
                 ctrl_comm = NULL;
                 MSG_task_destroy(ctrl_task);
                 ctrl_task = NULL;
                 ctrl_comm = NULL;
@@ -201,14 +201,14 @@ int communicator::receiver()
 
         if (data_comm && comm_test_n_destroy(data_comm)) {
             if (strcmp(MSG_task_get_name(data_task), "finalize")) {
 
         if (data_comm && comm_test_n_destroy(data_comm)) {
             if (strcmp(MSG_task_get_name(data_task), "finalize")) {
-                DEBUG0("received message from data");
+                XBT_DEBUG("received message from data");
                 xbt_mutex_acquire(mutex);
                 received.push(data_task);
                 xbt_mutex_release(mutex);
                 data_task = NULL;
                 data_comm = MSG_task_irecv(&data_task, get_data_mbox());
             } else {
                 xbt_mutex_acquire(mutex);
                 received.push(data_task);
                 xbt_mutex_release(mutex);
                 data_task = NULL;
                 data_comm = MSG_task_irecv(&data_task, get_data_mbox());
             } else {
-                DEBUG0("received finalize from data");
+                XBT_DEBUG("received finalize from data");
                 MSG_task_destroy(data_task);
                 data_task = NULL;
                 data_comm = NULL;
                 MSG_task_destroy(data_task);
                 data_task = NULL;
                 data_comm = NULL;
index 58260144b737a48fad7f0f80fa3add1717e665c1..5659db655f4ba75780f74fc21d2d3dbbff9df50d 100644 (file)
@@ -7,6 +7,7 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(depl);
 
 #include "hostdata.h"
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(depl);
 
 #include "hostdata.h"
+#include "misc.h"
 #include "options.h"
 
 #include "deployment.h"
 #include "options.h"
 
 #include "deployment.h"
@@ -50,12 +51,12 @@ void deployment_generator::deploy()
         std::ostringstream oss;
         oss << std::setprecision(12) << hosts[i].load;
         std::string strload = oss.str();
         std::ostringstream oss;
         oss << std::setprecision(12) << hosts[i].load;
         std::string strload = oss.str();
-        DEBUG2("%s/load -> \"%s\"", hostname, strload.c_str());
+        XBT_DEBUG("%s/load -> \"%s\"", hostname, strload.c_str());
         xbt_dynar_push_as(args, const char*, strload.c_str());
         for (unsigned j = 0 ; j < hosts[i].neighbors.size() ; ++j) {
             int neighbor = hosts[i].neighbors[j];
             const char* neighbor_name = hostdata::at(neighbor).get_name();
         xbt_dynar_push_as(args, const char*, strload.c_str());
         for (unsigned j = 0 ; j < hosts[i].neighbors.size() ; ++j) {
             int neighbor = hosts[i].neighbors[j];
             const char* neighbor_name = hostdata::at(neighbor).get_name();
-            DEBUG2("%s/neighbor -> \"%s\"", hostname, neighbor_name);
+            XBT_DEBUG("%s/neighbor -> \"%s\"", hostname, neighbor_name);
             xbt_dynar_push_as(args, const char*, neighbor_name);
         }
         MSG_set_function(hostname, "loba", args);
             xbt_dynar_push_as(args, const char*, neighbor_name);
         }
         MSG_set_function(hostname, "loba", args);
@@ -137,10 +138,10 @@ void deployment_torus::generate()
     // here width == ceil(sqrt(size))
 
     unsigned first_on_last_line = (size() - 1) - (size() - 1) % width;
     // here width == ceil(sqrt(size))
 
     unsigned first_on_last_line = (size() - 1) - (size() - 1) % width;
-    DEBUG4("torus size = %u ; width = %u ; height = %u ; foll = %u",
-           (unsigned )size(), width,
-           (unsigned )(size() / width + !!(size() % width)),
-           first_on_last_line);
+    XBT_DEBUG("torus size = %u ; width = %u ; height = %u ; foll = %u",
+              (unsigned )size(), width,
+              (unsigned )(size() / width + !!(size() % width)),
+              first_on_last_line);
     for (unsigned i = 0; i < size(); i++) {
         unsigned next_line;
         unsigned prev_line;
     for (unsigned i = 0; i < size(); i++) {
         unsigned next_line;
         unsigned prev_line;
index 8a86eb976f3c9941ce17b85815167dba10a9a8e8..4d710543ce1882472d1bc0b0a654397f16894d56 100644 (file)
@@ -36,9 +36,9 @@ void hostdata::create()
     e_xbt_log_priority_t logp = xbt_log_priority_verbose;
     if (!LOG_ISENABLED(logp))
         return;
     e_xbt_log_priority_t logp = xbt_log_priority_verbose;
     if (!LOG_ISENABLED(logp))
         return;
-    LOG1(logp, "Got %lu hosts.", (unsigned long)hosts.size());
+    XBT_LOG(logp, "Got %lu hosts.", (unsigned long)hosts.size());
     for (int i = 0; i < nhosts; i++) {
     for (int i = 0; i < nhosts; i++) {
-        LOG2(logp, "Host #%d named \"%s\".", i, hosts[i].get_name());
+        XBT_LOG(logp, "Host #%d named \"%s\".", i, hosts[i].get_name());
     }
 }
 
     }
 }
 
index a9f8e6048fb379c0d74d5bfed060887a00101c44..98b42cd831bbf23f70533d32858cdc8e014af8c4 100644 (file)
@@ -28,7 +28,7 @@ void loba_fairstrategy::load_balance()
             if (pneigh[i]->get_load() <= get_load() - 2 * delta) {
                 found = true;
                 send(pneigh[i], delta);
             if (pneigh[i]->get_load() <= get_load() - 2 * delta) {
                 found = true;
                 send(pneigh[i], delta);
-                DEBUG1("sent to %s", pneigh[i]->get_name());
+                XBT_DEBUG("sent to %s", pneigh[i]->get_name());
             }
         }
     }
             }
         }
     }
index 2d4103cb0f5139c0ffc93c220ed563fbe3470a81..3858acc3def5cdce168f93a3e8d3a3a0b54d46b6 100644 (file)
@@ -30,7 +30,7 @@ void loba_simple::load_balance()
     if (imin != -1) {
         // found someone
         double balance = (get_load() - max) / 2;
     if (imin != -1) {
         // found someone
         double balance = (get_load() - max) / 2;
-        DEBUG6("%d:%g %d:%g %g %g", imin, min, imax, max, get_load(), balance);
+        XBT_DEBUG("%d:%g %d:%g %g %g", imin, min, imax, max, get_load(), balance);
         send(pneigh[imin], balance);
     }
 }
         send(pneigh[imin], balance);
     }
 }
index fc42d750f9c992b8fe9a27b17f5aac7ec232b48c..dcefafcf3c2fdc83f8091e1a63ac38a91e34df56 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -87,31 +87,31 @@ static void check_for_lost_load()
     double lost = total_init - total_exit;
     double lost_ratio = 100.0 * lost / total_init;
     if (lost_ratio < -opt::load_ratio_threshold)
     double lost = total_init - total_exit;
     double lost_ratio = 100.0 * lost / total_init;
     if (lost_ratio < -opt::load_ratio_threshold)
-        CRITICAL2("Gained load at exit! %g (%g%%) <============",
-                  -lost, -lost_ratio);
+        XBT_CRITICAL("Gained load at exit! %g (%g%%) <============",
+                     -lost, -lost_ratio);
     else if (lost_ratio > opt::load_ratio_threshold)
     else if (lost_ratio > opt::load_ratio_threshold)
-        CRITICAL2("Lost load at exit! %g (%g%%) <============",
-                  lost, lost_ratio);
+        XBT_CRITICAL("Lost load at exit! %g (%g%%) <============",
+                     lost, lost_ratio);
     else
     else
-        VERB2("Total load at exit looks good: %g (%g%%)", lost, lost_ratio);
+        XBT_VERB("Total load at exit looks good: %g (%g%%)", lost, lost_ratio);
 
     double total_running = process::get_total_load_running();
     double running_ratio = 100.0 * total_running / total_init;
     if (running_ratio < -opt::load_ratio_threshold)
 
     double total_running = process::get_total_load_running();
     double running_ratio = 100.0 * total_running / total_init;
     if (running_ratio < -opt::load_ratio_threshold)
-        CRITICAL2("Negative running load at exit! %g (%g%%) <============",
-                  total_running, running_ratio);
+        XBT_CRITICAL("Negative running load at exit! %g (%g%%) <============",
+                     total_running, running_ratio);
     else if (running_ratio > opt::load_ratio_threshold)
     else if (running_ratio > opt::load_ratio_threshold)
-        CRITICAL2("Remaining running load at exit! %g (%g%%) <============",
-                  total_running, running_ratio);
+        XBT_CRITICAL("Remaining running load at exit! %g (%g%%) <============",
+                     total_running, running_ratio);
     else
     else
-        VERB2("Running load at exit looks good: %g (%g%%)",
-               total_running, running_ratio);
+        XBT_VERB("Running load at exit looks good: %g (%g%%)",
+                 total_running, running_ratio);
 }
 
 #define PR_STATS(descr, st)                                             \
 }
 
 #define PR_STATS(descr, st)                                             \
-    INFO5("| %.*s: %g / %g / %g", 39,                                   \
-          descr " total/avg./stddev. at exit.........................", \
-          st.get_sum(), st.get_mean(), st.get_stddev())
+    XBT_INFO("| %.*s: %g / %g / %g", 39,                                \
+             descr " total/avg./stddev. at exit.........................", \
+             st.get_sum(), st.get_mean(), st.get_stddev())
 
 int main(int argc, char* argv[])
 {
 
 int main(int argc, char* argv[])
 {
@@ -154,7 +154,7 @@ int main(int argc, char* argv[])
         MSG_clean();
         exit(parse_res ? EXIT_NO_FAILURE : EXIT_FAILURE_ARGS);
     }
         MSG_clean();
         exit(parse_res ? EXIT_NO_FAILURE : EXIT_FAILURE_ARGS);
     }
-    INFO3("%s v%s (%s)", opt::program_name.c_str(), version::num.c_str(),
+    XBT_INFO("%s v%s (%s)", opt::program_name.c_str(), version::num.c_str(),
           version::date.c_str());
     opt::print();
 
           version::date.c_str());
     opt::print();
 
@@ -172,8 +172,8 @@ int main(int argc, char* argv[])
             if (!opt::auto_depl::nhosts)
                 opt::auto_depl::nhosts = hostdata::size();
             if (opt::auto_depl::nhosts > hostdata::size()) {
             if (!opt::auto_depl::nhosts)
                 opt::auto_depl::nhosts = hostdata::size();
             if (opt::auto_depl::nhosts > hostdata::size()) {
-                WARN2("%u hosts is too much: limiting to %u",
-                      opt::auto_depl::nhosts, (unsigned )hostdata::size());
+                XBT_WARN("%u hosts is too much: limiting to %u",
+                         opt::auto_depl::nhosts, (unsigned )hostdata::size());
                 opt::auto_depl::nhosts = hostdata::size();
             }
             if (!opt::auto_depl::load)
                 opt::auto_depl::nhosts = hostdata::size();
             }
             if (!opt::auto_depl::load)
@@ -195,10 +195,10 @@ int main(int argc, char* argv[])
         proc_counter = 0;
 
         // Launch the MSG simulation.
         proc_counter = 0;
 
         // Launch the MSG simulation.
-        INFO1("Starting simulation at %f...", MSG_get_clock());
+        XBT_INFO("Starting simulation at %f...", MSG_get_clock());
         res = MSG_main();
         simulated_time = MSG_get_clock();
         res = MSG_main();
         simulated_time = MSG_get_clock();
-        INFO1("Simulation ended at %f.", simulated_time);
+        XBT_INFO("Simulation ended at %f.", simulated_time);
 
         xbt_cond_destroy(proc_cond);
         xbt_mutex_destroy(proc_mutex);
 
         xbt_cond_destroy(proc_cond);
         xbt_mutex_destroy(proc_mutex);
@@ -212,8 +212,8 @@ int main(int argc, char* argv[])
         int len = strlen(ex.msg);
         if (len > 0 && ex.msg[len - 1] == '\n')
             ex.msg[len - 1] = '\0'; // strip the ending '\n'
         int len = strlen(ex.msg);
         if (len > 0 && ex.msg[len - 1] == '\n')
             ex.msg[len - 1] = '\0'; // strip the ending '\n'
-        ERROR1("%s", ex.msg);
-        DEBUG3("Error from %s() in %s:%d", ex.func, ex.file, ex.line);
+        XBT_ERROR("%s", ex.msg);
+        XBT_DEBUG("Error from %s() in %s:%d", ex.func, ex.file, ex.line);
         xbt_ex_free(ex);
     }
 
         xbt_ex_free(ex);
     }
 
@@ -221,7 +221,7 @@ int main(int argc, char* argv[])
     hostdata::destroy();
     res = MSG_clean();
     if (res != MSG_OK) {
     hostdata::destroy();
     res = MSG_clean();
     if (res != MSG_OK) {
-        ERROR1("MSG_clean() failed with status %#x", res);
+        XBT_ERROR("MSG_clean() failed with status %#x", res);
         exit_status |= EXIT_FAILURE_CLEAN;
     }
 
         exit_status |= EXIT_FAILURE_CLEAN;
     }
 
@@ -229,18 +229,19 @@ int main(int argc, char* argv[])
     if (simulated_time >= 0.0) {
         simulation_time.stop();
         check_for_lost_load();
     if (simulated_time >= 0.0) {
         simulation_time.stop();
         check_for_lost_load();
-        INFO0(",----[ Results ]");
+        XBT_INFO(",----[ Results ]");
         PR_STATS("Load", loads);
         PR_STATS("Computation", comps);
         PR_STATS("Load", loads);
         PR_STATS("Computation", comps);
-        INFO1("| Total simulated time...................: %g", simulated_time);
-        INFO1("| Total simulation time..................: %g",
-              simulation_time.duration());
-        INFO0("`----");
+        XBT_INFO("| Total simulated time...................: %g",
+                 simulated_time);
+        XBT_INFO("| Total simulation time..................: %g",
+                 simulation_time.duration());
+        XBT_INFO("`----");
     }
     if (exit_status)
     }
     if (exit_status)
-        ERROR1("Simulation failed (%#x).", exit_status);
+        XBT_ERROR("Simulation failed (%#x).", exit_status);
     else
     else
-        INFO0("Simulation succeeded.");
+        XBT_INFO("Simulation succeeded.");
 
     return exit_status;
 }
 
     return exit_status;
 }
index 752378312ef2a4ee0fad36cefdb89e221aba8bfd..266f516ac056a0d9d47770fa7eb9227ca60e8ff2 100644 (file)
@@ -23,8 +23,8 @@ void neighbor::print(bool verbose,
                      e_xbt_log_priority_t logp, xbt_log_category_t cat) const
 {
     if (verbose)
                      e_xbt_log_priority_t logp, xbt_log_category_t cat) const
 {
     if (verbose)
-        XCLOG4(cat, logp, "%s: load = %g ; debt = %g ; to_send = %g",
-              get_name(), get_load(), get_debt(), get_to_send());
+        XBT_XCLOG(cat, logp, "%s: load = %g ; debt = %g ; to_send = %g",
+                  get_name(), get_load(), get_debt(), get_to_send());
     else
     else
-        XCLOG2(cat, logp, "%s: load = %g", get_name(), get_load());
+        XBT_XCLOG(cat, logp, "%s: load = %g", get_name(), get_load());
 }
 }
index 96b53e0ae9c14a4e7bd30f073c3f53c13260e69d..85c21306070f51d7b9a3fd876874dcb0ee947726 100644 (file)
@@ -12,6 +12,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(main);
 #include "loba_simple.h"
 #include "loba_fairstrategy.h"
 #include "loba_makhoul.h"
 #include "loba_simple.h"
 #include "loba_fairstrategy.h"
 #include "loba_makhoul.h"
+#include "misc.h"
 
 #include "options.h"
 
 
 #include "options.h"
 
@@ -150,18 +151,18 @@ bool opt_helper::nol_find_prefix(const T& nol, const char* descr,
         }
         switch (candidates.size()) {
         case 0:
         }
         switch (candidates.size()) {
         case 0:
-            ERROR2("unknownw %s -- %s", descr, name.c_str());
+            XBT_ERROR("unknownw %s -- %s", descr, name.c_str());
             break;
         case 1:
             name = candidates.top();
             candidates.pop();
             result = true;
             break;
         case 1:
             name = candidates.top();
             candidates.pop();
             result = true;
-            DEBUG2("infered %s -- %s", descr, name.c_str());
+            XBT_DEBUG("infered %s -- %s", descr, name.c_str());
             break;
         default:
             break;
         default:
-            ERROR2("ambiguous %s -- %s", descr, name.c_str());
+            XBT_ERROR("ambiguous %s -- %s", descr, name.c_str());
             while (!candidates.empty()) {
             while (!candidates.empty()) {
-                ERROR1("  candidates are -- %s", candidates.top().c_str());
+                XBT_ERROR("  candidates are -- %s", candidates.top().c_str());
                 candidates.pop();
             }
             break;
                 candidates.pop();
             }
             break;
@@ -238,7 +239,7 @@ bool opt::parse_args(int* argc, char* argv[])
             opt::version_requested = true;
             break;
         case '?':
             opt::version_requested = true;
             break;
         case '?':
-            ERROR1("invalid option -- '%c'", optopt);
+            XBT_ERROR("invalid option -- '%c'", optopt);
             result = false;
             break;
         }
             result = false;
             break;
         }
@@ -250,7 +251,7 @@ bool opt::parse_args(int* argc, char* argv[])
     if (optind < *argc) {
         opt::platform_file = argv[optind++];
     } else {
     if (optind < *argc) {
         opt::platform_file = argv[optind++];
     } else {
-        ERROR0("missing parameter -- <plaform_file>");
+        XBT_ERROR("missing parameter -- <plaform_file>");
         result = false;
     }
     if (optind < *argc) {
         result = false;
     }
     if (optind < *argc) {
@@ -259,7 +260,7 @@ bool opt::parse_args(int* argc, char* argv[])
     opt::auto_depl::enabled = opt::deployment_file.empty();
 
     while (optind < *argc) {
     opt::auto_depl::enabled = opt::deployment_file.empty();
 
     while (optind < *argc) {
-        ERROR1("unused parameter -- \"%s\"", argv[optind++]);
+        XBT_ERROR("unused parameter -- \"%s\"", argv[optind++]);
         result = false;
     }
 
         result = false;
     }
 
@@ -271,13 +272,13 @@ void opt::print()
     opt_helper h;
 
 #define DESCR(description, format, value) \
     opt_helper h;
 
 #define DESCR(description, format, value) \
-    INFO2("| %s: " format, h.descr(description), value)
+    XBT_INFO("| %s: " format, h.descr(description), value)
 
 
-    INFO0(",----[ Simulation parameters ]");
+    XBT_INFO(",----[ Simulation parameters ]");
     DESCR("log rate", "%s", h.val_or_string(log_rate, "disabled"));
     DESCR("platform file", "\"%s\"", platform_file.c_str());
     if (auto_depl::enabled) {
     DESCR("log rate", "%s", h.val_or_string(log_rate, "disabled"));
     DESCR("platform file", "\"%s\"", platform_file.c_str());
     if (auto_depl::enabled) {
-        INFO0("| automatic deployment enabled");
+        XBT_INFO("| automatic deployment enabled");
         DESCR("- topology", "%s", auto_depl::topology.c_str());
         DESCR("- number of hosts", "%s", h.val_or_string(auto_depl::nhosts,
                                                          "auto"));
         DESCR("- topology", "%s", auto_depl::topology.c_str());
         DESCR("- number of hosts", "%s", h.val_or_string(auto_depl::nhosts,
                                                          "auto"));
@@ -297,7 +298,7 @@ void opt::print()
           h.val_or_string(comp_maxiter, "infinity"));
     DESCR("time limit", "%s", h.val_or_string(time_limit, "infinity"));
     DESCR("exit on close", "%s", h.on_off(exit_on_close));
           h.val_or_string(comp_maxiter, "infinity"));
     DESCR("time limit", "%s", h.val_or_string(time_limit, "infinity"));
     DESCR("exit on close", "%s", h.on_off(exit_on_close));
-    INFO0("`----");
+    XBT_INFO("`----");
 
 #undef DESCR
 }
 
 #undef DESCR
 }
index 57c06612ad84bb9cffaa07123e8c113b0148fad9..4501dab9517d1290415c0a1c6223d50805badfcd 100644 (file)
@@ -58,7 +58,7 @@ process::process(int argc, char* argv[])
                        std::tr1::mem_fn(&neighbor::get_name));
         oss << neigh.back().get_name();
     }
                        std::tr1::mem_fn(&neighbor::get_name));
         oss << neigh.back().get_name();
     }
-    LOG1(logp, "Got %s.", oss.str().c_str());
+    XBT_LOG(logp, "Got %s.", oss.str().c_str());
     print_loads(false, logp);
 }
 
     print_loads(false, logp);
 }
 
@@ -66,23 +66,23 @@ process::~process()
 {
     total_load_exit += real_load;
     if (opt::bookkeeping) {
 {
     total_load_exit += real_load;
     if (opt::bookkeeping) {
-        INFO4("Final load after %d:%d iterations: %g ; expected: %g",
-              lb_iter, comp_iter, real_load, expected_load);
+        XBT_INFO("Final load after %d:%d iterations: %g ; expected: %g",
+                 lb_iter, comp_iter, real_load, expected_load);
     } else {
     } else {
-        INFO2("Final load after %d iterations: %g",
-              lb_iter, real_load);
+        XBT_INFO("Final load after %d iterations: %g",
+                 lb_iter, real_load);
         if (lb_iter != comp_iter)
         if (lb_iter != comp_iter)
-            WARN2("lb_iter (%d) and comp_iter (%d) differ!",
-                  lb_iter, comp_iter);
+            XBT_WARN("lb_iter (%d) and comp_iter (%d) differ!",
+                     lb_iter, comp_iter);
     }
     }
-    VERB1("Total computation for this process: %g", comp);
+    XBT_VERB("Total computation for this process: %g", comp);
 }
 
 int process::run()
 {
     double next_iter_after_date = 0.0;
 }
 
 int process::run()
 {
     double next_iter_after_date = 0.0;
-    INFO1("Initial load: %g", real_load);
-    VERB0("Starting...");
+    XBT_INFO("Initial load: %g", real_load);
+    XBT_VERB("Starting...");
     while (true) {
         if (get_load() > 0.0) {
             double now = MSG_get_clock();
     while (true) {
         if (get_load() > 0.0) {
             double now = MSG_get_clock();
@@ -94,11 +94,11 @@ int process::run()
 
             if (opt::log_rate && lb_iter % opt::log_rate == 0) {
                 if (opt::bookkeeping)
 
             if (opt::log_rate && lb_iter % opt::log_rate == 0) {
                 if (opt::bookkeeping)
-                    INFO4("(%u:%u) current load: %g ; expected: %g",
-                          lb_iter, comp_iter, real_load, expected_load);
+                    XBT_INFO("(%u:%u) current load: %g ; expected: %g",
+                             lb_iter, comp_iter, real_load, expected_load);
                 else
                 else
-                    INFO2("(%u) current load: %g",
-                          lb_iter, real_load);
+                    XBT_INFO("(%u) current load: %g",
+                             lb_iter, real_load);
             }
 
             load_balance();
             }
 
             load_balance();
@@ -114,15 +114,15 @@ int process::run()
         }
 
         if (opt::lb_maxiter && lb_iter >= opt::lb_maxiter) {
         }
 
         if (opt::lb_maxiter && lb_iter >= opt::lb_maxiter) {
-            VERB2("Reached lb_maxiter: %d/%d", lb_iter, opt::lb_maxiter);
+            XBT_VERB("Reached lb_maxiter: %d/%d", lb_iter, opt::lb_maxiter);
             break;
         }
         if (opt::comp_maxiter && comp_iter >= opt::comp_maxiter) {
             break;
         }
         if (opt::comp_maxiter && comp_iter >= opt::comp_maxiter) {
-            VERB2("Reached comp_maxiter: %d/%d", comp_iter, opt::comp_maxiter);
+            XBT_VERB("Reached comp_maxiter: %d/%d", comp_iter, opt::comp_maxiter);
             break;
         }
         if (opt::time_limit && MSG_get_clock() >= opt::time_limit) {
             break;
         }
         if (opt::time_limit && MSG_get_clock() >= opt::time_limit) {
-            VERB2("Reached time limit: %g/%g", MSG_get_clock(), opt::time_limit);
+            XBT_VERB("Reached time limit: %g/%g", MSG_get_clock(), opt::time_limit);
             break;
         }
 
             break;
         }
 
@@ -139,13 +139,13 @@ int process::run()
 
         // one of our neighbor is finalizing
         if (opt::exit_on_close && close_received) {
 
         // one of our neighbor is finalizing
         if (opt::exit_on_close && close_received) {
-            VERB0("Close received");
+            XBT_VERB("Close received");
             break;
         }
 
         // have no load and cannot receive anything
         if (real_load == 0.0 && !may_receive()) {
             break;
         }
 
         // have no load and cannot receive anything
         if (real_load == 0.0 && !may_receive()) {
-            VERB0("I'm a poor lonesome process, and I have no load...");
+            XBT_VERB("I'm a poor lonesome process, and I have no load...");
             break;
         }
 
             break;
         }
 
@@ -154,13 +154,13 @@ int process::run()
         // fixme: should this chunk be moved before call to receive() ?
         if (100.0 * total_load_running / total_load_init <=
             opt::load_ratio_threshold) {
         // fixme: should this chunk be moved before call to receive() ?
         if (100.0 * total_load_running / total_load_init <=
             opt::load_ratio_threshold) {
-            VERB0("No more load to balance in system.");
+            XBT_VERB("No more load to balance in system.");
             break;
         } else {
             break;
         } else {
-            DEBUG1("still %g load to balance, continuing...", total_load_running);
+            XBT_DEBUG("still %g load to balance, continuing...", total_load_running);
         }
     }
         }
     }
-    VERB0("Going to finalize...");
+    XBT_VERB("Going to finalize...");
     finalize();
 
     /* Open Questions :
     finalize();
 
     /* Open Questions :
@@ -169,14 +169,14 @@ int process::run()
      * - how to manage link failures ?
      */
 
      * - how to manage link failures ?
      */
 
-    VERB0("Done.");
+    XBT_VERB("Done.");
     return 0;
 }
 
 void process::load_balance()
 {
     if (lb_iter == 1)           // warn only once
     return 0;
 }
 
 void process::load_balance()
 {
     if (lb_iter == 1)           // warn only once
-        WARN0("process::load_balance() is a no-op!");
+        XBT_WARN("process::load_balance() is a no-op!");
 }
 
 void process::compute()
 }
 
 void process::compute()
@@ -185,12 +185,12 @@ void process::compute()
         double flops = opt::comp_cost(real_load);
         m_task_t task = MSG_task_create("computation", flops, 0.0, NULL);
         TRACE_msg_set_task_category(task, TRACE_CAT_COMP);
         double flops = opt::comp_cost(real_load);
         m_task_t task = MSG_task_create("computation", flops, 0.0, NULL);
         TRACE_msg_set_task_category(task, TRACE_CAT_COMP);
-        DEBUG2("compute %g flop%s", flops, ESSE(flops));
+        XBT_DEBUG("compute %g flop%s", flops, ESSE(flops));
         MSG_task_execute(task);
         comp += flops;
         MSG_task_destroy(task);
     } else {
         MSG_task_execute(task);
         comp += flops;
         MSG_task_destroy(task);
     } else {
-        DEBUG0("nothing to compute !");
+        XBT_DEBUG("nothing to compute !");
     }
 }
 
     }
 }
 
@@ -263,7 +263,7 @@ void process::receive(double timeout)
     message* msg;
     m_host_t from;
 
     message* msg;
     m_host_t from;
 
-    DEBUG2("%sblocking receive (%g)", "\0non-" + !timeout, timeout);
+    XBT_DEBUG("%sblocking receive (%g)", "\0non-" + !timeout, timeout);
     while (may_receive() && comm.recv(msg, from, timeout)) {
         switch (msg->get_type()) {
         case message::INFO: {
     while (may_receive() && comm.recv(msg, from, timeout)) {
         switch (msg->get_type()) {
         case message::INFO: {
@@ -310,15 +310,15 @@ void process::finalize()
     finalizing = true;
     total_load_running -= real_load;
 
     finalizing = true;
     total_load_running -= real_load;
 
-    DEBUG2("send CLOSE to %lu neighbor%s",
-           (unsigned long )neigh.size(), ESSE(neigh.size()));
+    XBT_DEBUG("send CLOSE to %lu neighbor%s",
+              (unsigned long )neigh.size(), ESSE(neigh.size()));
     std::for_each(neigh.begin(), neigh.end(),
                   bind(&process::finalize1, this, _1));
 
     while (may_receive()) {
         comm.flush(false);
     std::for_each(neigh.begin(), neigh.end(),
                   bind(&process::finalize1, this, _1));
 
     while (may_receive()) {
         comm.flush(false);
-        DEBUG2("waiting for %d CTRL and %d DATA CLOSE",
-               ctrl_close_pending, data_close_pending);
+        XBT_DEBUG("waiting for %d CTRL and %d DATA CLOSE",
+                  ctrl_close_pending, data_close_pending);
         receive(-1.0);
     }
 
         receive(-1.0);
     }
 
@@ -329,7 +329,7 @@ void process::finalize()
     if (_XBT_LOG_ISENABLEDV((*cat), logp)) {                            \
         using std::tr1::bind;                                           \
         using std::tr1::placeholders::_1;                               \
     if (_XBT_LOG_ISENABLEDV((*cat), logp)) {                            \
         using std::tr1::bind;                                           \
         using std::tr1::placeholders::_1;                               \
-        XCLOG0(cat, logp, "Neighbor loads:");                           \
+        XBT_XCLOG(cat, logp, "Neighbor loads:");                        \
         std::for_each(vec.begin(), vec.end(),                           \
                       bind(&neighbor::print, _1, verbose, logp, cat));  \
     } else ((void)0)
         std::for_each(vec.begin(), vec.end(),                           \
                       bind(&neighbor::print, _1, verbose, logp, cat));  \
     } else ((void)0)
index 24d4c395668b2d4209abaf6ddc5b4ebf8c315aa0..86f1f9b40b76eff8478615b81fb2c358a5187542 100644 (file)
--- a/process.h
+++ b/process.h
@@ -15,6 +15,7 @@
 #include <msg/msg.h>
 #include <xbt/log.h>
 #include "communicator.h"
 #include <msg/msg.h>
 #include <xbt/log.h>
 #include "communicator.h"
+#include "misc.h"
 #include "neighbor.h"
 #include "options.h"
 
 #include "neighbor.h"
 #include "options.h"
 
index 8e04ba94ce9774a3d90a29e403e9175c448f851c..c4d33e485e7e43bde270e6f5a0d22336a7bf3d44 100644 (file)
@@ -2,6 +2,7 @@
 #include <cstdio>               // sprintf
 #include <time.h>               // clock()
 #include <msg/msg.h>
 #include <cstdio>               // sprintf
 #include <time.h>               // clock()
 #include <msg/msg.h>
+#define XBT_LOG_OLD_STYLE
 #include <xbt/log.h>
 #include "simgrid_features.h"
 
 #include <xbt/log.h>
 #include "simgrid_features.h"