From 154e14a116d8937ffbab194594ba2b744fcc4330 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Fri, 21 Jan 2011 16:57:04 +0100 Subject: [PATCH 1/1] Experimental tracing support. --- communicator.cpp | 4 ++++ main.cpp | 6 ++++++ process.cpp | 2 ++ tracing.h | 12 ++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 tracing.h diff --git a/communicator.cpp b/communicator.cpp index 90cf990..7784a48 100644 --- a/communicator.cpp +++ b/communicator.cpp @@ -9,6 +9,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(comm); #include "misc.h" #include "options.h" +#include "tracing.h" #include "communicator.h" @@ -79,6 +80,9 @@ void communicator::send(const char* dest, message* msg) if (msg->get_type() == message::LOAD) msg_size += opt::comm_cost(msg->get_amount()); m_task_t task = MSG_task_create("message", 0.0, msg_size, msg); + TRACE_msg_set_task_category(task, + msg->get_type() == message::LOAD ? + TRACE_CAT_DATA : TRACE_CAT_CTRL); msg_comm_t comm = MSG_task_isend(task, dest); sent_comm.push_back(comm); } diff --git a/main.cpp b/main.cpp index 92e4882..b5ab711 100644 --- a/main.cpp +++ b/main.cpp @@ -25,6 +25,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(main); #include "options.h" #include "process.h" #include "timer.h" +#include "tracing.h" #include "version.h" namespace { @@ -196,6 +197,11 @@ int main(int argc, char* argv[]) MSG_launch_application(opt::deployment_file.c_str()); } + // Register tracing categories + TRACE_category(TRACE_CAT_COMP); + TRACE_category(TRACE_CAT_CTRL); + TRACE_category(TRACE_CAT_DATA); + exit_status = EXIT_FAILURE_SIMU; // ===== // Launch the MSG simulation. diff --git a/process.cpp b/process.cpp index 80fd618..03c1734 100644 --- a/process.cpp +++ b/process.cpp @@ -11,6 +11,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(proc); #include "misc.h" #include "options.h" +#include "tracing.h" #include "process.h" @@ -196,6 +197,7 @@ void process::compute() if (load > 0.0) { double flops = opt::comp_cost(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)); MSG_task_execute(task); comp += flops; diff --git a/tracing.h b/tracing.h new file mode 100644 index 0000000..f283465 --- /dev/null +++ b/tracing.h @@ -0,0 +1,12 @@ +#ifndef TRACING_H +#define TRACING_H + +#define TRACE_CAT_COMP "comp_task" +#define TRACE_CAT_CTRL "ctrl_mesg" +#define TRACE_CAT_DATA "data_mesg" + +#endif // !TRACING_H + +// Local variables: +// mode: c++ +// End: -- 2.39.5