summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6fcbb4a)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7255
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
#include "xbt.h" /* calloc, printf */
#include "simgrid_config.h" /* getline */
#include "xbt.h" /* calloc, printf */
#include "simgrid_config.h" /* getline */
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+XBT_LOG_NEW_DEFAULT_CATEGORY(actions,
"Messages specific for this msg example");
int communicator_size=0;
"Messages specific for this msg example");
int communicator_size=0;
/* My actions */
static void send(xbt_dynar_t action)
{
/* My actions */
static void send(xbt_dynar_t action)
{
- char *name = xbt_str_join(action, " ");
char to[250];
char *size = xbt_dynar_get_as(action, 3, char *);
double clock = MSG_get_clock();
sprintf (to,"%s_%s", MSG_process_get_name(MSG_process_self()),
xbt_dynar_get_as(action, 2, char *));
// char *to = xbt_dynar_get_as(action, 2, char *);
char to[250];
char *size = xbt_dynar_get_as(action, 3, char *);
double clock = MSG_get_clock();
sprintf (to,"%s_%s", MSG_process_get_name(MSG_process_self()),
xbt_dynar_get_as(action, 2, char *));
// char *to = xbt_dynar_get_as(action, 2, char *);
+
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ name = xbt_str_join(action, " ");
+
DEBUG2("Entering Send: %s (size: %lg)", name, parse_double(size));
MSG_task_send(MSG_task_create(name, 0, parse_double(size), NULL), to);
DEBUG2("%s %f", name, MSG_get_clock()-clock);
DEBUG2("Entering Send: %s (size: %lg)", name, parse_double(size));
MSG_task_send(MSG_task_create(name, 0, parse_double(size), NULL), to);
DEBUG2("%s %f", name, MSG_get_clock()-clock);
+
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ free(name);
static void recv(xbt_dynar_t action)
{
static void recv(xbt_dynar_t action)
{
- char *name = xbt_str_join(action, " ");
char mailbox_name[250];
m_task_t task = NULL;
double clock = MSG_get_clock();
char mailbox_name[250];
m_task_t task = NULL;
double clock = MSG_get_clock();
//char *from=xbt_dynar_get_as(action,2,char*);
sprintf (mailbox_name,"%s_%s", xbt_dynar_get_as(action, 2, char *),
MSG_process_get_name(MSG_process_self()));
//char *from=xbt_dynar_get_as(action,2,char*);
sprintf (mailbox_name,"%s_%s", xbt_dynar_get_as(action, 2, char *),
MSG_process_get_name(MSG_process_self()));
+
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ name = xbt_str_join(action, " ");
+
DEBUG1("Receiving: %s", name);
MSG_task_receive(&task, mailbox_name);
// MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
DEBUG2("%s %f", name, MSG_get_clock()-clock);
MSG_task_destroy(task);
DEBUG1("Receiving: %s", name);
MSG_task_receive(&task, mailbox_name);
// MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
DEBUG2("%s %f", name, MSG_get_clock()-clock);
MSG_task_destroy(task);
+
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ free(name);
}
static int spawned_recv(int argc, char *argv[])
}
static int spawned_recv(int argc, char *argv[])
static void Irecv(xbt_dynar_t action)
{
static void Irecv(xbt_dynar_t action)
{
- char *name = xbt_str_join(action, " ");
m_process_t comm_helper;
char mailbox_name[250];
char **myargv;
m_process_t comm_helper;
char mailbox_name[250];
char **myargv;
sprintf (mailbox_name,"%s_%s", xbt_dynar_get_as(action, 2, char *),
MSG_process_get_name(MSG_process_self()));
sprintf (mailbox_name,"%s_%s", xbt_dynar_get_as(action, 2, char *),
MSG_process_get_name(MSG_process_self()));
- sprintf(name,"%s_wait",MSG_process_get_name(MSG_process_self()));
+ name = bprintf("%s_wait",MSG_process_get_name(MSG_process_self()));
myargv = (char**) calloc (2, sizeof (char*));
myargv[0] = xbt_strdup(mailbox_name);
myargv = (char**) calloc (2, sizeof (char*));
myargv[0] = xbt_strdup(mailbox_name);
1, myargv);
DEBUG2("%s %f", xbt_str_join(action, " "),
1, myargv);
DEBUG2("%s %f", xbt_str_join(action, " "),
- MSG_get_clock()-clock);
+ MSG_get_clock()-clock);
static void wait_action(xbt_dynar_t action)
{
static void wait_action(xbt_dynar_t action)
{
- char *name = xbt_str_join(action, " ");
char task_name[80];
m_task_t task = NULL;
double clock = MSG_get_clock();
char task_name[80];
m_task_t task = NULL;
double clock = MSG_get_clock();
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ name = xbt_str_join(action, " ");
+
DEBUG1("Entering %s", name);
sprintf(task_name,"%s_wait",MSG_process_get_name(MSG_process_self()));
DEBUG1("wait: %s", task_name);
MSG_task_receive(&task,task_name);
MSG_task_destroy(task);
DEBUG2("%s %f", name, MSG_get_clock()-clock);
DEBUG1("Entering %s", name);
sprintf(task_name,"%s_wait",MSG_process_get_name(MSG_process_self()));
DEBUG1("wait: %s", task_name);
MSG_task_receive(&task,task_name);
MSG_task_destroy(task);
DEBUG2("%s %f", name, MSG_get_clock()-clock);
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ free(name);
}
static void barrier (xbt_dynar_t action)
{
}
static void barrier (xbt_dynar_t action)
{
- char *name = xbt_str_join(action, " ");
+ char *name = NULL;
+
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ name = xbt_str_join(action, " ");
+
DEBUG1("barrier: %s", name);
DEBUG1("barrier: %s", name);
+ THROW_UNIMPLEMENTED;
+
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ free(name);
static void sleep(xbt_dynar_t action)
{
static void sleep(xbt_dynar_t action)
{
- char *name = xbt_str_join(action, " ");
char *duration = xbt_dynar_get_as(action, 2, char *);
double clock = MSG_get_clock();
char *duration = xbt_dynar_get_as(action, 2, char *);
double clock = MSG_get_clock();
+
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ name = xbt_str_join(action, " ");
+
DEBUG1("Entering %s", name);
MSG_process_sleep(parse_double(duration));
DEBUG2("%s %f ", name, MSG_get_clock()-clock);
DEBUG1("Entering %s", name);
MSG_process_sleep(parse_double(duration));
DEBUG2("%s %f ", name, MSG_get_clock()-clock);
+
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ free(name);
}
static void allReduce(xbt_dynar_t action)
}
static void allReduce(xbt_dynar_t action)
static void compute(xbt_dynar_t action)
{
static void compute(xbt_dynar_t action)
{
- char *name = xbt_str_join(action, " ");
char *amout = xbt_dynar_get_as(action, 2, char *);
m_task_t task = MSG_task_create(name, parse_double(amout), 0, NULL);
double clock = MSG_get_clock();
char *amout = xbt_dynar_get_as(action, 2, char *);
m_task_t task = MSG_task_create(name, parse_double(amout), 0, NULL);
double clock = MSG_get_clock();
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ name = xbt_str_join(action, " ");
DEBUG1("Entering %s", name);
MSG_task_execute(task);
MSG_task_destroy(task);
DEBUG2("%s %f", name, MSG_get_clock()-clock);
DEBUG1("Entering %s", name);
MSG_task_execute(task);
MSG_task_destroy(task);
DEBUG2("%s %f", name, MSG_get_clock()-clock);
+ if (XBT_LOG_ISENABLED(actions,xbt_log_priority_debug))
+ free(name);