amok_pm_init();
mysock = gras_socket_server_range(3000, 9999, 0, 0);
- INFO1("Sensor starting (on port %d)", gras_os_myport());
+ XBT_INFO("Sensor starting (on port %d)", gras_os_myport());
while (connection_try > 0 && master == NULL) {
int connected = 0;
TRY {
amok_bw_init();
amok_pm_init();
- INFO0("Maestro starting");
+ XBT_INFO("Maestro starting");
if (argc != 2) {
- ERROR0("Usage: maestro port\n");
+ XBT_ERROR("Usage: maestro port\n");
return 1;
}
mysock = gras_socket_server(atoi(argv[1]));
group = amok_pm_group_new("bandwidth");
- INFO0("Wait for peers for 5 sec");
+ XBT_INFO("Wait for peers for 5 sec");
gras_msg_handleall(5); /* friends, we're ready. Come and play */
if (xbt_dynar_length(group) < 2) {
h2 = h_temp;
}
- INFO2("Contact %s:%d", h1->name, h1->port);
+ XBT_INFO("Contact %s:%d", h1->name, h1->port);
peer = gras_socket_client(h1->name, h1->port);
- INFO0("Test the BW between me and one of the sensors");
+ XBT_INFO("Test the BW between me and one of the sensors");
amok_bw_test(peer, buf_size, msg_size, msg_amount, min_duration, &sec,
&bw);
- INFO7
+ XBT_INFO
("Experience between me and %s:%d (initially %d msgs of %d bytes, maybe modified to fill the pipe at least %.1fs) took %f sec, achieving %f kb/s",
h1->name, h1->port, msg_amount, msg_size, min_duration, sec,
((double) bw) / 1024.0);
- INFO4("Test the BW between %s:%d and %s:%d", h1->name, h1->port,
+ XBT_INFO("Test the BW between %s:%d and %s:%d", h1->name, h1->port,
h2->name, h2->port);
amok_bw_request(h1->name, h1->port, h2->name, h2->port, buf_size,
msg_size, msg_amount, min_duration, &sec, &bw);
- INFO6
+ XBT_INFO
("Experience between %s:%d and %s:%d took took %f sec, achieving %f kb/s",
h1->name, h1->port, h2->name, h2->port, sec,
((double) bw) / 1024.0);
xbt_host_t host = xbt_new(s_xbt_host_t, 1);
host->name = strdup(argv[i]);
host->port = atoi(argv[i + 1]);
- INFO2("New sensor: %s:%d", host->name, host->port);
+ XBT_INFO("New sensor: %s:%d", host->name, host->port);
xbt_dynar_push(hosts, &host);
}
nb_hosts = xbt_dynar_length(hosts);
- INFO0(">>> start Test1: ENV end to end mesurements");
+ XBT_INFO(">>> start Test1: ENV end to end mesurements");
xbt_dynar_foreach(hosts, i, h1) {
peer = gras_socket_client(h1->name, h1->port);
amok_bw_test(peer, buf_size, exp_size, msg_size, min_duration, &sec,
&bw);
- INFO6
+ XBT_INFO
("Bandwidth between me and %s:%d (%d bytes in msgs of %d bytes) took %f sec, achieving %.3f kb/s",
h1->name, h1->port, exp_size, msg_size, sec,
((double) bw) / 1024.0);
/* wait to ensure that all server sockets are there before starting the experiment */
gras_os_sleep(0.5);
- INFO1(">>>>>< le maestro est: %s ", argv[0]);
+ XBT_INFO(">>>>>< le maestro est: %s ", argv[0]);
/* Get the sensor location from argc/argv */
for (i = 1; i < argc - 1; i += 2) {
xbt_host_t host = xbt_new(s_xbt_host_t, 1);
host->name = strdup(argv[i]);
host->port = atoi(argv[i + 1]);
- INFO2("New sensor: %s:%d", host->name, host->port);
+ XBT_INFO("New sensor: %s:%d", host->name, host->port);
xbt_dynar_push(hosts, &host);
}
nb_hosts = xbt_dynar_length(hosts);
- INFO0(">>> start Test2: ENV pairwise host bandwidth mesurements");
+ XBT_INFO(">>> start Test2: ENV pairwise host bandwidth mesurements");
xbt_dynar_foreach(hosts, i, h1) {
TRY {
peer = gras_socket_client(h2->name, h2->port);
amok_bw_test(peer, buf_size, exp_size, msg_size, min_duration, &sec,
&bw);
- INFO6
+ XBT_INFO
("Bandwidth between me and %s // measurement between me and %s (%d bytes in msgs of %d bytes) took %f sec, achieving %.3f kb/s",
h2->name, h1->name, exp_size, msg_size, sec,
((double) bw) / 1024.0);
amok_pm_init();
mysock = gras_socket_server_range(3000, 9999, 0, 0);
- INFO1("Sensor starting (on port %d)", gras_os_myport());
+ XBT_INFO("Sensor starting (on port %d)", gras_os_myport());
gras_os_sleep(2); /* let the master get ready */
master = gras_socket_client_from_string(argv[1]);
/* Test BW without saturation */
amok_bw_request(bw1, 4000, bw2, 4000,
buf_size, msg_size, msg_amount, min_duration, &sec, &bw);
- INFO4("BW(%s,%s) => %f sec, achieving %f Mb/s",
+ XBT_INFO("BW(%s,%s) => %f sec, achieving %f Mb/s",
bw1, bw2, sec, (bw / 1024.0 / 1024.0));
amok_bw_request(bw1, 4000, bw2, 4000,
buf_size, msg_size, msg_amount, min_duration, &sec_sat,
&bw_sat);
- INFO6("BW(%s,%s//%s,%s) => %f sec, achieving %f Mb/s", bw1, bw2, sat1,
+ XBT_INFO("BW(%s,%s//%s,%s) => %f sec, achieving %f Mb/s", bw1, bw2, sat1,
sat2, sec, bw / 1024.0 / 1024.0);
amok_bw_saturate_stop(sat1, 4000, NULL, NULL);
if (bw_sat / bw < 0.7) {
- INFO0("THERE IS SOME INTERFERENCE !!!");
+ XBT_INFO("THERE IS SOME INTERFERENCE !!!");
}
if (bw / bw_sat < 0.7) {
- INFO0("THERE IS SOME INTERFERENCE (and I'm an idiot) !!!");
+ XBT_INFO("THERE IS SOME INTERFERENCE (and I'm an idiot) !!!");
}
return bw_sat / bw;
}
xbt_dynar_get_cpy(peers, 1, &h2);
/* Start saturation */
- INFO4("Start saturation between %s:%d and %s:%d",
+ XBT_INFO("Start saturation between %s:%d and %s:%d",
h1->name, h1->port, h2->name, h2->port);
amok_bw_saturate_start(h1->name, h1->port, h2->name, h2->port, 0, /* Be a nice boy, compute msg_size yourself */
30 /* 5 sec timeout */ );
/* Stop it after a while */
- INFO0("Have a rest");
+ XBT_INFO("Have a rest");
gras_os_sleep(1);
TRY {
- INFO0("Stop the saturation");
+ XBT_INFO("Stop the saturation");
amok_bw_saturate_stop(h1->name, h1->port, &duration, &bw);
}
CATCH(e) {
- INFO0("Ooops, stoping the saturation raised an exception");
+ XBT_INFO("Ooops, stoping the saturation raised an exception");
xbt_ex_free(e);
}
- INFO2("Saturation took %.2fsec, achieving %fb/s", duration, bw);
+ XBT_INFO("Saturation took %.2fsec, achieving %fb/s", duration, bw);
/* Game is over, friends */
amok_pm_group_shutdown("saturate");
gras_msg_handle(60);
nb_peers = xbt_dynar_length(peers);
- INFO0("Let's go for the bw_matrix");
+ XBT_INFO("Let's go for the bw_matrix");
/* Do the test without saturation */
begin = time(NULL);
bw = amok_bw_matrix(peers, buf_size, msg_size, msg_amount, min_duration);
- INFO2("Did all BW tests in %ld sec (%.2f simulated(?) sec)",
+ XBT_INFO("Did all BW tests in %ld sec (%.2f simulated(?) sec)",
(long int) (time(NULL) - begin), gras_os_time() - begin_simulated);
/* Do the test with saturation */
if (i == l || j == l || k == l)
continue;
- VERB4("TEST %s %s // %s %s",
+ XBT_VERB("TEST %s %s // %s %s",
h1->name, h2->name, h3->name, h4->name);
amok_bw_request(h3->name, h3->port, h4->name, h4->port,
buf_size, msg_size, msg_amount, min_duration,
NULL, &(bw_sat[k * nb_peers + l]));
ratio = bw_sat[k * nb_peers + l] / bw[k * nb_peers + l];
- INFO8("SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s",
+ XBT_INFO("SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s",
h1->name, h2->name, h3->name, h4->name,
ratio,
bw[k * nb_peers + l], bw_sat[k * nb_peers + l],
}
amok_bw_saturate_stop(h1->name, h1->port, &time1, &bw1);
- INFO2
+ XBT_INFO
("Did an iteration on saturation pair in %ld sec (%.2f simulated sec)",
(long int) (time(NULL) - begin),
gras_os_time() - begin_simulated);
- INFO2
+ XBT_INFO
("the duration of the experiment >>>>> %.3f sec (%.3f bandwidth)",
time1, bw1);
}
mysock = gras_socket_server(myport);
/* Get the data */
- INFO2("Listening on port %d (expecting %d messages)",
+ XBT_INFO("Listening on port %d (expecting %d messages)",
gras_socket_my_port(mysock), todo);
while (todo > 0) {
gras_msg_wait(60 /* wait up to one minute */ ,
todo--;
free(data);
- INFO3("Got Data from %s:%d (still %d to go)",
+ XBT_INFO("Got Data from %s:%d (still %d to go)",
gras_socket_peer_name(expeditor),
gras_socket_peer_port(expeditor), todo);
memset(data, 32, datasize);
data[datasize] = '\0';
- INFO0("Launch current node");
+ XBT_INFO("Launch current node");
/* Register the known messages */
gras_msgtype_declare("data", gras_datadesc_by_name("string"));
}
gras_msg_send(peer, "data", &data);
if (gras_if_SG()) {
- INFO2(" Sent Data from %s to %s", gras_os_myname(), h->name);
+ XBT_INFO(" Sent Data from %s to %s", gras_os_myname(), h->name);
} else {
- INFO0(" Sent Data");
+ XBT_INFO(" Sent Data");
}
gras_socket_close(peer);
start = now = gras_os_time();
- INFO1("Begin matrix multiplication loop (time: %g)", start);
+ XBT_INFO("Begin matrix multiplication loop (time: %g)", start);
for (l = 0; l < 4; l++) {
now = gras_os_time();
GRAS_BENCH_ONCE_RUN_ONCE_END();
now = gras_os_time() - now;
- INFO2("Iteration %d : %g ", l, now);
+ XBT_INFO("Iteration %d : %g ", l, now);
}
now = gras_os_time() - start;
- INFO2("End matrix multiplication loop (time: %g; Duration: %g)",
+ XBT_INFO("End matrix multiplication loop (time: %g; Duration: %g)",
gras_os_time(), now);
start = now = gras_os_time();
- INFO1("Begin malloc loop (time: %g)", start);
+ XBT_INFO("Begin malloc loop (time: %g)", start);
for (l = 0; l < 4; l++) {
now = gras_os_time();
GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
A = malloc(n * n * sizeof(double));
GRAS_BENCH_ONCE_RUN_ONCE_END();
now = gras_os_time() - now;
- INFO2("Iteration %d : %g ", l, now);
+ XBT_INFO("Iteration %d : %g ", l, now);
}
start = now = gras_os_time();
- INFO1("Begin integer incrementation loop (time: %g)", start);
+ XBT_INFO("Begin integer incrementation loop (time: %g)", start);
for (l = 0; l < 4; l++) {
GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
j++;
start = now = gras_os_time();
- INFO1("Matrix size: %d", n);
-/* INFO1("Before computation: %lg", start); */
+ XBT_INFO("Matrix size: %d", n);
+/* XBT_INFO("Before computation: %lg", start); */
for (l = 0; l < 40; l++) {
now = gras_os_time();
1.0, A, n, B, n, 0.0, C, n);
GRAS_BENCH_ONCE_RUN_ONCE_END();
now = gras_os_time() - now;
-/* INFO2("Iteration %d : %lg ", l, now); */
+/* XBT_INFO("Iteration %d : %lg ", l, now); */
}
now = gras_os_time() - start;
- INFO1("Duration: %lg ", now);
+ XBT_INFO("Duration: %lg ", now);
free(A);
free(B);
port = atoi(argv[2]);
}
- INFO2("Launch client (server on %s:%d)", host, port);
+ XBT_INFO("Launch client (server on %s:%d)", host, port);
/* 3. Create a socket to speak to the server */
while (!connected) {
}
}
- INFO2("Connected to %s:%d.", host, port);
+ XBT_INFO("Connected to %s:%d.", host, port);
/* 4. Register the messages.
See, it doesn't have to be done completely at the beginning, only before use */
ping_register_messages();
/* 5. Keep the user informed of what's going on */
- INFO2(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
/* 6. Prepare and send the ping message to the server */
gras_socket_close(toserver);
RETHROW0("Failed to send PING to server: %s");
}
- INFO3(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<",
ping,
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
}
/* 8. Keep the user informed of what's going on, again */
- INFO3(">>>>>>>> Got PONG(%d) from %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Got PONG(%d) from %s:%d <<<<<<<<",
pong, gras_socket_peer_name(from), gras_socket_peer_port(from));
/* 9. Free the allocated resources, and shut GRAS down */
gras_socket_close(toserver);
- INFO0("Done.");
+ XBT_INFO("Done.");
gras_exit();
return 0;
} /* end_of_client */
{
gras_msgtype_declare("ping", gras_datadesc_by_name("int"));
gras_msgtype_declare("pong", gras_datadesc_by_name("int"));
- INFO0("Messages registered");
+ XBT_INFO("Messages registered");
}
globals->endcondition = 0;
/* 3. Log which client connected */
- INFO3(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
msg,
gras_socket_peer_name(expeditor),
gras_socket_peer_port(expeditor));
RETHROW0("Unable answer with PONG: %s");
}
- INFO0(">>>>>>>> Answered with PONG(4321) <<<<<<<<");
+ XBT_INFO(">>>>>>>> Answered with PONG(4321) <<<<<<<<");
/* 7. Set the endcondition boolean to true (and make sure the server stops after receiving it). */
globals->endcondition = 1;
port = atoi(argv[1]);
}
- INFO1("Launch server (port=%d)", port);
+ XBT_INFO("Launch server (port=%d)", port);
/* 3. Create my master socket */
globals->sock = gras_socket_server(port);
/* 5. Register my callback */
gras_cb_register("ping", &server_cb_ping_handler);
- INFO1(">>>>>>>> Listening on port %d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Listening on port %d <<<<<<<<",
gras_socket_my_port(globals->sock));
globals->endcondition = 0;
/* 7. Housekeeping */
if (!globals->endcondition)
- WARN0
+ XBT_WARN
("An error occured, the endcondition was not set by the callback");
/* 8. Free the allocated resources, and shut GRAS down */
gras_socket_close(globals->sock);
free(globals);
- INFO0("Done.");
+ XBT_INFO("Done.");
gras_exit();
return 0;
}
/* 3. Create my master socket */
- INFO1("Launch server (port=%d)", port);
+ XBT_INFO("Launch server (port=%d)", port);
TRY {
sock = gras_socket_server(port);
}
gras_socket_close(sock);
gras_exit();
- INFO0("Done.");
+ XBT_INFO("Done.");
return 0;
} /* end_of_server */
port = atoi(argv[2]);
}
- INFO2("Launch client (server on %s:%d)", host, port);
+ XBT_INFO("Launch client (server on %s:%d)", host, port);
/* 3. Wait for the server startup */
gras_os_sleep(1);
CATCH(e) {
RETHROW0("Unable to connect to the server: %s");
}
- INFO2("Connected to %s:%d.", host, port);
+ XBT_INFO("Connected to %s:%d.", host, port);
/* 5. Register the messages (before use) */
mmrpc_register_messages();
/* 6. Keep the user informed of what's going on */
- INFO2(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
/* 7. Prepare and send the request to the server */
xbt_matrix_free(request[0]);
- INFO2(">>>>>>>> Request sent to %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Request sent to %s:%d <<<<<<<<",
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
/* 8. Wait for the answer from the server, and deal with issues */
xbt_matrix_get_as(request[1], i, j, double));
/* 9. Keep the user informed of what's going on, again */
- INFO2(">>>>>>>> Got answer from %s:%d (values are right) <<<<<<<<",
+ XBT_INFO(">>>>>>>> Got answer from %s:%d (values are right) <<<<<<<<",
gras_socket_peer_name(from), gras_socket_peer_port(from));
/* 10. Free the allocated resources, and shut GRAS down */
xbt_matrix_free(answer);
gras_socket_close(toserver);
gras_exit();
- INFO0("Done.");
+ XBT_INFO("Done.");
return 0;
} /* end_of_client */
port = atoi(argv[2]);
}
- INFO2("Launch client (server on %s:%d)", host, port);
+ XBT_INFO("Launch client (server on %s:%d)", host, port);
/* 3. Create a socket to speak to the server */
while (!connected) {
gras_os_sleep(0.05);
}
}
- INFO2("Connected to %s:%d.", host, port);
+ XBT_INFO("Connected to %s:%d.", host, port);
/* 4. Register the messages (before use) */
mmrpc_register_messages();
/* 5. Keep the user informed of what's going on */
- INFO2(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
/* 6. Prepare and send the request to the server */
xbt_matrix_free(request[0]);
- INFO2(">>>>>>>> Request sent to %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Request sent to %s:%d <<<<<<<<",
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
/* 7. Wait for the answer from the server, and deal with issues */
xbt_matrix_get_as(request[1], i, j, double));
/* 8. Keep the user informed of what's going on, again */
- INFO2(">>>>>>>> Got answer from %s:%d (values are right) <<<<<<<<",
+ XBT_INFO(">>>>>>>> Got answer from %s:%d (values are right) <<<<<<<<",
gras_socket_peer_name(from), gras_socket_peer_port(from));
/* 9. Free the allocated resources, and shut GRAS down */
}
/* 3. Create my master socket */
- INFO1("Launch server (port=%d)", port);
+ XBT_INFO("Launch server (port=%d)", port);
TRY {
sock = gras_socket_server(port);
}
supersteps = 1;
}
if (globals->create && (!(globals->remaining_loop % supersteps))) {
- INFO1("Begin a new loop. Still to do: %d", globals->remaining_loop);
+ XBT_INFO("Begin a new loop. Still to do: %d", globals->remaining_loop);
} else if (!(globals->remaining_loop % supersteps)) {
- VERB3("Got token(%d) from %s remaining_loop=%d",
+ XBT_VERB("Got token(%d) from %s remaining_loop=%d",
msg, gras_socket_peer_name(expeditor), globals->remaining_loop);
}
if (globals->remaining_loop > 0) {
msg += 1;
- DEBUG3("Send token(%d) to %s:%d", msg,
+ XBT_DEBUG("Send token(%d) to %s:%d", msg,
gras_socket_peer_name(globals->tosuccessor),
gras_socket_peer_port(globals->tosuccessor));
/* 8. Repport the hop number to the user at the end */
if (globals->remaining_loop == -1 && globals->create) {
double elapsed = gras_os_time() - globals->start_time;
- INFO1("Shut down the token-ring. There was %d hops.", msg);
- VERB1("Elapsed time: %g", elapsed);
+ XBT_INFO("Shut down the token-ring. There was %d hops.", msg);
+ XBT_VERB("Elapsed time: %g", elapsed);
}
/* 9. Tell GRAS that we consummed this message */
globals->tosuccessor = NULL;
if (!gras_os_getpid() % 100 || gras_if_RL())
- INFO3("Launch node listening on %d (successor on %s:%d)",
+ XBT_INFO("Launch node listening on %d (successor on %s:%d)",
myport, host, peerport);
/* 4. Register the known messages. */
gras_os_sleep(1.0); /* Make sure all server sockets are created */
/* 6. Create socket to the successor on the ring */
- DEBUG2("Connect to my successor on %s:%d", host, peerport);
+ XBT_DEBUG("Connect to my successor on %s:%d", host, peerport);
globals->tosuccessor = gras_socket_client(host, peerport);
globals->remaining_loop = NBLOOPS - 1;
- INFO3("Create the token (with value %d) and send it to %s:%d",
+ XBT_INFO("Create the token (with value %d) and send it to %s:%d",
token, host, peerport);
TRY {
while (globals->remaining_loop > (globals->create ? -1 : 0)) {
gras_msg_handle(-1);
- DEBUG1("looping (remaining_loop=%d)", globals->remaining_loop);
+ XBT_DEBUG("looping (remaining_loop=%d)", globals->remaining_loop);
}
gras_os_sleep(1.0); /* FIXME: if the sender quited, receive fail */
{
gras_socket_t temp_sock = NULL;
xbt_ex_t e; // the error variable used in TRY.. CATCH tokens.
- //INFO2("Transmiting message to %s:%d",host,port);
+ //XBT_INFO("Transmiting message to %s:%d",host,port);
TRY {
temp_sock = gras_socket_client(host, port);
} CATCH(e) {
} CATCH(e) {
RETHROW0("Unable to send!: %s");
}
- INFO3("Forwarding a get_successor message to %s for (%d;%d)", host,
+ XBT_INFO("Forwarding a get_successor message to %s for (%d;%d)", host,
msg.xId, msg.yId);
gras_socket_close(temp_sock);
}
xbt_ex_t e; // the error variable used in TRY.. CATCH tokens.
node_data_t *globals = (node_data_t *) gras_userdata_get();
gras_socket_t temp_sock = NULL;
- INFO3("Received a get_successor message from %s for (%d;%d)",
+ XBT_INFO("Received a get_successor message from %s for (%d;%d)",
gras_socket_peer_name(expeditor), incoming->xId, incoming->yId);
- //INFO4("My area is [%d;%d;%d;%d]",globals->x1,globals->x2,globals->y1,globals->y2);
+ //XBT_INFO("My area is [%d;%d;%d;%d]",globals->x1,globals->x2,globals->y1,globals->y2);
if (incoming->xId < globals->x1) // test if the message must be forwarded to a neighbour.
forward_get_suc(*incoming, globals->west_host, globals->west_port);
else if (incoming->xId > globals->x2)
else { // if the message must not be forwarded, then the area is splitted in half and one half is assignated to the new node.
rep_suc_t outgoing;
int validate = 0;
- INFO4
+ XBT_INFO
("Spliting my area between me (%d;%d) and the inserting node (%d;%d)!",
globals->xId, globals->yId, incoming->xId, incoming->yId);
if ((globals->x2 - globals->x1) > (globals->y2 - globals->y1)) { // the height of the area is smaller than its width.
}
}
if (validate == 1) { // the area for the new node has been defined, then send theses informations to the new node.
- INFO2("Sending environment informations to node %s:%d",
+ XBT_INFO("Sending environment informations to node %s:%d",
incoming->host, incoming->port);
TRY {
}
TRY {
gras_msg_send(temp_sock, "can_rep_suc", &outgoing);
- INFO0("Environment informations sent!");
+ XBT_INFO("Environment informations sent!");
}
CATCH(e) {
RETHROW2("%s:Timeout sending environment informations to %s: %s",
}
gras_socket_close(temp_sock);
} else // we have a problem!
- INFO0("An error occurded!!!!!!!!!!!!!");
+ XBT_INFO("An error occurded!!!!!!!!!!!!!");
}
gras_socket_close(expeditor); // spare
gras_msg_handle(10000.0); // wait a bit in case of someone want to ask me for something.
}
CATCH(e) {
- INFO4("My area is [%d;%d;%d;%d]", globals->x1, globals->x2,
+ XBT_INFO("My area is [%d;%d;%d;%d]", globals->x1, globals->x2,
globals->y1, globals->y2);
- //INFO0("Closing node, all has been done!");
+ //XBT_INFO("Closing node, all has been done!");
}
return 0;
}
get_suc_t get_suc_msg; // building the "get_suc" message.
gras_socket_t temp_sock2 = NULL;
- INFO0("Starting");
+ XBT_INFO("Starting");
/* 1. Init the GRAS infrastructure and declare my globals */
gras_init(&argc, argv);
globals->version = 0; // node version (used for fun)
/* 2. Inserting the Node */
- INFO2("Inserting node %s:%d", globals->host, globals->port);
+ XBT_INFO("Inserting node %s:%d", globals->host, globals->port);
if (argc == 4) { // the node is a server, then he has the whole area.
globals->x1 = 0;
globals->x2 = 1000;
globals->y1 = 0;
globals->y2 = 1000;
} else { // asking for an area.
- INFO1("Contacting %s so as to request for an area", argv[4]);
+ XBT_INFO("Contacting %s so as to request for an area", argv[4]);
TRY {
temp_sock = gras_socket_client(argv[4], atoi(argv[5]));
TRY { // waiting for a reply.
- INFO0("Waiting for reply!");
+ XBT_INFO("Waiting for reply!");
gras_msg_wait(6000, "can_rep_suc", &temp_sock2, &rep_suc_msg);
}
CATCH(e) {
gras_socket_close(temp_sock); // spare
}
- INFO2("Node %s:%d inserted", globals->host, globals->port);
+ XBT_INFO("Node %s:%d inserted", globals->host, globals->port);
// associating messages to handlers.
register_messages();
gras_msg_handle(10000.0); // waiting.. in case of someone has something to say.
}
CATCH(e) {
- INFO4("My area is [%d;%d;%d;%d]", globals->x1, globals->x2,
+ XBT_INFO("My area is [%d;%d;%d;%d]", globals->x1, globals->x2,
globals->y1, globals->y2);
- //INFO0("Closing node, all has been done!");
+ //XBT_INFO("Closing node, all has been done!");
}
gras_socket_close(globals->sock); // spare.
if (xId >= globals->x1 && xId <= globals->x2 && yId >= globals->y1
&& yId <= globals->y2) {
- INFO0("Nuclear launch missed");
+ XBT_INFO("Nuclear launch missed");
return 0;
} else {
char host[1024];
CATCH(e) {
RETHROW0("Unable to connect the nuke!: %s");
}
- //INFO4("%s ON %s %d %d <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<",globals->host,host,xId,yId);
+ //XBT_INFO("%s ON %s %d %d <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<",globals->host,host,xId,yId);
TRY {
gras_msg_send(temp_sock, "can_nuke", msg);
}
RETHROW0("Unable to send the nuke!: %s");
}
gras_socket_close(temp_sock);
- INFO4("Nuke launched by %s to %s for (%d;%d)", globals->host, host,
+ XBT_INFO("Nuke launched by %s to %s for (%d;%d)", globals->host, host,
msg->xId, msg->yId);
return 1;
}
if (incoming->xId == -1) { // i must start the War
- INFO2("%s:%d declare the WAR!!!!!!!!!!!!!!!!!", globals->host,
+ XBT_INFO("%s:%d declare the WAR!!!!!!!!!!!!!!!!!", globals->host,
globals->port);
srand((unsigned int) time((time_t *) NULL));
} else if (incoming->xId >= globals->x1 && incoming->xId <= globals->x2 && incoming->yId >= globals->y1 && incoming->yId <= globals->y2) { // the nuke crash on my area..
if (globals->version == incoming->version) // ..but i'm dead.
- INFO0("I'm already dead :p");
+ XBT_INFO("I'm already dead :p");
else if ((incoming->xId - globals->xId) / 60 == 0 && (incoming->yId - globals->yId) / 60 == 0) { // ..and it's on me, so i die :X.
globals->version = incoming->version;
- INFO2("Euuuaarrrgghhhh... %s killed %s !!!!!!!!!!!!!!!!!",
+ XBT_INFO("Euuuaarrrgghhhh... %s killed %s !!!!!!!!!!!!!!!!!",
incoming->host, globals->host);
} else { // and it miss me, i angry and i send my own nuke!
- INFO1("%s was missed, and counteract!", globals->host);
+ XBT_INFO("%s was missed, and counteract!", globals->host);
/*int x1=(int)(1000.0*rand()/(RAND_MAX+1.0));
int y1=(int)(1000.0*rand()/(RAND_MAX+1.0));
int x2=(int)(1000.0*rand()/(RAND_MAX+1.0));
CATCH(e) {
RETHROW0("Unable to send the nuke!: %s");
}
- INFO4("Nuke re-aimed by %s to %s for (%d;%d)", globals->host, host,
+ XBT_INFO("Nuke re-aimed by %s to %s for (%d;%d)", globals->host, host,
incoming->xId, incoming->yId);
gras_socket_close(temp_sock);
}
gras_msg_handle(10000.0); // wait a bit, in case of..
}
CATCH(e) {
- INFO4("My area is [%d;%d;%d;%d]", globals->x1, globals->x2,
+ XBT_INFO("My area is [%d;%d;%d;%d]", globals->x1, globals->x2,
globals->y1, globals->y2);
- //INFO0("Closing node, all has been done!");
+ //XBT_INFO("Closing node, all has been done!");
}
return 0;
}
node_data_t *globals=(node_data_t*)gras_userdata_get();
- INFO4(">>> %d : received %d message from %s to %d <<<",globals->id,pbio_i.type,gras_socket_peer_name(expeditor),pbio_i.dest);
+ XBT_INFO(">>> %d : received %d message from %s to %d <<<",globals->id,pbio_i.type,gras_socket_peer_name(expeditor),pbio_i.dest);
get_suc_t incoming = *(get_suc_t *) payload_data;
rep_suc_t outgoing;
node_data_t *globals = (node_data_t *) gras_userdata_get();
- INFO2("Received a get_successor message from %s for %d",
+ XBT_INFO("Received a get_successor message from %s for %d",
gras_socket_peer_name(expeditor), incoming.id);
if ((globals->id == globals->finger[0].id) ||
(incoming.id > globals->id
outgoing.id = globals->finger[0].id;
snprintf(outgoing.host, 1024, globals->finger[0].host);
outgoing.port = globals->finger[0].port;
- INFO0("My successor is his successor!");
+ XBT_INFO("My successor is his successor!");
} else {
gras_socket_t temp_sock;
int contact = closest_preceding_node(incoming.id);
outgoing.id = globals->finger[0].id;
snprintf(outgoing.host, 1024, globals->finger[0].host);
outgoing.port = globals->finger[0].port;
- INFO0("My successor is his successor!");
+ XBT_INFO("My successor is his successor!");
} else {
get_suc_t asking;
asking.id = incoming.id;
TRY {
gras_msg_send(expeditor, "chord_rep_suc", &outgoing);
- INFO0("Successor information sent!");
+ XBT_INFO("Successor information sent!");
}
CATCH(e) {
RETHROW2("%s:Timeout sending successor information to %s: %s",
/*xbt_ex_t e; */
notify_t incoming = *(notify_t *) payload_data;
node_data_t *globals = (node_data_t *) gras_userdata_get();
- INFO2("Received a notifying message from %s as %d",
+ XBT_INFO("Received a notifying message from %s as %d",
gras_socket_peer_name(expeditor), incoming.id);
if (globals->pre_id == -1 ||
(incoming.id > globals->pre_id && incoming.id < globals->id)) {
globals->pre_id = incoming.id;
snprintf(globals->pre_host, 1024, incoming.host);
globals->pre_port = incoming.port;
- INFO0("Set as my new predecessor!");
+ XBT_INFO("Set as my new predecessor!");
}
return 0;
}
}
TRY {
- INFO0("Waiting for reply!");
+ XBT_INFO("Waiting for reply!");
gras_msg_wait(6000, "chord_rep_suc", &temp_sock2, &rep_suc_msg);
} CATCH(e) {
RETHROW1("%s: Error waiting for successor:%s", globals->host);
globals->finger[0].id = rep_suc_msg.id;
snprintf(globals->finger[0].host, 1024, rep_suc_msg.host);
globals->finger[0].port = rep_suc_msg.port;
- INFO1("→ Finger %d fixed!", globals->next_to_fix);
+ XBT_INFO("→ Finger %d fixed!", globals->next_to_fix);
gras_socket_close(temp_sock);
globals->next_to_fix = (++globals->next_to_fix == globals->fingers) ?
register_messages();
globals->finger = (finger_elem *) calloc(1, sizeof(finger_elem));
- INFO2("Launching node %s:%d", globals->host, globals->port);
+ XBT_INFO("Launching node %s:%d", globals->host, globals->port);
if (create) {
- INFO0("→Creating ring");
+ XBT_INFO("→Creating ring");
globals->finger[0].id = globals->id;
snprintf(globals->finger[0].host, 1024, globals->host);
globals->finger[0].port = globals->port;
} else {
- INFO2("→Known node %s:%d", other_host, other_port);
- INFO0("→Contacting to determine successor");
+ XBT_INFO("→Known node %s:%d", other_host, other_port);
+ XBT_INFO("→Contacting to determine successor");
TRY {
temp_sock = gras_socket_client(other_host, other_port);
}
}
TRY {
- INFO0("Waiting for reply!");
+ XBT_INFO("Waiting for reply!");
gras_msg_wait(10., "chord_rep_suc", &temp_sock2, &rep_suc_msg);
}
CATCH(e) {
globals->finger[0].id = rep_suc_msg.id;
snprintf(globals->finger[0].host, 1024, rep_suc_msg.host);
globals->finger[0].port = rep_suc_msg.port;
- INFO3("→Got successor : %d-%s:%d", globals->finger[0].id,
+ XBT_INFO("→Got successor : %d-%s:%d", globals->finger[0].id,
globals->finger[0].host, globals->finger[0].port);
gras_socket_close(temp_sock);
TRY {
gras_socket_close(globals->sock);
free(globals);
gras_exit();
- INFO0("Done");
+ XBT_INFO("Done");
return (0);
}
port = atoi(argv[2]);
}
- INFO2("Launch client (server on %s:%d)", host, port);
+ XBT_INFO("Launch client (server on %s:%d)", host, port);
/* 3. Create a socket to speak to the server */
while (!connected) {
}
}
- INFO2("Connected to %s:%d.", host, port);
+ XBT_INFO("Connected to %s:%d.", host, port);
/* 4. Register the messages.
See, it doesn't have to be done completely at the beginning, only before use */
ping_register_messages();
/* 5. Keep the user informed of what's going on */
- INFO2(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
/* 6. Prepare and send the ping message to the server */
gras_socket_close(toserver);
RETHROW0("Failed to send PING to server: %s");
}
- INFO3(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<",
ping, gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
/* 7. Wait for the answer from the server, and deal with issues */
}
/* 8. Keep the user informed of what's going on, again */
- INFO3(">>>>>>>> Got PONG(%d) from %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Got PONG(%d) from %s:%d <<<<<<<<",
pong, gras_socket_peer_name(from), gras_socket_peer_port(from));
/* 9. Free the allocated resources, and shut GRAS down */
gras_socket_close(toserver);
- INFO0("Done.");
+ XBT_INFO("Done.");
gras_exit();
return 0;
} /* end_of_client */
{
gras_msgtype_declare("ping", gras_datadesc_by_name("int"));
gras_msgtype_declare("pong", gras_datadesc_by_name("int"));
- INFO0("Messages registered");
+ XBT_INFO("Messages registered");
}
globals->endcondition = 0;
/* 3. Log which client connected */
- INFO3(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
msg,
gras_socket_peer_name(expeditor),
gras_socket_peer_port(expeditor));
RETHROW0("Unable answer with PONG: %s");
}
- INFO0(">>>>>>>> Answered with PONG(4321) <<<<<<<<");
+ XBT_INFO(">>>>>>>> Answered with PONG(4321) <<<<<<<<");
/* 7. Set the endcondition boolean to true (and make sure the server stops after receiving it). */
globals->endcondition = 1;
port = atoi(argv[1]);
}
- INFO1("Launch server (port=%d)", port);
+ XBT_INFO("Launch server (port=%d)", port);
/* 3. Create my master socket */
globals->sock = gras_socket_server(port);
/* 5. Register my callback */
gras_cb_register("ping", &server_cb_ping_handler);
- INFO1(">>>>>>>> Listening on port %d <<<<<<<<",
+ XBT_INFO(">>>>>>>> Listening on port %d <<<<<<<<",
gras_socket_my_port(globals->sock));
globals->endcondition = 0;
/* 7. Housekeeping */
if (!globals->endcondition)
- WARN0
+ XBT_WARN
("An error occured, the endcondition was not set by the callback");
/* 8. Free the allocated resources, and shut GRAS down */
gras_socket_close(globals->sock);
free(globals);
- INFO0("Done.");
+ XBT_INFO("Done.");
gras_exit();
return 0;
peers = amok_pm_group_new("pmm");
/* friends, we're ready. Come and play */
- INFO0("Wait for peers for 2 sec");
+ XBT_INFO("Wait for peers for 2 sec");
gras_msg_handleall(2);
while (xbt_dynar_length(peers) < SLAVE_COUNT) {
- INFO2("Got only %ld pals (of %d). Wait 2 more seconds",
+ XBT_INFO("Got only %ld pals (of %d). Wait 2 more seconds",
xbt_dynar_length(peers),SLAVE_COUNT);
gras_msg_handleall(2);
}
- INFO1("Good. Got %ld pals", xbt_dynar_length(peers));
+ XBT_INFO("Good. Got %ld pals", xbt_dynar_length(peers));
for (i = 0; i < xbt_dynar_length(peers) && i < SLAVE_COUNT; i++) {
xbt_dynar_get_cpy(peers, i, &grid[i]);
xbt_peer_t h;
xbt_dynar_remove_at(peers, i, &h);
- INFO2("Too much slaves. Killing %s:%d", h->name, h->port);
+ XBT_INFO("Too much slaves. Killing %s:%d", h->name, h->port);
amok_pm_kill_hp(h->name, h->port);
free(h);
}
/* Assign job to slaves */
int row = 0, line = 0;
- INFO0("XXXXXXXXXXXXXXXXXXXXXX begin Multiplication");
+ XBT_INFO("XXXXXXXXXXXXXXXXXXXXXX begin Multiplication");
for (i = 0; i < SLAVE_COUNT; i++) {
s_pmm_assignment_t assignment;
int j, k;
/* Retrieve the results */
for (i = 0; i < SLAVE_COUNT; i++) {
gras_msg_wait(6000, "result", &from, &result);
- VERB2("%d slaves are done already. Waiting for %d", i + 1,
+ XBT_VERB("%d slaves are done already. Waiting for %d", i + 1,
SLAVE_COUNT);
xbt_matrix_copy_values(C, result.C, submatrix_size, submatrix_size,
submatrix_size * result.linepos,
/* end of gather */
if (xbt_matrix_double_is_seq(C))
- INFO0("XXXXXXXXXXXXXXXXXXXXXX Ok, the result matches expectations");
+ XBT_INFO("XXXXXXXXXXXXXXXXXXXXXX Ok, the result matches expectations");
else {
- WARN0("the result seems wrong");
+ XBT_WARN("the result seems wrong");
if (DATA_MATRIX_SIZE < 30) {
- INFO0("The Result of Multiplication is :");
+ XBT_INFO("The Result of Multiplication is :");
xbt_matrix_dump(C, "C:res", 0, xbt_matrix_dump_display_double);
} else {
- INFO1("Matrix size too big (%d>30) to be displayed here",
+ XBT_INFO("Matrix size too big (%d>30) to be displayed here",
DATA_MATRIX_SIZE);
}
}
mydataB = assignment.B;
if (gras_if_RL())
- INFO0("Receive my pos and assignment");
+ XBT_INFO("Receive my pos and assignment");
else
- INFO2("Receive my pos (%d,%d) and assignment", myline, myrow);
+ XBT_INFO("Receive my pos (%d,%d) and assignment", myline, myrow);
/* Get my neighborhood from the assignment message (skipping myself) */
for (i = 0; i < PROC_MATRIX_SIZE - 1; i++) {
/* a line brodcast */
if (myline == step) {
- VERB2("LINE: step(%d) = Myline(%d). Broadcast my data.", step,
+ XBT_VERB("LINE: step(%d) = Myline(%d). Broadcast my data.", step,
myline);
for (l = 0; l < PROC_MATRIX_SIZE - 1; l++) {
- VERB1("LINE: Send to %s", gras_socket_peer_name(socket_row[l]));
+ XBT_VERB("LINE: Send to %s", gras_socket_peer_name(socket_row[l]));
gras_msg_send(socket_row[l], "dataB", &mydataB);
}
CATCH(e) {
RETHROW0("Can't get a data message from line : %s");
}
- VERB3("LINE: step(%d) <> Myline(%d). Receive data from %s", step,
+ XBT_VERB("LINE: step(%d) <> Myline(%d). Receive data from %s", step,
myline, gras_socket_peer_name(from));
}
/* a row brodcast */
if (myrow == step) {
- VERB2("ROW: step(%d)=myrow(%d). Broadcast my data.", step, myrow);
+ XBT_VERB("ROW: step(%d)=myrow(%d). Broadcast my data.", step, myrow);
for (l = 1; l < PROC_MATRIX_SIZE; l++) {
- VERB1("ROW: Send to %s",
+ XBT_VERB("ROW: Send to %s",
gras_socket_peer_name(socket_line[l - 1]));
gras_msg_send(socket_line[l - 1], "dataA", &mydataA);
}
CATCH(e) {
RETHROW0("Can't get a data message from row : %s");
}
- VERB3("ROW: step(%d)<>myrow(%d). Receive data from %s", step, myrow,
+ XBT_VERB("ROW: step(%d)<>myrow(%d). Receive data from %s", step, myrow,
gras_socket_peer_name(from));
}
xbt_matrix_double_addmult(bA, bB, bC);
CATCH(e) {
RETHROW0("Failed to send answer to server: %s");
}
- VERB2(">>>>>>>> Result sent to %s:%d <<<<<<<<",
+ XBT_VERB(">>>>>>>> Result sent to %s:%d <<<<<<<<",
gras_socket_peer_name(master), gras_socket_peer_port(master));
/* Free the allocated resources, and shut GRAS down */
/* Create the connexions */
mysock = gras_socket_server_range(3000, 9999, 0, 0);
- INFO1("Sensor %d starting", rank);
+ XBT_INFO("Sensor %d starting", rank);
while (!connected) {
xbt_ex_t e;
TRY {
/* Let the other process change the host props */
gras_os_sleep(1);
- INFO0("== Dump all the properties of current host");
+ XBT_INFO("== Dump all the properties of current host");
xbt_dict_foreach(host_props, cursor, key, data)
- INFO2(" Host property: '%s' has value: '%s'", key, data);
+ XBT_INFO(" Host property: '%s' has value: '%s'", key, data);
- INFO0("== Dump all the properties of alice");
+ XBT_INFO("== Dump all the properties of alice");
xbt_dict_foreach(process_props, cursor, key, data)
if (!strncmp(key, "SG_TEST_", 8))
- INFO2(" Process property: '%s' has value: '%s'", key, data);
+ XBT_INFO(" Process property: '%s' has value: '%s'", key, data);
- INFO0("== Try to get a process property that does not exist");
+ XBT_INFO("== Try to get a process property that does not exist");
value = gras_process_property_value("Nonexisting");
xbt_assert0(!value, "nonexisting property exists!!");
/* Modify an existing property. First check it exists */
- INFO0("== Trying to modify a process property");
+ XBT_INFO("== Trying to modify a process property");
value = gras_process_property_value("new prop");
xbt_assert0(!value, "Property 'new prop' exists before I add it!");
xbt_dict_set(process_props, "new prop", xbt_strdup("new value"),
char *key, *data;
const char *value;
- INFO0("== Dump all the properties of host1");
+ XBT_INFO("== Dump all the properties of host1");
xbt_dict_foreach(host_props, cursor, key, data)
- INFO2(" Host property: '%s' has value: '%s'", key, data);
+ XBT_INFO(" Host property: '%s' has value: '%s'", key, data);
- INFO0("== Try to get a property that does not exist");
+ XBT_INFO("== Try to get a property that does not exist");
value = gras_os_host_property_value("non existing key");
xbt_assert1(value == NULL,
"The key 'non existing key' exists (with value '%s')!!",
value);
- INFO0
+ XBT_INFO
("== Set a host property that alice will try to retrieve in SG (from bob->hello)");
xbt_dict_set(host_props, "from bob", xbt_strdup("hello"), xbt_free_f);
- INFO0("== Dump all the properties of host1 again to check the addition");
+ XBT_INFO("== Dump all the properties of host1 again to check the addition");
xbt_dict_foreach(host_props, cursor, key, data)
- INFO2(" Host property: '%s' has value: '%s'", key, data);
+ XBT_INFO(" Host property: '%s' has value: '%s'", key, data);
gras_os_sleep(1); /* KILLME once bug on empty main is solved */
gras_exit();
}
/* friends, we're ready. Come and play */
- INFO1("Wait for peers for a while. I need %d peers",
+ XBT_INFO("Wait for peers for a while. I need %d peers",
xbt_dict_size(pals_int));
while (xbt_dynar_length(peers) < xbt_dict_size(pals_int)) {
TRY {
char *peer_name;
void *data;
xbt_dict_foreach(pals_int, dict_cursor, peer_name, data) {
- INFO1("Peer %s didn't showed up", peer_name);
+ XBT_INFO("Peer %s didn't showed up", peer_name);
}
RETHROW;
}
}
- INFO1("Got my %ld peers", xbt_dynar_length(peers));
+ XBT_INFO("Got my %ld peers", xbt_dynar_length(peers));
xbt_dict_free(&pals_int);
/* Check who came */
xbt_dict_t pals = xbt_dict_new();
gras_socket_t pal;
xbt_dynar_foreach(peers, cursor, peer) {
- //INFO1("%s is here",peer->name);
+ //XBT_INFO("%s is here",peer->name);
gras_socket_t sock = gras_socket_client(peer->name, peer->port);
xbt_dict_set(pals, peer->name, sock, NULL);
}
xbt_dynar_foreach(cmds, cursor, cmd) {
pal = xbt_dict_get_or_null(pals, cmd->who);
if (!pal) {
- CRITICAL1("Process %s didn't came! Abording!", cmd->who);
+ XBT_CRITICAL("Process %s didn't came! Abording!", cmd->who);
amok_pm_group_shutdown("replay");
xbt_dynar_free(&cmds);
gras_exit();
xbt_dict_foreach(pals, dict_cursor, pal_name, pal) {
gras_msg_send(pal, "commands", &cmds);
}
- INFO0("Sent commands to every processes. Let them start now");
+ XBT_INFO("Sent commands to every processes. Let them start now");
xbt_dict_cursor_t dict_it;
xbt_dict_foreach(pals, dict_it, pal_name, pal) {
gras_msg_send(pal, "go", NULL);
}
- INFO0("They should be started by now. Wait for their completion.");
+ XBT_INFO("They should be started by now. Wait for their completion.");
for (cursor = 0; cursor < xbt_dynar_length(peers); cursor++) {
gras_msg_wait(-1, "go", NULL, NULL);
worker_data_t g = gras_userdata_get();
gras_socket_t peer_sock = xbt_dict_get_or_null(g->peers, peer);
if (!peer_sock) {
- INFO1("Create a socket to %s", peer);
+ XBT_INFO("Create a socket to %s", peer);
peer_sock = gras_socket_client(peer, 4000);
xbt_dict_set(g->peers, peer, peer_sock, NULL); //gras_socket_close_voidp);
}
if (cmd->action == XBT_WORKLOAD_SEND) {
gras_socket_t sock = get_peer_sock(cmd->str_arg);
chunk = xbt_workload_data_chunk_new((int) (cmd->d_arg));
- INFO4("Send %.f bytes to %s %s:%d", cmd->d_arg, cmd->str_arg,
+ XBT_INFO("Send %.f bytes to %s %s:%d", cmd->d_arg, cmd->str_arg,
gras_socket_peer_name(sock), gras_socket_peer_port(sock));
gras_msg_send_(sock, gras_msgtype_by_name("chunk"), &chunk);
- INFO2("Done sending %.f bytes to %s", cmd->d_arg, cmd->str_arg);
+ XBT_INFO("Done sending %.f bytes to %s", cmd->d_arg, cmd->str_arg);
} else if (cmd->action == XBT_WORKLOAD_RECV) {
- INFO2("Recv %.f bytes from %s", cmd->d_arg, cmd->str_arg);
+ XBT_INFO("Recv %.f bytes from %s", cmd->d_arg, cmd->str_arg);
TRY {
gras_msg_wait(1000000, "chunk", NULL, &chunk);
}
cmd->d_arg, cmd->str_arg);
}
xbt_workload_data_chunk_free(chunk);
- INFO2("Done receiving %.f bytes from %s", cmd->d_arg, cmd->str_arg);
+ XBT_INFO("Done receiving %.f bytes from %s", cmd->d_arg, cmd->str_arg);
} else {
xbt_die(bprintf
globals->peers = xbt_dict_new();
if (gras_if_RL())
- INFO2("Sensor %s starting. Connecting to master on %s",
+ XBT_INFO("Sensor %s starting. Connecting to master on %s",
gras_os_myname(), argv[1]);
while (!connected) {
xbt_ex_t e;
if (e.category != system_error)
RETHROW;
xbt_ex_free(e);
- INFO0("Failed to connect. Retry in 0.5 second");
+ XBT_INFO("Failed to connect. Retry in 0.5 second");
gras_os_sleep(0.5);
}
}
xbt_dynar_foreach(g->commands, cursor, cmd) {
if (!strcmp(cmd->who, myname)) {
char *c = xbt_workload_elm_to_string(cmd);
- // INFO1("TODO: %s",c);
+ // XBT_INFO("TODO: %s",c);
free(c);
switch (cmd->action) {
CATCH(e) {
SIMIX_display_process_status();
}
- INFO0("Communications all done");
+ XBT_INFO("Communications all done");
xbt_dynar_reset(cmd_to_go);
}
- INFO1("Compute %.f flops", cmd->d_arg);
+ XBT_INFO("Compute %.f flops", cmd->d_arg);
gras_cpu_burn(cmd->d_arg);
- INFO1("Done computing %.f flops", cmd->d_arg);
+ XBT_INFO("Done computing %.f flops", cmd->d_arg);
break;
case XBT_WORKLOAD_SEND:
/* Create the socket from main thread since it seems to fails when done from dopar thread */
}
}
/* do in parallel any communication still queued */
- INFO1("Do %ld pending communications after end of TODO list",
+ XBT_INFO("Do %ld pending communications after end of TODO list",
xbt_dynar_length(cmd_to_go));
if (xbt_dynar_length(cmd_to_go)) {
xbt_dynar_dopar(cmd_to_go, do_command);
host = argv[1];
port = atoi(argv[2]);
}
- INFO2("Launch client (server on %s:%d)", host, port);
+ XBT_INFO("Launch client (server on %s:%d)", host, port);
exception_catching();
CATCH(e) {
RETHROW0("Unable to connect to the server: %s");
}
- INFO2("Connected to %s:%d.", host, port);
+ XBT_INFO("Connected to %s:%d.", host, port);
/* 5. Register the messages.
register_messages();
/* 6. Keep the user informed of what's going on */
- INFO2("Connected to server which is on %s:%d",
+ XBT_INFO("Connected to server which is on %s:%d",
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
/* 7. Prepare and send the ping message to the server */
exception_catching();
/* 8. Keep the user informed of what's going on, again */
- INFO4("The answer to PING(%d) on %s:%d is PONG(%d)",
+ XBT_INFO("The answer to PING(%d) on %s:%d is PONG(%d)",
ping,
gras_socket_peer_name(toserver), gras_socket_peer_port(toserver),
pong);
/* 9. Call a RPC which raises an exception (to test exception propagation) */
- INFO0("Call the exception raising RPC");
+ XBT_INFO("Call the exception raising RPC");
TRY {
gras_msg_rpccall(toserver, 6000.0, "raise exception", NULL, NULL);
}
xbt_assert1(e.value == 42, "Got wrong value: %d (!=42)", e.value);
xbt_assert1(!strncmp(e.msg, exception_msg, strlen(exception_msg)),
"Got wrong message: %s", e.msg);
- INFO0
+ XBT_INFO
("Got the expected exception when calling the exception raising RPC");
xbt_ex_free(e);
}
if (!gotit)
THROW0(unknown_error, 0, "Didn't got the remote exception!");
- INFO0("Called the exception raising RPC");
+ XBT_INFO("Called the exception raising RPC");
exception_catching();
/* doxygen_ignore */
for (i = 0; i < 5; i++) {
- INFO1("Call the exception raising RPC (i=%d)", i);
+ XBT_INFO("Call the exception raising RPC (i=%d)", i);
TRY {
gras_msg_rpccall(toserver, 6000.0, "raise exception", NULL, NULL);
}
/* 9. Call a RPC which raises an exception (to test that exception propagation works) */
for (i = 0; i < 5; i++) {
- INFO1("Call the exception raising RPC on the forwarder (i=%d)", i);
+ XBT_INFO("Call the exception raising RPC on the forwarder (i=%d)", i);
TRY {
gras_msg_rpccall(toforwarder, 6000.0, "forward exception", NULL,
NULL);
xbt_assert2(e.category == unknown_error,
"Got wrong category: %d (instead of %d)",
e.category, unknown_error);
- INFO0
+ XBT_INFO
("Got the expected exception when calling the exception raising RPC");
xbt_ex_free(e);
exception_catching();
}
- INFO2("Ask %s:%d to die", gras_socket_peer_name(toforwarder),
+ XBT_INFO("Ask %s:%d to die", gras_socket_peer_name(toforwarder),
gras_socket_peer_port(toforwarder));
gras_msg_send(toforwarder, "kill", NULL);
- INFO2("Ask %s:%d to die", gras_socket_peer_name(toserver),
+ XBT_INFO("Ask %s:%d to die", gras_socket_peer_name(toserver),
gras_socket_peer_port(toserver));
gras_msg_send(toserver, "kill", NULL);
/* 11. Cleanup the place before leaving */
gras_socket_close(toserver);
gras_socket_close(toforwarder);
- INFO0("Done.");
+ XBT_INFO("Done.");
gras_exit();
return 0;
} /* end_of_client */
{
forward_data_t fdata;
gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
- INFO2("Asked to die by %s:%d", gras_socket_peer_name(expeditor),
+ XBT_INFO("Asked to die by %s:%d", gras_socket_peer_name(expeditor),
gras_socket_peer_port(expeditor));
fdata = gras_userdata_get();
fdata->done = 1;
{
forward_data_t fdata = gras_userdata_get();
- INFO0("Forward a request");
+ XBT_INFO("Forward a request");
gras_msg_rpccall(fdata->server, 60, "raise exception", NULL, NULL);
return 0;
}
fdata->done = 0;
port = atoi(argv[1]);
- INFO1("Launch forwarder (port=%d)", port);
+ XBT_INFO("Launch forwarder (port=%d)", port);
mysock = gras_socket_server(port);
gras_os_sleep(1); /* wait for the server to be ready */
gras_socket_close(mysock);
gras_socket_close(fdata->server);
free(fdata);
- INFO0("Done.");
+ XBT_INFO("Done.");
gras_exit();
return 0;
}
gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
server_data_t sdata;
- INFO2("Asked to die by %s:%d", gras_socket_peer_name(expeditor),
+ XBT_INFO("Asked to die by %s:%d", gras_socket_peer_name(expeditor),
gras_socket_peer_port(expeditor));
sdata = gras_userdata_get();
gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
/* 2. Log which client connected */
- INFO3("Got message PING(%d) from %s:%d",
+ XBT_INFO("Got message PING(%d) from %s:%d",
msg,
gras_socket_peer_name(expeditor),
gras_socket_peer_port(expeditor));
/* 5. Return as result */
gras_msg_rpcreturn(6000, ctx, &msg);
- INFO0("Answered with PONG(4321)");
+ XBT_INFO("Answered with PONG(4321)");
/* 6. Cleanups, if any */
sdata = gras_userdata_new(s_server_data_t);
sdata->done = 0;
- INFO1("Launch server (port=%d)", port);
+ XBT_INFO("Launch server (port=%d)", port);
/* 3. Create my master socket */
mysock = gras_socket_server(port);
gras_cb_register("raise exception", &server_cb_raise_ex);
gras_cb_register("kill", &server_cb_kill);
- INFO1("Listening on port %d", gras_socket_my_port(mysock));
+ XBT_INFO("Listening on port %d", gras_socket_my_port(mysock));
/* 5. Wait for the ping incomming messages */
/* 8. Free the allocated resources, and shut GRAS down */
free(sdata);
gras_socket_close(mysock);
- INFO0("Done.");
+ XBT_INFO("Done.");
gras_exit();
return 0;
if (!moretodo)
break; // Do not break from within the CATCH, exceptions don't like it.
- INFO2("Got [%d;%d] to do",chunk->min,chunk->max);
+ XBT_INFO("Got [%d;%d] to do",chunk->min,chunk->max);
GRAS_BENCH_ALWAYS_BEGIN();
int i;
for (i=chunk->min;i<chunk->max;i++) {
GRAS_BENCH_ALWAYS_END();
xbt_queue_push(done,&chunk);
}
- INFO0("No more work for me; bailing out");
+ XBT_INFO("No more work for me; bailing out");
return 0;
}
done = xbt_queue_new(-1,sizeof(work_chunk_t));
- INFO0("Prepare some work");
+ XBT_INFO("Prepare some work");
for (i=0;i<maxint/perchunk;i++) {
chunk = xbt_new0(s_work_chunk_t,1);
chunk->min = i*perchunk;
xbt_queue_push(todo,&chunk);
}
- INFO0("Spawn the kids");
+ XBT_INFO("Spawn the kids");
for (i = 0; i < child_amount; i++) {
char *name = bprintf("child%d",i);
worker_args = xbt_new0(char *, 2);
free(name);
}
- INFO0("Fetch their answers");
+ XBT_INFO("Fetch their answers");
for (i=0;i<maxint/perchunk;i++) {
work_chunk_t chunk;
xbt_strbuff_t buff = xbt_strbuff_new();
xbt_strbuff_append(buff,",");
xbt_strbuff_append(buff,number);
}
- INFO3("Primes in [%d,%d]: %s",chunk->min,chunk->max,buff->data);
+ XBT_INFO("Primes in [%d,%d]: %s",chunk->min,chunk->max,buff->data);
xbt_strbuff_free(buff);
}
gras_os_sleep(.1);/* Let the childs detect that there is nothing more to do */
static void pickup(int id, int lunch)
{
- INFO2("Thread %d gets hungry (lunch #%d)", id, lunch);
+ XBT_INFO("Thread %d gets hungry (lunch #%d)", id, lunch);
xbt_mutex_acquire(mutex);
while (state[(id + (philosopher_amount - 1)) % philosopher_amount] ==
EATING || state[(id + 1) % philosopher_amount] == EATING) {
id);
xbt_mutex_release(mutex);
- INFO1("Thread %d eats", id);
+ XBT_INFO("Thread %d eats", id);
}
static void putdown(int id)
{
- INFO1("Thread %d is full", id);
+ XBT_INFO("Thread %d is full", id);
xbt_mutex_acquire(mutex);
state[id] = THINKING;
xbt_cond_signal(forks
xbt_cond_signal(forks[(id + 1) % philosopher_amount]);
xbt_mutex_release(mutex);
- INFO1("Thread %d thinks", id);
+ XBT_INFO("Thread %d thinks", id);
}
/*
xbt_mutex_release(mut_end);
/* Enter an endless loop to test the killing facilities */
- INFO1
+ XBT_INFO
("Thread %d tries to enter the dead-end; hopefully, the master will cancel it",
id);
xbt_mutex_acquire(dead_end);
- INFO1("Oops, thread %d reached the dead-end. Cancelation failed", id);
+ XBT_INFO("Oops, thread %d reached the dead-end. Cancelation failed", id);
}
int philosopher(int argc, char *argv[]);
dead_end = xbt_mutex_init();
xbt_mutex_acquire(dead_end);
- INFO2("Spawn the %d threads (%d lunches scheduled)", philosopher_amount,
+ XBT_INFO("Spawn the %d threads (%d lunches scheduled)", philosopher_amount,
lunch_amount);
/* spawn threads */
for (i = 0; i < philosopher_amount; i++) {
xbt_cond_wait(cond_end, mut_end);
xbt_mutex_release(mut_end);
- INFO0("Cancel all childs");
+ XBT_INFO("Cancel all childs");
/* nuke them threads */
for (i = 0; i < philosopher_amount; i++) {
xbt_thread_cancel(philosophers[i]);
/* Stop if nothing to do yet */
if (globals->still_to_do <= 0) {
- INFO0("Repetitive_action has nothing to do yet");
+ XBT_INFO("Repetitive_action has nothing to do yet");
return;
}
gras_timer_cancel_repeat(REPEAT_INTERVAL, repetitive_action);
}
- INFO1
+ XBT_INFO
("repetitive_action decrementing globals->still_to_do. New value: %d",
globals->still_to_do - 1);
{
my_globals *globals = (my_globals *) gras_userdata_get();
- INFO1("delayed_action setting globals->still_to_do to %d", LOOP_COUNT);
+ XBT_INFO("delayed_action setting globals->still_to_do to %d", LOOP_COUNT);
globals->still_to_do = LOOP_COUNT;
} /* end_of_delayed_action */
globals = gras_userdata_new(my_globals);
globals->still_to_do = -1;
- INFO1("Programming the repetitive_action with a frequency of %f sec",
+ XBT_INFO("Programming the repetitive_action with a frequency of %f sec",
REPEAT_INTERVAL);
gras_timer_repeat(REPEAT_INTERVAL, repetitive_action);
- INFO1("Programming the delayed_action for after %f sec", DELAY_INTERVAL);
+ XBT_INFO("Programming the delayed_action for after %f sec", DELAY_INTERVAL);
gras_timer_delay(REPEAT_INTERVAL, delayed_action);
- INFO0("Have a rest");
+ XBT_INFO("Have a rest");
gras_os_sleep(DELAY_INTERVAL / 2.0);
- INFO0("Canceling the delayed_action.");
+ XBT_INFO("Canceling the delayed_action.");
gras_timer_cancel_delay(REPEAT_INTERVAL, delayed_action);
- INFO1("Re-programming the delayed_action for after %f sec",
+ XBT_INFO("Re-programming the delayed_action for after %f sec",
DELAY_INTERVAL);
gras_timer_delay(REPEAT_INTERVAL, delayed_action);
globals->still_to_do >
0 /* after delayed_action, and not enough repetitive_action */ ) {
- DEBUG1("Prepare to handle messages for 5 sec (still_to_do=%d)",
+ XBT_DEBUG("Prepare to handle messages for 5 sec (still_to_do=%d)",
globals->still_to_do);
gras_msg_handle(5.0);
}
TRACE_smpi_send(rank, rank, dst_traced);
#endif
- DEBUG2("Entering Send: %s (size: %lg)", name, size);
+ XBT_DEBUG("Entering Send: %s (size: %lg)", name, size);
if (size<65536) {
action_Isend(action);
} else {
MSG_task_send(MSG_task_create(name, 0, size, NULL), to);
}
- VERB2("%s %f", name, MSG_get_clock() - clock);
+ XBT_VERB("%s %f", name, MSG_get_clock() - clock);
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
free(name);
MSG_task_isend( MSG_task_create(to,0,parse_double(size),NULL), to);
xbt_dynar_push(globals->isends,&comm);
- DEBUG1("Isend on %s", MSG_process_get_name(MSG_process_self()));
- VERB2("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
+ XBT_DEBUG("Isend on %s", MSG_process_get_name(MSG_process_self()));
+ XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
asynchronous_cleanup();
}
TRACE_smpi_ptp_in(rank, src_traced, rank, "recv");
#endif
- DEBUG1("Receiving: %s", name);
+ XBT_DEBUG("Receiving: %s", name);
MSG_task_receive(&task, mailbox_name);
// MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
- VERB2("%s %f", name, MSG_get_clock() - clock);
+ XBT_VERB("%s %f", name, MSG_get_clock() - clock);
MSG_task_destroy(task);
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
double clock = MSG_get_clock();
process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
- DEBUG1("Irecv on %s", MSG_process_get_name(MSG_process_self()));
+ XBT_DEBUG("Irecv on %s", MSG_process_get_name(MSG_process_self()));
#ifdef HAVE_TRACING
int rank = get_rank(MSG_process_get_name(MSG_process_self()));
int src_traced = get_rank(action[2]);
mailbox);
xbt_dynar_push(globals->irecvs,&c);
- VERB2("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
+ XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
#ifdef HAVE_TRACING
TRACE_smpi_ptp_out(rank, src_traced, rank, "Irecv");
TRACE_smpi_ptp_in(rank, src_traced, rank, "wait");
#endif
- DEBUG1("Entering %s", name);
+ XBT_DEBUG("Entering %s", name);
comm = xbt_dynar_pop_as(globals->irecvs,msg_comm_t);
MSG_comm_wait(comm,-1);
task = xbt_dynar_pop_as(globals->tasks,m_task_t);
MSG_comm_destroy(comm);
MSG_task_destroy(task);
- VERB2("%s %f", name, MSG_get_clock() - clock);
+ XBT_VERB("%s %f", name, MSG_get_clock() - clock);
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
free(name);
#ifdef HAVE_TRACING
cond = SIMIX_req_cond_init();
processes_arrived_sofar=0;
}
- DEBUG2("Entering barrier: %s (%d already there)", name,processes_arrived_sofar);
+ XBT_DEBUG("Entering barrier: %s (%d already there)", name,processes_arrived_sofar);
SIMIX_req_mutex_lock(mutex);
if (++processes_arrived_sofar == communicator_size) {
SIMIX_req_mutex_unlock(mutex);
}
- DEBUG1("Exiting barrier: %s", name);
+ XBT_DEBUG("Exiting barrier: %s", name);
processes_arrived_sofar--;
if (!processes_arrived_sofar) {
reduce_identifier = bprintf("reduce_%d", counters->reduce_counter++);
if (!strcmp(process_name, "p0")) {
- DEBUG2("%s: %s is the Root", reduce_identifier, process_name);
+ XBT_DEBUG("%s: %s is the Root", reduce_identifier, process_name);
msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1);
m_task_t *tasks = xbt_new0(m_task_t,communicator_size-1);
free(tasks);
comp_task = MSG_task_create("reduce_comp", comp_size, 0, NULL);
- DEBUG1("%s: computing 'reduce_comp'", reduce_identifier);
+ XBT_DEBUG("%s: computing 'reduce_comp'", reduce_identifier);
MSG_task_execute(comp_task);
MSG_task_destroy(comp_task);
- DEBUG1("%s: computed", reduce_identifier);
+ XBT_DEBUG("%s: computed", reduce_identifier);
} else {
- DEBUG2("%s: %s sends", reduce_identifier, process_name);
+ XBT_DEBUG("%s: %s sends", reduce_identifier, process_name);
sprintf(mailbox, "%s_%s_p0", reduce_identifier, process_name);
- DEBUG1("put on %s", mailbox);
+ XBT_DEBUG("put on %s", mailbox);
MSG_task_send(MSG_task_create(reduce_identifier, 0, comm_size, NULL),
mailbox);
}
- VERB2("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
+ XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
free(reduce_identifier);
}
bcast_identifier = bprintf("bcast_%d", counters->bcast_counter++);
if (!strcmp(process_name, "p0")) {
- DEBUG2("%s: %s is the Root", bcast_identifier, process_name);
+ XBT_DEBUG("%s: %s is the Root", bcast_identifier, process_name);
msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1);
MSG_comm_destroy(comms[i-1]);
free(comms);
- DEBUG2("%s: all messages sent by %s have been received",
+ XBT_DEBUG("%s: all messages sent by %s have been received",
bcast_identifier, process_name);
} else {
sprintf(mailbox, "%s_p0_%s", bcast_identifier, process_name);
MSG_task_receive(&task, mailbox);
MSG_task_destroy(task);
- DEBUG2("%s: %s has received", bcast_identifier, process_name);
+ XBT_DEBUG("%s: %s has received", bcast_identifier, process_name);
}
- VERB2("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
+ XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
free(bcast_identifier);
}
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
name = xbt_str_join_array(action, " ");
- DEBUG1("Entering %s", name);
+ XBT_DEBUG("Entering %s", name);
MSG_process_sleep(parse_double(duration));
- VERB2("%s %f ", name, MSG_get_clock() - clock);
+ XBT_VERB("%s %f ", name, MSG_get_clock() - clock);
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
free(name);
allreduce_identifier = bprintf("allReduce_%d", counters->allReduce_counter++);
if (!strcmp(process_name, "p0")) {
- DEBUG2("%s: %s is the Root", allreduce_identifier, process_name);
+ XBT_DEBUG("%s: %s is the Root", allreduce_identifier, process_name);
msg_comm_t *comms = xbt_new0(msg_comm_t,communicator_size-1);
m_task_t *tasks = xbt_new0(m_task_t,communicator_size-1);
free(tasks);
comp_task = MSG_task_create("allReduce_comp", comp_size, 0, NULL);
- DEBUG1("%s: computing 'reduce_comp'", allreduce_identifier);
+ XBT_DEBUG("%s: computing 'reduce_comp'", allreduce_identifier);
MSG_task_execute(comp_task);
MSG_task_destroy(comp_task);
- DEBUG1("%s: computed", allreduce_identifier);
+ XBT_DEBUG("%s: computed", allreduce_identifier);
for (i = 1; i < communicator_size; i++) {
sprintf(mailbox, "%s_p0_p%d", allreduce_identifier, i);
MSG_comm_destroy(comms[i-1]);
free(comms);
- DEBUG2("%s: all messages sent by %s have been received",
+ XBT_DEBUG("%s: all messages sent by %s have been received",
allreduce_identifier, process_name);
} else {
- DEBUG2("%s: %s sends", allreduce_identifier, process_name);
+ XBT_DEBUG("%s: %s sends", allreduce_identifier, process_name);
sprintf(mailbox, "%s_%s_p0", allreduce_identifier, process_name);
- DEBUG1("put on %s", mailbox);
+ XBT_DEBUG("put on %s", mailbox);
MSG_task_send(MSG_task_create(allreduce_identifier, 0, comm_size, NULL),
mailbox);
sprintf(mailbox, "%s_p0_%s", allreduce_identifier, process_name);
MSG_task_receive(&task, mailbox);
MSG_task_destroy(task);
- DEBUG2("%s: %s has received", allreduce_identifier, process_name);
+ XBT_DEBUG("%s: %s has received", allreduce_identifier, process_name);
}
- VERB2("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
+ XBT_VERB("%s %f", xbt_str_join_array(action, " "), MSG_get_clock() - clock);
free(allreduce_identifier);
}
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
name = xbt_str_join_array(action, " ");
communicator_size = parse_double(size);
- VERB2("%s %f", name, MSG_get_clock() - clock);
+ XBT_VERB("%s %f", name, MSG_get_clock() - clock);
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
free(name);
}
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
name = xbt_str_join_array(action, " ");
- DEBUG1("Entering %s", name);
+ XBT_DEBUG("Entering %s", name);
MSG_task_execute(task);
MSG_task_destroy(task);
- VERB2("%s %f", name, MSG_get_clock() - clock);
+ XBT_VERB("%s %f", name, MSG_get_clock() - clock);
if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
free(name);
}
#ifdef HAVE_TRACING
TRACE_smpi_init(get_rank(MSG_process_get_name(MSG_process_self())));
#endif
- DEBUG0("Initialize the counters");
+ XBT_DEBUG("Initialize the counters");
process_globals_t globals = (process_globals_t) calloc(1, sizeof(s_process_globals_t));
globals->isends = xbt_dynar_new(sizeof(msg_comm_t),NULL);
globals->irecvs = xbt_dynar_new(sizeof(msg_comm_t),NULL);
/* Actually do the simulation using MSG_action_trace_run */
res = MSG_action_trace_run(argv[3]); // it's ok to pass a NULL argument here
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
MSG_clean();
if (res == MSG_OK)
}
}
- INFO2("Got %d aliases and %d tasks to process", alias_count,
+ XBT_INFO("Got %d aliases and %d tasks to process", alias_count,
number_of_tasks);
for (i = 0; i < alias_count; i++)
- DEBUG1("%s", aliases[i]);
+ XBT_DEBUG("%s", aliases[i]);
for (i = 0; i < number_of_tasks; i++) {
- INFO2("Sending \"%s\" to \"%s\"", todo[i]->name,
+ XBT_INFO("Sending \"%s\" to \"%s\"", todo[i]->name,
aliases[i % alias_count]);
if (!strcmp
(MSG_host_get_name(MSG_host_self()), aliases[i % alias_count])) {
- INFO0("Hey ! It's me ! :)");
+ XBT_INFO("Hey ! It's me ! :)");
}
MSG_task_send(todo[i], aliases[i % alias_count]);
- INFO0("Sent");
+ XBT_INFO("Sent");
}
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < alias_count; i++)
MSG_task_send(MSG_task_create("finalize", 0, 0, FINALIZE), aliases[i]);
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
for (i = 0; i < alias_count; i++)
free(aliases[i]);
res = MSG_task_receive(&(task), MSG_host_get_name(MSG_host_self()));
xbt_assert0(res == MSG_OK, "MSG_task_receive failed");
- INFO1("Received \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task), "finalize")) {
MSG_task_destroy(task);
break;
}
- INFO1("Processing \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Processing \"%s\"", MSG_task_get_name(task));
MSG_task_execute(task);
- INFO1("\"%s\" done", MSG_task_get_name(task));
+ XBT_INFO("\"%s\" done", MSG_task_get_name(task));
MSG_task_destroy(task);
task = NULL;
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_slave */
a = MSG_task_receive(&(task), MSG_host_get_name(MSG_host_self()));
if (a == MSG_OK) {
- INFO1("Received \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (MSG_task_get_data(task) == FINALIZE) {
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < alias_count; i++)
break;
}
- INFO2("Sending \"%s\" to \"%s\"", MSG_task_get_name(task),
+ XBT_INFO("Sending \"%s\" to \"%s\"", MSG_task_get_name(task),
aliases[i % alias_count]);
MSG_task_send(task, aliases[i % alias_count]);
i++;
} else {
- INFO0("Hey ?! What's up ? ");
+ XBT_INFO("Hey ?! What's up ? ");
xbt_assert0(0, "Unexpected behavior");
}
}
for (i = 0; i < alias_count; i++)
free(aliases[i]);
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_forwarder */
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
pow = pow << 1;
}
nb_keys = pow;
- DEBUG1("Sets nb_keys to %d", nb_keys);
+ XBT_DEBUG("Sets nb_keys to %d", nb_keys);
}
/**
{
if (XBT_LOG_ISENABLED(msg_chord, xbt_log_priority_verbose)) {
int i;
- VERB0("My finger table:");
- VERB0("Start | Succ ");
+ XBT_VERB("My finger table:");
+ XBT_VERB("Start | Succ ");
for (i = 0; i < nb_bits; i++) {
- VERB2(" %3d | %3d ", (node->id + powers2[i]) % nb_keys, node->fingers[i].id);
+ XBT_VERB(" %3d | %3d ", (node->id + powers2[i]) % nb_keys, node->fingers[i].id);
}
- VERB1("Predecessor: %d", node->pred_id);
+ XBT_VERB("Predecessor: %d", node->pred_id);
}
}
node->fingers[finger_index].id = id;
get_mailbox(id, node->fingers[finger_index].mailbox);
node->last_change_date = MSG_get_clock();
- DEBUG2("My new finger #%d is %d", finger_index, id);
+ XBT_DEBUG("My new finger #%d is %d", finger_index, id);
}
}
}
node->last_change_date = MSG_get_clock();
- DEBUG1("My new predecessor is %d", predecessor_id);
+ XBT_DEBUG("My new predecessor is %d", predecessor_id);
}
}
/*
// sleep before starting
- DEBUG1("Let's sleep during %f", sleep_time);
+ XBT_DEBUG("Let's sleep during %f", sleep_time);
MSG_process_sleep(sleep_time);
*/
- DEBUG0("Hey! Let's join the system.");
+ XBT_DEBUG("Hey! Let's join the system.");
join_success = join(&node, known_id);
}
MSG_error_t status = MSG_comm_get_status(node.comm_receive);
if (status != MSG_OK) {
- DEBUG0("Failed to receive a task. Nevermind.");
+ XBT_DEBUG("Failed to receive a task. Nevermind.");
node.comm_receive = NULL;
}
else {
comm_send = xbt_dynar_get_as(node.comms, index, msg_comm_t);
MSG_error_t status = MSG_comm_get_status(comm_send);
xbt_dynar_remove_at(node.comms, index, &comm_send);
- DEBUG3("Communication %p is finished with status %d, dynar size is now %lu",
+ XBT_DEBUG("Communication %p is finished with status %d, dynar size is now %lu",
comm_send, status, xbt_dynar_length(node.comms));
m_task_t task = MSG_comm_get_task(comm_send);
MSG_comm_destroy(comm_send);
// stop the simulation
xbt_free(node.fingers);
- INFO1("Messages created: %lu", smx_total_comms);
+ XBT_INFO("Messages created: %lu", smx_total_comms);
return 0;
}
*/
static void handle_task(node_t node, m_task_t task) {
- DEBUG1("Handling task %p", task);
+ XBT_DEBUG("Handling task %p", task);
char mailbox[MAILBOX_NAME_SIZE];
task_data_t task_data = (task_data_t) MSG_task_get_data(task);
e_task_type_t type = task_data->type;
switch (type) {
case TASK_FIND_SUCCESSOR:
- DEBUG2("Receiving a 'Find Successor' request from %s for id %d",
+ XBT_DEBUG("Receiving a 'Find Successor' request from %s for id %d",
task_data->issuer_host_name, task_data->request_id);
// is my successor the successor?
if (is_in_interval(task_data->request_id, node->id + 1, node->fingers[0].id)) {
task_data->type = TASK_FIND_SUCCESSOR_ANSWER;
task_data->answer_id = node->fingers[0].id;
- DEBUG4("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d",
+ XBT_DEBUG("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d",
task_data->issuer_host_name,
task_data->answer_to,
task_data->request_id, task_data->answer_id);
else {
// otherwise, forward the request to the closest preceding finger in my table
int closest = closest_preceding_node(node, task_data->request_id);
- DEBUG2("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d",
+ XBT_DEBUG("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d",
task_data->request_id, closest);
get_mailbox(closest, mailbox);
MSG_task_dsend(task, mailbox, task_free);
break;
case TASK_GET_PREDECESSOR:
- DEBUG1("Receiving a 'Get Predecessor' request from %s", task_data->issuer_host_name);
+ XBT_DEBUG("Receiving a 'Get Predecessor' request from %s", task_data->issuer_host_name);
task_data->type = TASK_GET_PREDECESSOR_ANSWER;
task_data->answer_id = node->pred_id;
- DEBUG3("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d",
+ XBT_DEBUG("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d",
task_data->issuer_host_name,
task_data->answer_to, task_data->answer_id);
MSG_task_dsend(task, task_data->answer_to, task_free);
case TASK_NOTIFY:
// someone is telling me that he may be my new predecessor
- DEBUG1("Receiving a 'Notify' request from %s", task_data->issuer_host_name);
+ XBT_DEBUG("Receiving a 'Notify' request from %s", task_data->issuer_host_name);
notify(node, task_data->request_id);
task_free(task);
break;
case TASK_PREDECESSOR_LEAVING:
// my predecessor is about to quit
- DEBUG1("Receiving a 'Predecessor Leaving' message from %s", task_data->issuer_host_name);
+ XBT_DEBUG("Receiving a 'Predecessor Leaving' message from %s", task_data->issuer_host_name);
// modify my predecessor
set_predecessor(node, task_data->request_id);
task_free(task);
case TASK_SUCCESSOR_LEAVING:
// my successor is about to quit
- DEBUG1("Receiving a 'Successor Leaving' message from %s", task_data->issuer_host_name);
+ XBT_DEBUG("Receiving a 'Successor Leaving' message from %s", task_data->issuer_host_name);
// modify my successor FIXME : this should be implicit ?
set_finger(node, 0, task_data->request_id);
task_free(task);
case TASK_FIND_SUCCESSOR_ANSWER:
case TASK_GET_PREDECESSOR_ANSWER:
- DEBUG2("Ignoring unexpected task of type %d (%p)", type, task);
+ XBT_DEBUG("Ignoring unexpected task of type %d (%p)", type, task);
task_free(task);
break;
}
*/
static void create(node_t node)
{
- DEBUG0("Create a new Chord ring...");
+ XBT_DEBUG("Create a new Chord ring...");
set_predecessor(node, -1); // -1 means that I have no predecessor
print_finger_table(node);
}
*/
static int join(node_t node, int known_id)
{
- INFO2("Joining the ring with id %d, knowing node %d", node->id, known_id);
+ XBT_INFO("Joining the ring with id %d, knowing node %d", node->id, known_id);
set_predecessor(node, -1); // no predecessor (yet)
int i;
int successor_id = remote_find_successor(node, known_id, node->id);
if (successor_id == -1) {
- INFO0("Cannot join the ring.");
+ XBT_INFO("Cannot join the ring.");
}
else {
set_finger(node, 0, successor_id);
*/
static void leave(node_t node)
{
- DEBUG0("Well Guys! I Think it's time for me to quit ;)");
+ XBT_DEBUG("Well Guys! I Think it's time for me to quit ;)");
quit_notify(node, 1); // notify to my successor ( >>> 1 );
quit_notify(node, -1); // notify my predecessor ( >>> -1);
// TODO ...
const char* to_mailbox = NULL;
if (to == 1) { // notify my successor
to_mailbox = node->fingers[0].mailbox;
- INFO2("Telling my Successor %d about my departure via mailbox %s",
+ XBT_INFO("Telling my Successor %d about my departure via mailbox %s",
node->fingers[0].id, to_mailbox);
req_data->type = TASK_PREDECESSOR_LEAVING;
}
}
to_mailbox = node->pred_mailbox;
- INFO2("Telling my Predecessor %d about my departure via mailbox %s",
+ XBT_INFO("Telling my Predecessor %d about my departure via mailbox %s",
node->pred_id, to_mailbox);
req_data->type = TASK_SUCCESSOR_LEAVING;
}
// send a "Find Successor" request to ask_to_id
m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
- DEBUG3("Sending a 'Find Successor' request (task %p) to %d for id %d", task_sent, ask_to, id);
+ XBT_DEBUG("Sending a 'Find Successor' request (task %p) to %d for id %d", task_sent, ask_to, id);
MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
if (res != MSG_OK) {
- DEBUG3("Failed to send the 'Find Successor' request (task %p) to %d for id %d",
+ XBT_DEBUG("Failed to send the 'Find Successor' request (task %p) to %d for id %d",
task_sent, ask_to, id);
task_free(task_sent);
}
else {
// receive the answer
- DEBUG3("Sent a 'Find Successor' request (task %p) to %d for key %d, waiting for the answer",
+ XBT_DEBUG("Sent a 'Find Successor' request (task %p) to %d for key %d, waiting for the answer",
task_sent, ask_to, id);
do {
res = MSG_comm_wait(node->comm_receive, timeout);
if (res != MSG_OK) {
- DEBUG2("Failed to receive the answer to my 'Find Successor' request (task %p): %d",
+ XBT_DEBUG("Failed to receive the answer to my 'Find Successor' request (task %p): %d",
task_sent, res);
stop = 1;
MSG_comm_destroy(node->comm_receive);
}
else {
m_task_t task_received = MSG_comm_get_task(node->comm_receive);
- DEBUG1("Received a task (%p)", task_received);
+ XBT_DEBUG("Received a task (%p)", task_received);
task_data_t ans_data = MSG_task_get_data(task_received);
if (MC_IS_ENABLED) {
}
else {
// this is our answer
- DEBUG4("Received the answer to my 'Find Successor' request for id %d (task %p): the successor of key %d is %d",
+ XBT_DEBUG("Received the answer to my 'Find Successor' request for id %d (task %p): the successor of key %d is %d",
ans_data->request_id, task_received, id, ans_data->answer_id);
successor = ans_data->answer_id;
stop = 1;
req_data->issuer_host_name = MSG_host_get_name(MSG_host_self());
// send a "Get Predecessor" request to ask_to_id
- DEBUG1("Sending a 'Get Predecessor' request to %d", ask_to);
+ XBT_DEBUG("Sending a 'Get Predecessor' request to %d", ask_to);
m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
if (res != MSG_OK) {
- DEBUG2("Failed to send the 'Get Predecessor' request (task %p) to %d",
+ XBT_DEBUG("Failed to send the 'Get Predecessor' request (task %p) to %d",
task_sent, ask_to);
task_free(task_sent);
}
else {
// receive the answer
- DEBUG3("Sent 'Get Predecessor' request (task %p) to %d, waiting for the answer on my mailbox '%s'",
+ XBT_DEBUG("Sent 'Get Predecessor' request (task %p) to %d, waiting for the answer on my mailbox '%s'",
task_sent, ask_to, req_data->answer_to);
do {
res = MSG_comm_wait(node->comm_receive, timeout);
if (res != MSG_OK) {
- DEBUG2("Failed to receive the answer to my 'Get Predecessor' request (task %p): %d",
+ XBT_DEBUG("Failed to receive the answer to my 'Get Predecessor' request (task %p): %d",
task_sent, res);
stop = 1;
MSG_comm_destroy(node->comm_receive);
handle_task(node, task_received);
}
else {
- DEBUG3("Received the answer to my 'Get Predecessor' request (task %p): the predecessor of node %d is %d",
+ XBT_DEBUG("Received the answer to my 'Get Predecessor' request (task %p): the predecessor of node %d is %d",
task_received, ask_to, ans_data->answer_id);
predecessor_id = ans_data->answer_id;
stop = 1;
*/
static void stabilize(node_t node)
{
- DEBUG0("Stabilizing node");
+ XBT_DEBUG("Stabilizing node");
// get the predecessor of my immediate successor
int candidate_id;
print_finger_table(node);
}
else {
- DEBUG1("I don't have to change my predecessor to %d", predecessor_candidate_id);
+ XBT_DEBUG("I don't have to change my predecessor to %d", predecessor_candidate_id);
}
}
// send a "Notify" request to notify_id
m_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
- DEBUG2("Sending a 'Notify' request (task %p) to %d", task, notify_id);
+ XBT_DEBUG("Sending a 'Notify' request (task %p) to %d", task, notify_id);
char mailbox[MAILBOX_NAME_SIZE];
get_mailbox(notify_id, mailbox);
MSG_task_dsend(task, mailbox, task_free);
*/
static void fix_fingers(node_t node) {
- DEBUG0("Fixing fingers");
+ XBT_DEBUG("Fixing fingers");
int i = node->next_finger_to_fix;
int id = find_successor(node, node->id + powers2[i]);
if (id != -1) {
*/
static void check_predecessor(node_t node)
{
- DEBUG0("Checking whether my predecessor is alive");
+ XBT_DEBUG("Checking whether my predecessor is alive");
// TODO
}
static void random_lookup(node_t node)
{
int id = 1337; // TODO pick a pseudorandom id
- DEBUG1("Making a lookup request for id %d", id);
+ XBT_DEBUG("Making a lookup request for id %d", id);
find_successor(node, id);
}
int length = strlen("-nb_bits=");
if (!strncmp(options[0], "-nb_bits=", length) && strlen(options[0]) > length) {
nb_bits = atoi(options[0] + length);
- DEBUG1("Set nb_bits to %d", nb_bits);
+ XBT_DEBUG("Set nb_bits to %d", nb_bits);
}
else {
length = strlen("-timeout=");
if (!strncmp(options[0], "-timeout=", length) && strlen(options[0]) > length) {
timeout = atoi(options[0] + length);
- DEBUG1("Set timeout to %d", timeout);
+ XBT_DEBUG("Set timeout to %d", timeout);
}
else {
xbt_assert1(0, "Invalid chord option '%s'", options[0]);
xbt_os_timer_start(timer);
MSG_error_t res = MSG_main();
xbt_os_timer_stop(timer);
- CRITICAL1("Simulation time %lf", xbt_os_timer_elapsed(timer));
- INFO1("Simulated time: %g", MSG_get_clock());
+ XBT_CRITICAL("Simulation time %lf", xbt_os_timer_elapsed(timer));
+ XBT_INFO("Simulated time: %g", MSG_get_clock());
MSG_clean();
int id = -1;
if (argc != 4) {
- INFO1("Strange number of arguments expected 3 got %d", argc - 1);
+ XBT_INFO("Strange number of arguments expected 3 got %d", argc - 1);
}
/* data size */
char id_alias[10];
if (argc != 2) {
- INFO1("Strange number of arguments expected 1 got %d", argc - 1);
+ XBT_INFO("Strange number of arguments expected 1 got %d", argc - 1);
}
id = atoi(argv[1]);
a = MSG_task_receive(&(task), id_alias);
if (a != MSG_OK) {
- INFO0("Hey?! What's up?");
+ XBT_INFO("Hey?! What's up?");
xbt_assert0(0, "Unexpected behavior.");
}
#ifdef HAVE_LATENCY_BOUND_TRACKING
limited_latency = MSG_task_is_latency_bounded(gl_task_array[id]);
if (limited_latency) {
- INFO1("WARNING FLOW[%d] is limited by latency!!", id);
+ XBT_INFO("WARNING FLOW[%d] is limited by latency!!", id);
}
#endif
- INFO5
+ XBT_INFO
("===> Estimated Bw of FLOW[%d] : %f ; message from %s to %s with remaining : %f",
id, gl_data_size[id] / elapsed_time, masternames[id],
slavenames[id], 0.0);
limited_latency = MSG_task_is_latency_bounded(gl_task_array[id]);
if (limited_latency) {
- INFO1("WARNING FLOW[%d] is limited by latency!!", id);
+ XBT_INFO("WARNING FLOW[%d] is limited by latency!!", id);
}
#endif
- INFO5
+ XBT_INFO
("===> Estimated Bw of FLOW[%d] : %f ; message from %s to %s with remaining : %f",
id, (gl_data_size[id] - remaining) / elapsed_time,
masternames[id], slavenames[id], remaining);
double sleep_start_time = atof(argv[5]);
double sleep_test_time = atof(argv[6]);
- INFO2("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
+ XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
sleep_test_time);
msg_comm_t comm = NULL;
MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size,
NULL);
comm = MSG_task_isend(task, mailbox);
- INFO2("Send to receiver-%ld Task_%d", i % receivers_count, i);
+ XBT_INFO("Send to receiver-%ld Task_%d", i % receivers_count, i);
if (sleep_test_time == 0) {
MSG_comm_wait(comm, -1);
sprintf(mailbox, "receiver-%ld", i % receivers_count);
task = MSG_task_create("finalize", 0, 0, 0);
comm = MSG_task_isend(task, mailbox);
- INFO1("Send to receiver-%ld finalize", i % receivers_count);
+ XBT_INFO("Send to receiver-%ld finalize", i % receivers_count);
if (sleep_test_time == 0) {
MSG_comm_wait(comm, -1);
} else {
}
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
return 0;
} /* end_of_sender */
msg_comm_t res_irecv;
double sleep_start_time = atof(argv[2]);
double sleep_test_time = atof(argv[3]);
- INFO2("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
+ XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
sleep_test_time);
xbt_assert1(sscanf(argv[1], "%d", &id),
sprintf(mailbox, "receiver-%d", id);
while (1) {
res_irecv = MSG_task_irecv(&(task), mailbox);
- INFO0("Wait to receive a task");
+ XBT_INFO("Wait to receive a task");
if (sleep_test_time == 0) {
res = MSG_comm_wait(res_irecv, -1);
MSG_comm_destroy(res_irecv);
}
- INFO1("Received \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task), "finalize")) {
MSG_task_destroy(task);
break;
}
- INFO1("Processing \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Processing \"%s\"", MSG_task_get_name(task));
MSG_task_execute(task);
- INFO1("\"%s\" done", MSG_task_get_name(task));
+ XBT_INFO("\"%s\" done", MSG_task_get_name(task));
MSG_task_destroy(task);
task = NULL;
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_receiver */
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size,
NULL);
comm[i] = MSG_task_isend(task, mailbox);
- INFO2("Send to receiver-%ld Task_%d", i % receivers_count, i);
+ XBT_INFO("Send to receiver-%ld Task_%d", i % receivers_count, i);
}
for (i = 0; i < receivers_count; i++) {
char mailbox[80];
sprintf(mailbox, "receiver-%ld", i % receivers_count);
task = MSG_task_create("finalize", 0, 0, 0);
comm[i + number_of_tasks] = MSG_task_isend(task, mailbox);
- INFO1("Send to receiver-%ld finalize", i % receivers_count);
+ XBT_INFO("Send to receiver-%ld finalize", i % receivers_count);
}
/* Here we are waiting for the completion of all communications */
MSG_comm_waitall(comm, (number_of_tasks + receivers_count), -1);
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
xbt_free(comm);
return 0;
} /* end_of_sender */
sprintf(mailbox, "receiver-%d", id);
while (1) {
res_irecv = MSG_task_irecv(&(task), mailbox);
- INFO0("Wait to receive a task");
+ XBT_INFO("Wait to receive a task");
res = MSG_comm_wait(res_irecv, -1);
xbt_assert0(res == MSG_OK, "MSG_task_get failed");
- INFO1("Received \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task), "finalize")) {
MSG_task_destroy(task);
break;
}
- INFO1("Processing \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Processing \"%s\"", MSG_task_get_name(task));
MSG_task_execute(task);
- INFO1("\"%s\" done", MSG_task_get_name(task));
+ XBT_INFO("\"%s\" done", MSG_task_get_name(task));
MSG_task_destroy(task);
task = NULL;
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_receiver */
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
task_comm_size / coef, NULL);
comm = MSG_task_isend(task, mailbox);
xbt_dynar_push_as(d, msg_comm_t, comm);
- INFO3("Send to receiver-%ld %s comm_size %f", i % receivers_count,
+ XBT_INFO("Send to receiver-%ld %s comm_size %f", i % receivers_count,
sprintf_buffer, task_comm_size / coef);
}
/* Here we are waiting for the completion of all communications */
MSG_task_destroy(task);
}
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
return 0;
} /* end_of_sender */
MSG_process_sleep(10);
msg_comm_t res_irecv;
for (i = 0; i < tasks; i++) {
- INFO1("Wait to receive task %d", i);
+ XBT_INFO("Wait to receive task %d", i);
task[i] = NULL;
res_irecv = MSG_task_irecv(&task[i], mailbox);
xbt_dynar_push_as(comms, msg_comm_t, res_irecv);
xbt_dynar_remove_at(comms, MSG_comm_waitany(comms), &res_irecv);
task_com = MSG_comm_get_task(res_irecv);
MSG_comm_destroy(res_irecv);
- INFO1("Processing \"%s\"", MSG_task_get_name(task_com));
+ XBT_INFO("Processing \"%s\"", MSG_task_get_name(task_com));
MSG_task_execute(task_com);
- INFO1("\"%s\" done", MSG_task_get_name(task_com));
+ XBT_INFO("\"%s\" done", MSG_task_get_name(task_com));
err = MSG_task_destroy(task_com);
xbt_assert0(err == MSG_OK, "MSG_task_destroy failed");
}
res_irecv = MSG_task_isend(MSG_task_create(NULL, 0, 0, NULL), mailbox);
MSG_comm_wait(res_irecv, -1);
MSG_comm_destroy(res_irecv);
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_receiver */
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
/* allocating memory for the buffer, I think 2kB should be enough */
surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
- DEBUG0("<platform>");
+ XBT_DEBUG("<platform>");
SURFXML_BUFFER_SET(platform_version, "3");
SURFXML_START_TAG(platform);
- DEBUG0("<AS>");
+ XBT_DEBUG("<AS>");
SURFXML_BUFFER_SET(AS_id, "AS0");
SURFXML_BUFFER_SET(AS_routing, "Full");
SURFXML_START_TAG(AS);
- DEBUG0("<host id=\"host A\" power=\"100000000.00\"/>");
+ XBT_DEBUG("<host id=\"host A\" power=\"100000000.00\"/>");
SURFXML_BUFFER_SET(host_id, "host A");
SURFXML_BUFFER_SET(host_power, "100000000.00");
SURFXML_BUFFER_SET(host_availability, "1.0");
SURFXML_START_TAG(host);
SURFXML_END_TAG(host);
- DEBUG0("<host id=\"host B\" power=\"100000000.00\"/>");
+ XBT_DEBUG("<host id=\"host B\" power=\"100000000.00\"/>");
SURFXML_BUFFER_SET(host_id, "host B");
SURFXML_BUFFER_SET(host_power, "100000000.00");
SURFXML_BUFFER_SET(host_availability, "1.0");
SURFXML_START_TAG(host);
SURFXML_END_TAG(host);
- DEBUG0("<link id=\"LinkA\" bandwidth=\"10000000.0\" latency=\"0.2\"/>");
+ XBT_DEBUG("<link id=\"LinkA\" bandwidth=\"10000000.0\" latency=\"0.2\"/>");
SURFXML_BUFFER_SET(link_id, "LinkA");
SURFXML_BUFFER_SET(link_bandwidth, "10000000.0");
SURFXML_BUFFER_SET(link_bandwidth_file, "");
SURFXML_START_TAG(link);
SURFXML_END_TAG(link);
- DEBUG0("<route src=\"host A\" dst=\"host B\">");
+ XBT_DEBUG("<route src=\"host A\" dst=\"host B\">");
SURFXML_BUFFER_SET(route_src, "host A");
SURFXML_BUFFER_SET(route_dst, "host B");
A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_YES;
SURFXML_START_TAG(route);
- DEBUG0(" <link:ctn id=\"LinkA\"/>");
+ XBT_DEBUG(" <link:ctn id=\"LinkA\"/>");
SURFXML_BUFFER_SET(link_ctn_id, "LinkA");
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG0("</route>");
+ XBT_DEBUG("</route>");
SURFXML_END_TAG(route);
- DEBUG0("</AS>");
+ XBT_DEBUG("</AS>");
SURFXML_END_TAG(AS);
- DEBUG0("</platfrom>");
+ XBT_DEBUG("</platfrom>");
SURFXML_END_TAG(platform);
free(surfxml_bufferstack);
for (i = 4; i < argc; i++) {
slaves[i - 4] = MSG_get_host_by_name(argv[i]);
if (slaves[i - 4] == NULL) {
- INFO1("Unknown host %s. Stopping Now! ", argv[i]);
+ XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
abort();
}
}
}
- INFO1("Got %d slave(s) :", slaves_count);
+ XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- INFO1("\t %s", slaves[i]->name);
+ XBT_INFO("\t %s", slaves[i]->name);
- INFO1("Got %d task to process :", number_of_tasks);
+ XBT_INFO("Got %d task to process :", number_of_tasks);
for (i = 0; i < number_of_tasks; i++)
- INFO1("\t\"%s\"", todo[i]->name);
+ XBT_INFO("\t\"%s\"", todo[i]->name);
for (i = 0; i < number_of_tasks; i++) {
- INFO2("Sending \"%s\" to \"%s\"",
+ XBT_INFO("Sending \"%s\" to \"%s\"",
todo[i]->name, slaves[i % slaves_count]->name);
if (MSG_host_self() == slaves[i % slaves_count]) {
- INFO0("Hey ! It's me ! :)");
+ XBT_INFO("Hey ! It's me ! :)");
}
MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22);
- INFO0("Send completed");
+ XBT_INFO("Send completed");
}
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++)
MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE),
slaves[i], PORT_22);
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
free(slaves);
free(todo);
return 0;
/** Receiver function */
int slave(int argc, char *argv[])
{
- INFO0("I'm a slave");
+ XBT_INFO("I'm a slave");
while (1) {
m_task_t task = NULL;
int a;
a = MSG_task_get(&(task), PORT_22);
if (a == MSG_OK) {
- INFO1("Received \"%s\" ", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\" ", MSG_task_get_name(task));
if (MSG_task_get_data(task) == FINALIZE) {
MSG_task_destroy(task);
break;
}
- INFO1("Processing \"%s\" ", MSG_task_get_name(task));
+ XBT_INFO("Processing \"%s\" ", MSG_task_get_name(task));
MSG_task_execute(task);
- INFO1("\"%s\" done ", MSG_task_get_name(task));
+ XBT_INFO("\"%s\" done ", MSG_task_get_name(task));
MSG_task_destroy(task);
} else {
- INFO0("Hey ?! What's up ? ");
+ XBT_INFO("Hey ?! What's up ? ");
xbt_assert0(0, "Unexpected behavior");
}
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_slave */
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
for (i = 4; i < argc; i++) {
slaves[i - 4] = MSG_get_host_by_name(argv[i]);
if (slaves[i - 4] == NULL) {
- INFO1("Unknown host %s. Stopping Now! ", argv[i]);
+ XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
abort();
}
}
}
- INFO1("Got %d slave(s) :", slaves_count);
+ XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- INFO1("\t %s", slaves[i]->name);
+ XBT_INFO("\t %s", slaves[i]->name);
- INFO1("Got %d task to process :", number_of_tasks);
+ XBT_INFO("Got %d task to process :", number_of_tasks);
for (i = 0; i < number_of_tasks; i++)
- INFO1("\t\"%s\"", todo[i]->name);
+ XBT_INFO("\t\"%s\"", todo[i]->name);
for (i = 0; i < number_of_tasks; i++) {
- INFO2("Sending \"%s\" to \"%s\"",
+ XBT_INFO("Sending \"%s\" to \"%s\"",
todo[i]->name, slaves[i % slaves_count]->name);
if (MSG_host_self() == slaves[i % slaves_count]) {
- INFO0("Hey ! It's me ! :)");
+ XBT_INFO("Hey ! It's me ! :)");
}
MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22);
- INFO0("Send completed");
+ XBT_INFO("Send completed");
}
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++)
MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE),
slaves[i], PORT_22);
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
free(slaves);
free(todo);
return 0;
/** Receiver function */
int slave(int argc, char *argv[])
{
- INFO0("I'm a slave");
+ XBT_INFO("I'm a slave");
while (1) {
m_task_t task = NULL;
int a;
a = MSG_task_get(&(task), PORT_22);
if (a == MSG_OK) {
- INFO1("Received \"%s\" ", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\" ", MSG_task_get_name(task));
if (MSG_task_get_data(task) == FINALIZE) {
MSG_task_destroy(task);
break;
}
- INFO1("Processing \"%s\" ", MSG_task_get_name(task));
+ XBT_INFO("Processing \"%s\" ", MSG_task_get_name(task));
MSG_task_execute(task);
- INFO1("\"%s\" done ", MSG_task_get_name(task));
+ XBT_INFO("\"%s\" done ", MSG_task_get_name(task));
MSG_task_destroy(task);
} else {
- INFO0("Hey ?! What's up ? ");
+ XBT_INFO("Hey ?! What's up ? ");
xbt_assert0(0, "Unexpected behavior");
}
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_slave */
/* <platform> */
SURFXML_BUFFER_SET(platform_version, "3");
SURFXML_START_TAG(platform);
- DEBUG0("<platform version=\"3\">");
+ XBT_DEBUG("<platform version=\"3\">");
- DEBUG0(" <process host=\"c-0.me\" function=\"master\">");
+ XBT_DEBUG(" <process host=\"c-0.me\" function=\"master\">");
SURFXML_BUFFER_SET(process_host, "c-0.me");
SURFXML_BUFFER_SET(process_function, "master");
SURFXML_BUFFER_SET(process_start_time, "-1.0");
SURFXML_BUFFER_SET(process_kill_time, "-1.0");
SURFXML_START_TAG(process);
- DEBUG1(" <argument value=\"%s\"/>",bprintf("%d",nb_host-1));
+ XBT_DEBUG(" <argument value=\"%s\"/>",bprintf("%d",nb_host-1));
SURFXML_BUFFER_SET(argument_value, bprintf("%d",nb_host-1));
SURFXML_START_TAG(argument);
SURFXML_END_TAG(argument);
- DEBUG0(" <argument value=\"5000000\"/>");
+ XBT_DEBUG(" <argument value=\"5000000\"/>");
SURFXML_BUFFER_SET(argument_value, "5000000");
SURFXML_START_TAG(argument);
SURFXML_END_TAG(argument);
- DEBUG0(" <argument value=\"100000\"/>");
+ XBT_DEBUG(" <argument value=\"100000\"/>");
SURFXML_BUFFER_SET(argument_value, "100000");
SURFXML_START_TAG(argument);
SURFXML_END_TAG(argument);
for(i=1 ; i<nb_host ; i++)
{
- DEBUG1(" <argument value=\"%s.me\"/>",bprintf("c-%d",i));
+ XBT_DEBUG(" <argument value=\"%s.me\"/>",bprintf("c-%d",i));
SURFXML_BUFFER_SET(argument_value, bprintf("c-%d.me",i));
SURFXML_START_TAG(argument);
SURFXML_END_TAG(argument);
}
- DEBUG0(" </process>");
+ XBT_DEBUG(" </process>");
SURFXML_END_TAG(process);
for(i=1 ; i<nb_host ; i++)
{
- DEBUG1(" <process host=\"%s.me\" function=\"slave\"/>",bprintf("c-%d",i));
+ XBT_DEBUG(" <process host=\"%s.me\" function=\"slave\"/>",bprintf("c-%d",i));
SURFXML_BUFFER_SET(process_host, bprintf("c-%d.me",i));
SURFXML_BUFFER_SET(process_function, "slave");
SURFXML_BUFFER_SET(process_start_time, "-1.0");
SURFXML_END_TAG(process);
}
- DEBUG0("</platform>");
+ XBT_DEBUG("</platform>");
SURFXML_END_TAG(platform);
free(surfxml_bufferstack);
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
long slaves_count = atol(argv[4]);
int i;
- INFO2("Got %ld slaves and %ld tasks to process", slaves_count,
+ XBT_INFO("Got %ld slaves and %ld tasks to process", slaves_count,
number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
char mailbox[256];
MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size,
NULL);
if (number_of_tasks < 10000 || i % 10000 == 0)
- INFO3("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name,
+ XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name,
number_of_tasks, mailbox);
MSG_task_send(task, mailbox);
}
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++) {
char mailbox[80];
MSG_task_send(finalize, mailbox);
}
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
return 0;
} /* end_of_master */
res = MSG_task_receive(&(task), mailbox);
xbt_assert0(res == MSG_OK, "MSG_task_get failed");
- INFO1("Received \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task), "finalize")) {
MSG_task_destroy(task);
break;
}
- INFO1("Processing \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Processing \"%s\"", MSG_task_get_name(task));
MSG_task_execute(task);
- INFO1("\"%s\" done", MSG_task_get_name(task));
+ XBT_INFO("\"%s\" done", MSG_task_get_name(task));
MSG_task_destroy(task);
task = NULL;
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_slave */
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
for (i = 4; i < argc; i++) {
slaves[i - 4] = MSG_get_host_by_name(argv[i]);
if (slaves[i - 4] == NULL) {
- INFO1("Unknown host %s. Stopping Now! ", argv[i]);
+ XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
abort();
}
}
}
- INFO1("Got %d slave(s) :", slaves_count);
+ XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- INFO1("%s", slaves[i]->name);
+ XBT_INFO("%s", slaves[i]->name);
- INFO1("Got %d task to process :", number_of_tasks);
+ XBT_INFO("Got %d task to process :", number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
a = MSG_task_put_with_timeout(task, slaves[i % slaves_count], PORT_22,
10.0);
if (a == MSG_OK) {
- INFO0("Send completed");
+ XBT_INFO("Send completed");
} else if (a == MSG_HOST_FAILURE) {
- INFO0
+ XBT_INFO
("Gloups. The cpu on which I'm running just turned off!. See you!");
free(task->data);
MSG_task_destroy(task);
free(slaves);
return 0;
} else if (a == MSG_TRANSFER_FAILURE) {
- INFO1
+ XBT_INFO
("Mmh. Something went wrong with '%s'. Nevermind. Let's keep going!",
slaves[i % slaves_count]->name);
free(task->data);
MSG_task_destroy(task);
} else if (a == MSG_TIMEOUT) {
- INFO1
+ XBT_INFO
("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
slaves[i % slaves_count]->name);
free(task->data);
MSG_task_destroy(task);
} else {
- INFO0("Hey ?! What's up ? ");
+ XBT_INFO("Hey ?! What's up ? ");
xbt_assert0(0, "Unexpected behavior");
}
}
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++) {
m_task_t task = MSG_task_create("finalize", 0, 0, FINALIZE);
if (a == MSG_OK)
continue;
if (a == MSG_HOST_FAILURE) {
- INFO0
+ XBT_INFO
("Gloups. The cpu on which I'm running just turned off!. See you!");
MSG_task_destroy(task);
free(slaves);
return 0;
} else if (a == MSG_TRANSFER_FAILURE) {
- INFO1("Mmh. Can't reach '%s'! Nevermind. Let's keep going!",
+ XBT_INFO("Mmh. Can't reach '%s'! Nevermind. Let's keep going!",
slaves[i]->name);
MSG_task_destroy(task);
} else if (a == MSG_TIMEOUT) {
- INFO1
+ XBT_INFO
("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
slaves[i % slaves_count]->name);
MSG_task_destroy(task);
} else {
- INFO0("Hey ?! What's up ? ");
+ XBT_INFO("Hey ?! What's up ? ");
xbt_assert2(0, "Unexpected behavior with '%s': %d", slaves[i]->name,
a);
}
}
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
free(slaves);
return 0;
} /* end_of_master */
a = MSG_task_get(&(task), PORT_22);
time2 = MSG_get_clock();
if (a == MSG_OK) {
- INFO1("Received \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (MSG_task_get_data(task) == FINALIZE) {
MSG_task_destroy(task);
break;
}
if (time1 < *((double *) task->data))
time1 = *((double *) task->data);
- INFO1("Communication time : \"%f\"", time2 - time1);
- INFO1("Processing \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Communication time : \"%f\"", time2 - time1);
+ XBT_INFO("Processing \"%s\"", MSG_task_get_name(task));
a = MSG_task_execute(task);
if (a == MSG_OK) {
- INFO1("\"%s\" done", MSG_task_get_name(task));
+ XBT_INFO("\"%s\" done", MSG_task_get_name(task));
free(task->data);
MSG_task_destroy(task);
} else if (a == MSG_HOST_FAILURE) {
- INFO0
+ XBT_INFO
("Gloups. The cpu on which I'm running just turned off!. See you!");
return 0;
} else {
- INFO0("Hey ?! What's up ? ");
+ XBT_INFO("Hey ?! What's up ? ");
xbt_assert0(0, "Unexpected behavior");
}
} else if (a == MSG_HOST_FAILURE) {
- INFO0
+ XBT_INFO
("Gloups. The cpu on which I'm running just turned off!. See you!");
return 0;
} else if (a == MSG_TRANSFER_FAILURE) {
- INFO0("Mmh. Something went wrong. Nevermind. Let's keep going!");
+ XBT_INFO("Mmh. Something went wrong. Nevermind. Let's keep going!");
} else {
- INFO0("Hey ?! What's up ? ");
+ XBT_INFO("Hey ?! What's up ? ");
xbt_assert0(0, "Unexpected behavior");
}
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_slave */
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
}
}
- INFO2("Got %d slaves and %d tasks to process", slaves_count,
+ XBT_INFO("Got %d slaves and %d tasks to process", slaves_count,
number_of_tasks);
for (i = 0; i < slaves_count; i++)
- DEBUG1("%s", slaves[i]->name);
+ XBT_DEBUG("%s", slaves[i]->name);
for (i = 0; i < number_of_tasks; i++) {
- INFO2("Sending \"%s\" to \"%s\"",
+ XBT_INFO("Sending \"%s\" to \"%s\"",
todo[i]->name, slaves[i % slaves_count]->name);
if (MSG_host_self() == slaves[i % slaves_count]) {
- INFO0("Hey ! It's me ! :)");
+ XBT_INFO("Hey ! It's me ! :)");
}
MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22);
- INFO0("Sent");
+ XBT_INFO("Sent");
}
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++) {
m_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE);
MSG_task_put(finalize, slaves[i], PORT_22);
}
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
free(slaves);
free(todo);
return 0;
res = MSG_task_get(&(task), PORT_22);
xbt_assert0(res == MSG_OK, "MSG_task_get failed");
- INFO1("Received \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task), "finalize")) {
MSG_task_destroy(task);
break;
}
- INFO1("Processing \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Processing \"%s\"", MSG_task_get_name(task));
MSG_task_execute(task);
- INFO1("\"%s\" done", MSG_task_get_name(task));
+ XBT_INFO("\"%s\" done", MSG_task_get_name(task));
MSG_task_destroy(task);
task = NULL;
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_slave */
for (i = 1; i < argc; i++) {
slaves[i - 1] = MSG_get_host_by_name(argv[i]);
if (slaves[i - 1] == NULL) {
- INFO1("Unknown host %s. Stopping Now! ", argv[i]);
+ XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
abort();
}
}
int a;
a = MSG_task_get(&(task), PORT_22);
if (a == MSG_OK) {
- INFO1("Received \"%s\"", MSG_task_get_name(task));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (MSG_task_get_data(task) == FINALIZE) {
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++)
MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE),
MSG_task_destroy(task);
break;
}
- INFO2("Sending \"%s\" to \"%s\"",
+ XBT_INFO("Sending \"%s\" to \"%s\"",
MSG_task_get_name(task), slaves[i % slaves_count]->name);
MSG_task_put(task, slaves[i % slaves_count], PORT_22);
i++;
} else {
- INFO0("Hey ?! What's up ? ");
+ XBT_INFO("Hey ?! What's up ? ");
xbt_assert0(0, "Unexpected behavior");
}
}
xbt_free(slaves);
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_forwarder */
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
int i;
- INFO2("Got %ld slaves and %ld tasks to process", slaves_count,
+ XBT_INFO("Got %ld slaves and %ld tasks to process", slaves_count,
number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size,
NULL);
if (number_of_tasks < 10000 || i % 10000 == 0)
- INFO3("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name,
+ XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", task->name,
number_of_tasks, mailbox);
MSG_task_send(task, mailbox);
}
- INFO0
+ XBT_INFO
("All tasks have been dispatched. Let's tell everybody the computation is over.");
for (i = 0; i < slaves_count; i++) {
char mailbox[80];
MSG_task_send(finalize, mailbox);
}
-// INFO0("Goodbye now!");
+// XBT_INFO("Goodbye now!");
return 0;
} /* end_of_master */
res = MSG_task_receive(&(task), mailbox);
xbt_assert0(res == MSG_OK, "MSG_task_get failed");
-// INFO1("Received \"%s\"", MSG_task_get_name(task));
+// XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task), "finalize")) {
MSG_task_destroy(task);
break;
}
-// INFO1("Processing \"%s\"", MSG_task_get_name(task));
+// XBT_INFO("Processing \"%s\"", MSG_task_get_name(task));
MSG_task_execute(task);
-// INFO1("\"%s\" done", MSG_task_get_name(task));
+// XBT_INFO("\"%s\" done", MSG_task_get_name(task));
MSG_task_destroy(task);
task = NULL;
}
- INFO0("I'm done. See you!");
+ XBT_INFO("I'm done. See you!");
return 0;
} /* end_of_slave */
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
}
MC_assert(atoi(MSG_task_get_name(task)) == 3);
- INFO0("OK");
+ XBT_INFO("OK");
return 0;
}
MSG_task_send(task, "mymailbox");
- INFO0("Sent!");
+ XBT_INFO("Sent!");
return 0;
}
val1 = (long) MSG_task_get_data(task1);
MSG_task_destroy(task1);
task1 = NULL;
- INFO1("Received %lu", val1);
+ XBT_INFO("Received %lu", val1);
MSG_task_receive(&task2, "mymailbox");
val2 = (long) MSG_task_get_data(task2);
MSG_task_destroy(task2);
task2 = NULL;
- INFO1("Received %lu", val2);
+ XBT_INFO("Received %lu", val2);
MC_assert(min(val1, val2) == 1);
MSG_task_receive(&task1, "mymailbox");
val1 = (long) MSG_task_get_data(task1);
MSG_task_destroy(task1);
- INFO1("Received %lu", val1);
+ XBT_INFO("Received %lu", val1);
MSG_task_receive(&task2, "mymailbox");
val2 = (long) MSG_task_get_data(task2);
MSG_task_destroy(task2);
- INFO1("Received %lu", val2);
+ XBT_INFO("Received %lu", val2);
- INFO0("OK");
+ XBT_INFO("OK");
return 0;
}
m_task_t task2 =
MSG_task_create("task", 0, 10000, (void *) atol(argv[1]));
- INFO1("Send %d!", atoi(argv[1]));
+ XBT_INFO("Send %d!", atoi(argv[1]));
MSG_task_send(task1, "mymailbox");
- INFO1("Send %d!", atoi(argv[1]));
+ XBT_INFO("Send %d!", atoi(argv[1]));
MSG_task_send(task2, "mymailbox");
return 0;
MSG_comm_wait(comm2, -1);
val1 = (long) MSG_task_get_data(task1);
- INFO1("Received %lu", val1);
+ XBT_INFO("Received %lu", val1);
MC_assert(val1 == 2);
- INFO0("OK");
+ XBT_INFO("OK");
return 0;
}
mbox = bprintf("mymailbox%s", argv[1]);
- INFO1("Send %d!", atoi(argv[1]));
+ XBT_INFO("Send %d!", atoi(argv[1]));
comm = MSG_task_isend(task1, mbox);
MSG_comm_wait(comm, -1);
if (!strcmp(kind, "request")) { // that's a request
char *req = MSG_task_get_data(task);
if (CS_used) { // need to push the request in the vector
- INFO0("CS already used. Queue the request");
+ XBT_INFO("CS already used. Queue the request");
xbt_dynar_push(requests, &req);
} else { // can serve it immediatly
- INFO0("CS idle. Grant immediatly");
+ XBT_INFO("CS idle. Grant immediatly");
m_task_t answer = MSG_task_create("grant", 0, 1000, NULL);
MSG_task_send(answer, req);
CS_used = 1;
}
} else { // that's a release. Check if someone was waiting for the lock
if (xbt_dynar_length(requests) > 0) {
- INFO1("CS release. Grant to queued requests (queue size: %lu)",
+ XBT_INFO("CS release. Grant to queued requests (queue size: %lu)",
xbt_dynar_length(requests));
char *req;
xbt_dynar_pop(requests, &req);
MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req);
todo--;
} else { // nobody wants it
- INFO0("CS release. resource now idle");
+ XBT_INFO("CS release. resource now idle");
CS_used = 0;
todo--;
}
}
MSG_task_destroy(task);
}
- INFO0("Received all releases, quit now");
+ XBT_INFO("Received all releases, quit now");
return 0;
}
// request the CS 3 times, sleeping a bit in between
int i;
for (i = 0; i < CS_PER_PROCESS; i++) {
- INFO0("Ask the request");
+ XBT_INFO("Ask the request");
MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox),
"coordinator");
// wait the answer
m_task_t grant = NULL;
MSG_task_receive(&grant, my_mailbox);
MSG_task_destroy(grant);
- INFO0("got the answer. Sleep a bit and release it");
+ XBT_INFO("got the answer. Sleep a bit and release it");
MSG_process_sleep(1);
MSG_task_send(MSG_task_create("release", 0, 1000, NULL),
"coordinator");
MSG_process_sleep(my_pid);
}
- INFO0("Got all the CS I wanted, quit now");
+ XBT_INFO("Got all the CS I wanted, quit now");
return 0;
}
{
int val;
val = MC_random(3, 6);
- INFO1("val=%d", val);
- INFO0("OK");
+ XBT_INFO("val=%d", val);
+ XBT_INFO("OK");
return 0;
}
static int emigrant(int argc, char *argv[])
{
m_task_t task;
- INFO0
+ XBT_INFO
("I'll look for a new job on another machine where the grass is greener.");
MSG_process_change_host(MSG_get_host_by_name("Boivin"));
- INFO0("Yeah, found something to do");
+ XBT_INFO("Yeah, found something to do");
task = MSG_task_create("job", 98095000, 0, NULL);
MSG_task_execute(task);
MSG_task_destroy(task);
MSG_process_sleep(2);
- INFO0("Moving back home after work");
+ XBT_INFO("Moving back home after work");
MSG_process_change_host(MSG_get_host_by_name("Jacquelin"));
MSG_process_change_host(MSG_get_host_by_name("Boivin"));
MSG_process_sleep(4);
- INFO0("Uh, nothing to do here. Stopping now");
+ XBT_INFO("Uh, nothing to do here. Stopping now");
return 0;
} /* end_of_emigrant */
*/
static int policeman(int argc, char *argv[])
{
- INFO0
+ XBT_INFO
("No function in the API to move the emigrant back, so do nothing.");
return 0;
} /* end_of_policeman */
/* Argument checking */
MSG_global_init(&argc, argv);
if (argc < 3) {
- CRITICAL1("Usage: %s platform_file deployment_file\n", argv[0]);
- CRITICAL1("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
+ XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
+ XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
argv[0]);
exit(1);
}
/* Run the simulation */
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
if (res == MSG_OK)
res = MSG_clean();
for(j=0; j < WORK; j++);
MSG_task_execute(task);
- INFO0("Task successfully executed");
+ XBT_INFO("Task successfully executed");
MSG_task_destroy(task);
}
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
for(j=0; j < WORK; j++);
MSG_task_send(task, mailbox);
- INFO1("Task sent to %s", mailbox);
+ XBT_INFO("Task sent to %s", mailbox);
}
return 0;
for(i=0; i < MAX_ITER; i++){
MSG_task_receive(&task, mailbox);
- INFO1("Task received to %s", mailbox);
+ XBT_INFO("Task received to %s", mailbox);
MSG_task_destroy(task);
task=NULL;
}
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
/* free(communication_amount); */
/* free(computation_amount); */
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
free(slaves);
return 0;
}
res = MSG_main();
xbt_free(hosts);
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
}
host_list_size = argc - 3;
- DEBUG1("host_list_size=%d", host_list_size);
+ XBT_DEBUG("host_list_size=%d", host_list_size);
m_host_list = calloc(host_list_size, sizeof(m_host_t));
for (i = 1; i <= host_list_size; i++) {
m_host_list[i - 1] = MSG_get_host_by_name(argv[i]);
xbt_free(m_host_list);
execution_time = MSG_get_clock() - execution_time;
- INFO1("execution_time=%g ", execution_time);
+ XBT_INFO("execution_time=%g ", execution_time);
return 0;
}
host_list_size = argc - 2;
- DEBUG1("host_list_size=%d", host_list_size);
+ XBT_DEBUG("host_list_size=%d", host_list_size);
m_host_list = calloc(host_list_size, sizeof(m_host_t));
for (i = 1; i <= host_list_size; i++) {
m_host_list[i - 1] = MSG_get_host_by_name(argv[i]);
xbt_free(m_host_list);
redistribution_time = MSG_get_clock() - redistribution_time;
- INFO1("redistribution_time=%g ", redistribution_time);
+ XBT_INFO("redistribution_time=%g ", redistribution_time);
return 0;
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
}
res = sscanf(argv[2], "%lg", &priority);
xbt_assert1(res, "Invalid argument %s\n", argv[2]);
- INFO2("Hello! Running a task of size %g with priority %g",
+ XBT_INFO("Hello! Running a task of size %g with priority %g",
computation_amount, priority);
task = MSG_task_create("Task", computation_amount, 0.0, NULL);
MSG_task_set_priority(task, priority);
MSG_task_execute(task);
MSG_task_destroy(task);
- INFO0("Goodbye now!");
+ XBT_INFO("Goodbye now!");
return 0;
}
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
}
const char *value;
char exist[] = "SG_TEST_Hdd";
- INFO0("== Print the properties of the host");
+ XBT_INFO("== Print the properties of the host");
xbt_dict_foreach(props, cursor, key, data)
- INFO2(" Host property: '%s' -> '%s'", key, data);
+ XBT_INFO(" Host property: '%s' -> '%s'", key, data);
- INFO0("== Try to get a host property that does not exist");
+ XBT_INFO("== Try to get a host property that does not exist");
value = MSG_host_get_property_value(host1, noexist);
xbt_assert0(!value, "The key exists (it's not supposed to)");
- INFO0("== Try to get a host property that does exist");
+ XBT_INFO("== Try to get a host property that does exist");
value = MSG_host_get_property_value(host1, exist);
xbt_assert1(value, "\tProperty %s is undefined (where it should)",
exist);
xbt_assert2(!strcmp(value, "180"),
"\tValue of property %s is defined to %s (where it should be 180)",
exist, value);
- INFO2(" Property: %s old value: %s", exist, value);
+ XBT_INFO(" Property: %s old value: %s", exist, value);
- INFO0("== Trying to modify a host property");
+ XBT_INFO("== Trying to modify a host property");
xbt_dict_set(props, exist, xbt_strdup("250"), xbt_free_f);
/* Test if we have changed the value */
xbt_assert2(!strcmp(value, "250"),
"Value of property %s is defined to %s (where it should be 250)",
exist, value);
- INFO2(" Property: %s old value: %s", exist, value);
+ XBT_INFO(" Property: %s old value: %s", exist, value);
return 0;
}
const char *noexist = "UnknownProcessProp";
const char *value;
- INFO0("== Print the properties of the process");
+ XBT_INFO("== Print the properties of the process");
xbt_dict_foreach(props, cursor, key, data)
- INFO2(" Process property: %s -> %s", key, data);
+ XBT_INFO(" Process property: %s -> %s", key, data);
- INFO0("== Try to get a process property that does not exist");
+ XBT_INFO("== Try to get a process property that does not exist");
value = MSG_process_get_property_value(MSG_process_self(), noexist);
xbt_assert0(!value, "The property is defined (it shouldnt)");
char sprintf_buffer_la[64];
char sprintf_buffer_bw[64];
- INFO0("sender");
+ XBT_INFO("sender");
/*host = xbt_new0(m_host_t,1); */
- INFO1("host = %s", argv[1]);
+ XBT_INFO("host = %s", argv[1]);
host = MSG_get_host_by_name(argv[1]);
if (host == NULL) {
- INFO1("Unknown host %s. Stopping Now! ", argv[1]);
+ XBT_INFO("Unknown host %s. Stopping Now! ", argv[1]);
abort();
}
MSG_task_create(sprintf_buffer_la, 0.0, task_comm_size_lat, NULL);
task_la->data = xbt_new(double, 1);
*(double *) task_la->data = time;
- INFO1("task_la->data = %le", *((double *) task_la->data));
+ XBT_INFO("task_la->data = %le", *((double *) task_la->data));
MSG_task_put(task_la, host, PORT_22);
/* Bandwidth */
MSG_task_create(sprintf_buffer_bw, 0.0, task_comm_size_bw, NULL);
task_bw->data = xbt_new(double, 1);
*(double *) task_bw->data = time;
- INFO1("task_bw->data = %le", *((double *) task_bw->data));
+ XBT_INFO("task_bw->data = %le", *((double *) task_bw->data));
MSG_task_put(task_bw, host, PORT_22);
return 0;
int a;
double communication_time = 0;
- INFO0("receiver");
+ XBT_INFO("receiver");
time = MSG_get_clock();
sender_time = *((double *) (task_la->data));
time = sender_time;
communication_time = time1 - time;
- INFO1("Task received : %s", task_la->name);
+ XBT_INFO("Task received : %s", task_la->name);
xbt_free(task_la->data);
MSG_task_destroy(task_la);
- INFO1("Communic. time %le", communication_time);
- INFO1("--- la %f ----", communication_time);
+ XBT_INFO("Communic. time %le", communication_time);
+ XBT_INFO("--- la %f ----", communication_time);
} else {
xbt_assert0(0, "Unexpected behavior");
}
sender_time = *((double *) (task_bw->data));
time = sender_time;
communication_time = time1 - time;
- INFO1("Task received : %s", task_bw->name);
+ XBT_INFO("Task received : %s", task_bw->name);
xbt_free(task_bw->data);
MSG_task_destroy(task_bw);
- INFO1("Communic. time %le", communication_time);
- INFO1("--- bw %f ----", task_comm_size_bw / communication_time);
+ XBT_INFO("Communic. time %le", communication_time);
+ XBT_INFO("--- bw %f ----", task_comm_size_bw / communication_time);
} else {
xbt_assert0(0, "Unexpected behavior");
}
- INFO0("test_all");
+ XBT_INFO("test_all");
/* Simulation setting */
MSG_set_channel_number(MAX_CHANNEL);
if (argc != 3) {
- CRITICAL1("Usage: %s platform_file deployment_file <model>\n",
+ XBT_CRITICAL("Usage: %s platform_file deployment_file <model>\n",
argv[0]);
- CRITICAL1
+ XBT_CRITICAL
("example: %s msg_platform.xml msg_deployment.xml KCCFLN05_Vegas\n",
argv[0]);
exit(1);
res = test_all(argv[1], argv[2]);
- INFO1("Total simulation time: %le", MSG_get_clock());
+ XBT_INFO("Total simulation time: %le", MSG_get_clock());
MSG_clean();
/** Lazy guy function. This process suspends itself asap. */
static int lazy_guy(int argc, char *argv[])
{
- INFO0("Nobody's watching me ? Let's go to sleep.");
+ XBT_INFO("Nobody's watching me ? Let's go to sleep.");
MSG_process_suspend(MSG_process_self());
- INFO0("Uuuh ? Did somebody call me ?");
- INFO0("Mmmh, goodbye now.");
+ XBT_INFO("Uuuh ? Did somebody call me ?");
+ XBT_INFO("Mmmh, goodbye now.");
return 0;
} /* end_of_lazy_guy */
{
m_process_t lazy = NULL;
- INFO0("Let's create a lazy guy.");
+ XBT_INFO("Let's create a lazy guy.");
lazy = MSG_process_create("Lazy", lazy_guy, NULL, MSG_host_self());
- INFO0("Let's wait a little bit...");
+ XBT_INFO("Let's wait a little bit...");
MSG_process_sleep(10.0);
- INFO0("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
+ XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
MSG_process_resume(lazy);
- INFO0("OK, goodbye now.");
+ XBT_INFO("OK, goodbye now.");
return 0;
} /* end_of_dram_master */
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */
MSG_global_init(&argc, argv);
if (argc < 3) {
- CRITICAL1("Usage: %s platform_file deployment_file\n", argv[0]);
- CRITICAL1("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
+ XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
+ XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
argv[0]);
exit(1);
}
task_comm_size,
NULL);
MSG_task_send(task_s,mailbox);
- INFO1("Send Data to \"%s\"", mailbox);
+ XBT_INFO("Send Data to \"%s\"", mailbox);
sprintf(mailbox, "host%d", num);
MSG_task_receive(&(task_r), mailbox);
- INFO1("Received \"%s\"", MSG_task_get_name(task_r));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task_r));
return 0;
}
sprintf(mailbox, "host%d", num);
MSG_task_receive(&(task_r), mailbox);
- INFO1("Received \"%s\"", MSG_task_get_name(task_r));
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task_r));
sprintf(mailbox, "host%d", num+1);
if(num == totalHosts-1)
sprintf(mailbox, "host%d", 0);
task_comm_size,
NULL);
MSG_task_send(task_s, mailbox);
- INFO1("Send Data to \"%s\"", mailbox);
+ XBT_INFO("Send Data to \"%s\"", mailbox);
return 0;
}
SURFXML_START_TAG(platform);
- DEBUG1("process : %s en master",MSG_host_get_name(hosts[0]));
+ XBT_DEBUG("process : %s en master",MSG_host_get_name(hosts[0]));
/* <process host="host A" function="master"> */
SURFXML_BUFFER_SET(process_host, MSG_host_get_name(hosts[0]));
SURFXML_BUFFER_SET(process_function, "master");
for(i=1;i<totalHosts;i++)
{
- DEBUG1("process : %s en slave",MSG_host_get_name(hosts[i]));
+ XBT_DEBUG("process : %s en slave",MSG_host_get_name(hosts[i]));
/* <process host="host A" function="slave"> */
SURFXML_BUFFER_SET(process_host,MSG_host_get_name(hosts[i]) );
SURFXML_BUFFER_SET(process_function, "slave");
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
MSG_clean();
task_comp_size = atof(argv[1]);
task_prio = atof(argv[2]);
- INFO0("Testing the trace integration cpu model: CpuTI");
- INFO1("Task size: %lf", task_comp_size);
- INFO1("Task prio: %lf", task_prio);
+ XBT_INFO("Testing the trace integration cpu model: CpuTI");
+ XBT_INFO("Task size: %lf", task_comp_size);
+ XBT_INFO("Task prio: %lf", task_prio);
/* Create and execute a single task. */
task = MSG_task_create("proc 0", task_comp_size, 0, NULL);
MSG_task_execute(task);
MSG_task_destroy(task);
- INFO0("Test finished");
+ XBT_INFO("Test finished");
return 0;
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
}
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
}
MSG_task_receive(&(task), "master_mailbox");
destination = (char*)MSG_task_get_data (task);
if (!destination) break; //there is no destination, die
- INFO1("Migrating to %s", destination);
+ XBT_INFO("Migrating to %s", destination);
MSG_process_change_host(MSG_get_host_by_name(destination));
MSG_process_sleep(2); // I am tired, have to sleep for 2 seconds
xbt_free (destination);
/* Argument checking */
MSG_global_init(&argc, argv);
if (argc < 3) {
- CRITICAL1("Usage: %s platform_file deployment_file\n", argv[0]);
- CRITICAL1("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
+ XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
+ XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
argv[0]);
exit(1);
}
/* Run the simulation */
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
if (res == MSG_OK)
res = MSG_clean();
double task_comp_size = atof(argv[2]);
double task_comm_size = atof(argv[3]);
long slaves_count = atol(argv[4]);
- INFO4("master %ld %f %f %ld", number_of_tasks, task_comp_size,
+ XBT_INFO("master %ld %f %f %ld", number_of_tasks, task_comp_size,
task_comm_size, slaves_count);
int i;
while (1) {
res = MSG_task_receive(&(task), "master_mailbox");
if (res != MSG_OK) {
- INFO0("error");
+ XBT_INFO("error");
break;
}
break;
}
- INFO1("Executing task %f", MSG_task_get_compute_duration(task));
+ XBT_INFO("Executing task %f", MSG_task_get_compute_duration(task));
MSG_task_execute(task);
- INFO0("End of execution");
+ XBT_INFO("End of execution");
MSG_task_destroy(task);
task = NULL;
}
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
}
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
}
/* Check our arguments */
if (argc < 3) {
- INFO1("Usage: %s platform_file dax_file [trace_file]", argv[0]);
- INFO1
+ XBT_INFO("Usage: %s platform_file dax_file [trace_file]", argv[0]);
+ XBT_INFO
("example: %s ../sd_platform.xml Montage_50.xml Montage_50.mytrace",
argv[0]);
exit(1);
dax = SD_daxload(argv[2]);
/* Display all the tasks */
- INFO0
+ XBT_INFO
("------------------- Display all tasks of the loaded DAG ---------------------------");
xbt_dynar_foreach(dax, cursor, task) {
SD_task_dump(task);
fclose(dotout);
/* Schedule them all on the first workstation */
- INFO0("------------------- Schedule tasks ---------------------------");
+ XBT_INFO("------------------- Schedule tasks ---------------------------");
const SD_workstation_t *ws_list = SD_workstation_get_list();
int totalHosts = SD_workstation_get_number();
qsort((void *) ws_list, totalHosts, sizeof(SD_workstation_t),
}
}
- INFO0
+ XBT_INFO
("------------------- Run the schedule ---------------------------");
changed = SD_simulate(-1);
xbt_dynar_free_container(&changed);
- INFO0
+ XBT_INFO
("------------------- Produce the trace file---------------------------");
- INFO1("Producing the trace of the run into %s", tracefilename);
+ XBT_INFO("Producing the trace of the run into %s", tracefilename);
FILE *out = fopen(tracefilename, "w");
xbt_assert1(out, "Cannot write to %s", tracefilename);
free(tracefilename);
/* Check our arguments */
if (argc < 3) {
- INFO1("Usage: %s platform_file dot_file [trace_file]", argv[0]);
- INFO1("example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0]);
+ XBT_INFO("Usage: %s platform_file dot_file [trace_file]", argv[0]);
+ XBT_INFO("example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0]);
exit(1);
}
char *tracefilename;
/* load the DOT file */
dot = SD_dotload(argv[2]);
if(dot == NULL){
- INFO0("No dot load may be you have a cycle in your graph");
+ XBT_INFO("No dot load may be you have a cycle in your graph");
return -1;
}
/* Display all the tasks */
- INFO0
+ XBT_INFO
("------------------- Display all tasks of the loaded DAG ---------------------------");
xbt_dynar_foreach(dot, cursor, task) {
SD_task_dump(task);
fclose(dotout);
/* Schedule them all on the first workstation */
- INFO0("------------------- Schedule tasks ---------------------------");
+ XBT_INFO("------------------- Schedule tasks ---------------------------");
const SD_workstation_t *ws_list = SD_workstation_get_list();
int count = SD_workstation_get_number();
}
}
- INFO0
+ XBT_INFO
("------------------- Run the schedule ---------------------------");
changed = SD_simulate(-1);
xbt_dynar_free_container(&changed);
- INFO0
+ XBT_INFO
("------------------- Produce the trace file---------------------------");
- INFO1("Producing the trace of the run into %s", tracefilename);
+ XBT_INFO("Producing the trace of the run into %s", tracefilename);
FILE *out = fopen(tracefilename, "w");
xbt_assert1(out, "Cannot write to %s", tracefilename);
free(tracefilename);
/* Check our arguments */
if (argc < 2) {
- INFO1("Usage: %s dot_file", argv[0]);
+ XBT_INFO("Usage: %s dot_file", argv[0]);
exit(1);
}
dot = SD_dotload(argv[1]);
/* Display all the tasks */
- INFO0
+ XBT_INFO
("------------------- Display all tasks of the loaded DAG ---------------------------");
xbt_dynar_foreach(dot, cursor, task) {
SD_task_dump(task);
}
- INFO0
+ XBT_INFO
("--------------------- Transform the dynar into an array ---------------------------");
cursor=0;
dot_as_array = (SD_task_t*) xbt_dynar_to_array(dot);
- INFO0
+ XBT_INFO
("----------------------------- dump tasks again ------------------------------------");
while ((task=dot_as_array[cursor++])){
SD_task_dump(task);
/* Check our arguments */
if (argc < 3) {
- INFO1("Usage: %s platform_file dot_file [trace_file]", argv[0]);
- INFO1("example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0]);
+ XBT_INFO("Usage: %s platform_file dot_file [trace_file]", argv[0]);
+ XBT_INFO("example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0]);
exit(1);
}
char *tracefilename;
/* load the DOT file and schedule tasks */
dot = SD_dotload_with_sched(argv[2]);
if(dot == NULL){
- INFO0("The dot file with the provided scheduling is wrong, more information with the option : --log=sd_dotparse.thres:verbose");
+ XBT_INFO("The dot file with the provided scheduling is wrong, more information with the option : --log=sd_dotparse.thres:verbose");
return -1;
}
/* Display all the tasks */
- INFO0
+ XBT_INFO
("------------------- Display all tasks of the loaded DAG ---------------------------");
xbt_dynar_foreach(dot, cursor, task) {
SD_task_dump(task);
fprintf(dotout, "}\n");
fclose(dotout);
- INFO0
+ XBT_INFO
("------------------- Run the schedule ---------------------------");
changed = SD_simulate(-1);
xbt_dynar_free_container(&changed);
- INFO0
+ XBT_INFO
("------------------- Produce the trace file---------------------------");
- INFO1("Producing the trace of the run into %s", tracefilename);
+ XBT_INFO("Producing the trace of the run into %s", tracefilename);
FILE *out = fopen(tracefilename, "w");
xbt_assert1(out, "Cannot write to %s", tracefilename);
free(tracefilename);
/* xbt_log_control_set("sd.thres=debug"); */
if (argc < 2) {
- INFO1("Usage: %s platform_file", argv[0]);
- INFO1("example: %s sd_platform.xml", argv[0]);
+ XBT_INFO("Usage: %s platform_file", argv[0]);
+ XBT_INFO("example: %s sd_platform.xml", argv[0]);
exit(1);
}
w2 = workstations[j];
name1 = SD_workstation_get_name(w1);
name2 = SD_workstation_get_name(w2);
- INFO2("Route between %s and %s:", name1, name2);
+ XBT_INFO("Route between %s and %s:", name1, name2);
route = SD_route_get_list(w1, w2);
route_size = SD_route_get_size(w1, w2);
for (k = 0; k < route_size; k++) {
- INFO3("\tLink %s: latency = %f, bandwidth = %f",
+ XBT_INFO("\tLink %s: latency = %f, bandwidth = %f",
SD_link_get_name(route[k]),
SD_link_get_current_latency(route[k]),
SD_link_get_current_bandwidth(route[k]));
/* initialisation of SD */
SD_init(&argc, argv);
if (argc < 2) {
- INFO1("Usage: %s platform_file", argv[0]);
- INFO1("example: %s sd_platform.xml", argv[0]);
+ XBT_INFO("Usage: %s platform_file", argv[0]);
+ XBT_INFO("example: %s sd_platform.xml", argv[0]);
exit(1);
}
SD_create_environment(argv[1]);
/* The host properties can be retrived from all interfaces */
- INFO1("Property list for workstation %s", name1);
+ XBT_INFO("Property list for workstation %s", name1);
/* Get the property list of the workstation 1 */
props = SD_workstation_get_properties(w1);
/* Print the properties of the workstation 1 */
xbt_dict_foreach(props, cursor, key, data) {
- INFO2("\tProperty: %s has value: %s", key, data);
+ XBT_INFO("\tProperty: %s has value: %s", key, data);
}
/* Try to get a property that does not exist */
value = SD_workstation_get_property_value(w1, noexist);
if (value == NULL)
- INFO1("\tProperty: %s is undefined", noexist);
+ XBT_INFO("\tProperty: %s is undefined", noexist);
else
- INFO2("\tProperty: %s has value: %s", noexist, value);
+ XBT_INFO("\tProperty: %s has value: %s", noexist, value);
- INFO1("Property list for workstation %s", name2);
+ XBT_INFO("Property list for workstation %s", name2);
/* Get the property list of the workstation 2 */
props = SD_workstation_get_properties(w2);
cursor = NULL;
/* Print the properties of the workstation 2 */
xbt_dict_foreach(props, cursor, key, data) {
- INFO2("\tProperty: %s on host: %s", key, data);
+ XBT_INFO("\tProperty: %s on host: %s", key, data);
}
/* Modify an existing property test. First check it exists */
- INFO0("Modify an existing property");
+ XBT_INFO("Modify an existing property");
value = SD_workstation_get_property_value(w2, exist);
if (value == NULL)
- INFO1("\tProperty: %s is undefined", exist);
+ XBT_INFO("\tProperty: %s is undefined", exist);
else {
- INFO2("\tProperty: %s old value: %s", exist, value);
+ XBT_INFO("\tProperty: %s old value: %s", exist, value);
xbt_dict_set(props, exist, strdup("250"), free);
}
/* Test if we have changed the value */
value = SD_workstation_get_property_value(w2, exist);
if (value == NULL)
- INFO1("\tProperty: %s is undefined", exist);
+ XBT_INFO("\tProperty: %s is undefined", exist);
else
- INFO2("\tProperty: %s new value: %s", exist, value);
+ XBT_INFO("\tProperty: %s new value: %s", exist, value);
SD_exit();
return 0;
xbt_dynar_push(ready_tasks, &task);
}
}
- DEBUG1("There are %lu ready tasks", xbt_dynar_length(ready_tasks));
+ XBT_DEBUG("There are %lu ready tasks", xbt_dynar_length(ready_tasks));
return ready_tasks;
}
grand_parents = SD_task_get_parents(parent);
if (xbt_dynar_length(grand_parents) > 1) {
- ERROR1("Warning: transfer %s has 2 parents",
+ XBT_ERROR("Warning: transfer %s has 2 parents",
SD_task_get_name(parent));
}
xbt_dynar_get_cpy(grand_parents, 0, &grand_parent);
for (i = 1; i < nworkstations; i++) {
EFT = finish_on_at(task, workstations[i]);
- DEBUG3("%s finishes on %s at %f",
+ XBT_DEBUG("%s finishes on %s at %f",
SD_task_get_name(task),
SD_workstation_get_name(workstations[i]), EFT);
/* Check our arguments */
if (argc < 3) {
- INFO1("Usage: %s platform_file dax_file [jedule_file]", argv[0]);
- INFO1
+ XBT_INFO("Usage: %s platform_file dax_file [jedule_file]", argv[0]);
+ XBT_INFO
("example: %s simulacrum_7_hosts.xml Montage_25.xml Montage_25.jed",
argv[0]);
exit(1);
* its best workstation.
*/
xbt_dynar_foreach(ready_tasks, cursor, task) {
- DEBUG1("%s is ready", SD_task_get_name(task));
+ XBT_DEBUG("%s is ready", SD_task_get_name(task));
workstation = SD_task_get_best_workstation(task);
finish_time = finish_on_at(task, workstation);
if (min_finish_time == -1. || finish_time < min_finish_time) {
}
}
- INFO2("Schedule %s on %s", SD_task_get_name(selected_task),
+ XBT_INFO("Schedule %s on %s", SD_task_get_name(selected_task),
SD_workstation_get_name(selected_workstation));
SD_task_schedulel(selected_task, 1, selected_workstation);
xbt_dynar_free_container(&changed);
}
- INFO1("Simulation Time: %f", SD_get_clock());
+ XBT_INFO("Simulation Time: %f", SD_get_clock());
- INFO0
+ XBT_INFO
("------------------- Produce the trace file---------------------------");
- INFO1("Producing the trace of the run into %s", tracefilename);
+ XBT_INFO("Producing the trace of the run into %s", tracefilename);
out = fopen(tracefilename, "w");
xbt_assert1(out, "Cannot write to %s", tracefilename);
free(tracefilename);
/* xbt_log_control_set("sd.thres=debug"); */
if (argc < 2) {
- INFO1("Usage: %s platform_file", argv[0]);
- INFO1("example: %s sd_platform.xml", argv[0]);
+ XBT_INFO("Usage: %s platform_file", argv[0]);
+ XBT_INFO("example: %s sd_platform.xml", argv[0]);
exit(1);
}
for (i = 0; i < 2; i++) {
SD_workstation_set_access_mode(workstations[i],
SD_WORKSTATION_SEQUENTIAL_ACCESS);
- INFO2("Access mode of %s is %s",
+ XBT_INFO("Access mode of %s is %s",
SD_workstation_get_name(workstations[i]),
(SD_workstation_get_access_mode(workstations[i]) ==
SD_WORKSTATION_SEQUENTIAL_ACCESS) ? "sequential" : "shared");
if (task)
kind = SD_task_get_kind(task);
else {
- INFO1("There is no task running on %s",
+ XBT_INFO("There is no task running on %s",
SD_workstation_get_name(workstations[i]));
continue;
}
switch (kind) {
case SD_TASK_COMP_SEQ:
- INFO2("%s is currently running on %s (SD_TASK_COMP_SEQ)",
+ XBT_INFO("%s is currently running on %s (SD_TASK_COMP_SEQ)",
SD_task_get_name(task),
SD_workstation_get_name(workstations[i]));
break;
case SD_TASK_COMM_E2E:
- INFO2("%s is currently running on %s (SD_TASK_COMM_E2E)",
+ XBT_INFO("%s is currently running on %s (SD_TASK_COMM_E2E)",
SD_task_get_name(task),
SD_workstation_get_name(workstations[i]));
break;
case SD_TASK_NOT_TYPED:
- INFO1("Task running on %s has no type",
+ XBT_INFO("Task running on %s has no type",
SD_workstation_get_name(workstations[i]));
break;
default:
- ERROR0("Shouldn't be here");
+ XBT_ERROR("Shouldn't be here");
}
}
xbt_dynar_free_container(&changed_tasks);
}
- DEBUG0("Destroying tasks...");
+ XBT_DEBUG("Destroying tasks...");
SD_task_destroy(taskA);
SD_task_destroy(taskB);
SD_task_destroy(taskC);
- DEBUG0("Tasks destroyed. Exiting SimDag...");
+ XBT_DEBUG("Tasks destroyed. Exiting SimDag...");
SD_exit();
return 0;
/* xbt_log_control_set("sd.thres=debug"); */
if (argc < 2) {
- INFO1("Usage: %s platform_file", argv[0]);
- INFO1("example: %s sd_platform.xml", argv[0]);
+ XBT_INFO("Usage: %s platform_file", argv[0]);
+ XBT_INFO("example: %s sd_platform.xml", argv[0]);
exit(1);
}
computation_amount2 = 1000000;
communication_amount12 = 2000000;
communication_amount21 = 3000000;
- INFO3("Computation time for %f flops on %s: %f", computation_amount1,
+ XBT_INFO("Computation time for %f flops on %s: %f", computation_amount1,
name1, SD_workstation_get_computation_time(w1,
computation_amount1));
- INFO3("Computation time for %f flops on %s: %f", computation_amount2,
+ XBT_INFO("Computation time for %f flops on %s: %f", computation_amount2,
name2, SD_workstation_get_computation_time(w2,
computation_amount2));
- INFO2("Route between %s and %s:", name1, name2);
+ XBT_INFO("Route between %s and %s:", name1, name2);
route = SD_route_get_list(w1, w2);
route_size = SD_route_get_size(w1, w2);
for (i = 0; i < route_size; i++) {
- INFO3(" Link %s: latency = %f, bandwidth = %f",
+ XBT_INFO(" Link %s: latency = %f, bandwidth = %f",
SD_link_get_name(route[i]),
SD_link_get_current_latency(route[i]),
SD_link_get_current_bandwidth(route[i]));
}
- INFO2("Route latency = %f, route bandwidth = %f",
+ XBT_INFO("Route latency = %f, route bandwidth = %f",
SD_route_get_current_latency(w1, w2),
SD_route_get_current_bandwidth(w1, w2));
- INFO4("Communication time for %f bytes between %s and %s: %f",
+ XBT_INFO("Communication time for %f bytes between %s and %s: %f",
communication_amount12, name1, name2,
SD_route_get_communication_time(w1, w2, communication_amount12));
- INFO4("Communication time for %f bytes between %s and %s: %f",
+ XBT_INFO("Communication time for %f bytes between %s and %s: %f",
communication_amount21, name2, name1,
SD_route_get_communication_time(w2, w1, communication_amount21));
/* estimated time */
task = taskD;
- INFO2("Estimated time for '%s': %f", SD_task_get_name(task),
+ XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(task),
SD_task_get_execution_time(task, workstation_number,
workstation_list, computation_amount,
communication_amount));
changed_tasks = SD_simulate(-1.0);
xbt_dynar_foreach(changed_tasks, ctr, task) {
- INFO3("Task '%s' start time: %f, finish time: %f",
+ XBT_INFO("Task '%s' start time: %f, finish time: %f",
SD_task_get_name(task),
SD_task_get_start_time(task), SD_task_get_finish_time(task));
}
xbt_dynar_free_container(&changed_tasks);
- DEBUG0("Destroying tasks...");
+ XBT_DEBUG("Destroying tasks...");
SD_task_destroy(taskA);
SD_task_destroy(taskB);
SD_task_destroy(taskC);
SD_task_destroy(taskD);
- DEBUG0("Tasks destroyed. Exiting SimDag...");
+ XBT_DEBUG("Tasks destroyed. Exiting SimDag...");
SD_exit();
return 0;
/* let's launch the simulation! */
changed_tasks = SD_simulate(-1.0);
- INFO1("Simulation time: %f", SD_get_clock());
+ XBT_INFO("Simulation time: %f", SD_get_clock());
xbt_dynar_free_container(&changed_tasks);
/* xbt_log_control_set("sd.thres=debug"); */
if (argc < 2) {
- INFO1("Usage: %s script_file", argv[0]);
- INFO1("example: %s sd_platform_script.lua", argv[0]);
+ XBT_INFO("Usage: %s script_file", argv[0]);
+ XBT_INFO("example: %s sd_platform_script.lua", argv[0]);
exit(1);
}
computation_amount2 = 1000000;
communication_amount12 = 2000000;
communication_amount21 = 3000000;
- INFO3("Computation time for %f flops on %s: %f", computation_amount1,
+ XBT_INFO("Computation time for %f flops on %s: %f", computation_amount1,
name1, SD_workstation_get_computation_time(w1,
computation_amount1));
- INFO3("Computation time for %f flops on %s: %f", computation_amount2,
+ XBT_INFO("Computation time for %f flops on %s: %f", computation_amount2,
name2, SD_workstation_get_computation_time(w2,
computation_amount2));
- INFO2("Route between %s and %s:", name1, name2);
+ XBT_INFO("Route between %s and %s:", name1, name2);
route = SD_route_get_list(w1, w2);
route_size = SD_route_get_size(w1, w2);
for (i = 0; i < route_size; i++) {
- INFO3(" Link %s: latency = %f, bandwidth = %f",
+ XBT_INFO(" Link %s: latency = %f, bandwidth = %f",
SD_link_get_name(route[i]),
SD_link_get_current_latency(route[i]),
SD_link_get_current_bandwidth(route[i]));
}
- INFO2("Route latency = %f, route bandwidth = %f",
+ XBT_INFO("Route latency = %f, route bandwidth = %f",
SD_route_get_current_latency(w1, w2),
SD_route_get_current_bandwidth(w1, w2));
- INFO4("Communication time for %f bytes between %s and %s: %f",
+ XBT_INFO("Communication time for %f bytes between %s and %s: %f",
communication_amount12, name1, name2,
SD_route_get_communication_time(w1, w2, communication_amount12));
- INFO4("Communication time for %f bytes between %s and %s: %f",
+ XBT_INFO("Communication time for %f bytes between %s and %s: %f",
communication_amount21, name2, name1,
SD_route_get_communication_time(w2, w1, communication_amount21));
/* estimated time */
task = taskD;
- INFO2("Estimated time for '%s': %f", SD_task_get_name(task),
+ XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(task),
SD_task_get_execution_time(task, workstation_number,
workstation_list, computation_amount,
communication_amount));
changed_tasks = SD_simulate(-1.0);
xbt_dynar_foreach(changed_tasks, ctr, task) {
- INFO3("Task '%s' start time: %f, finish time: %f",
+ XBT_INFO("Task '%s' start time: %f, finish time: %f",
SD_task_get_name(task),
SD_task_get_start_time(task), SD_task_get_finish_time(task));
}
xbt_dynar_free_container(&changed_tasks);
- DEBUG0("Destroying tasks...");
+ XBT_DEBUG("Destroying tasks...");
SD_task_destroy(taskA);
SD_task_destroy(taskB);
SD_task_destroy(taskC);
SD_task_destroy(taskD);
- DEBUG0("Tasks destroyed. Exiting SimDag...");
+ XBT_DEBUG("Tasks destroyed. Exiting SimDag...");
SD_exit();
return 0;
/* xbt_log_control_set("sd.thres=debug"); */
if (argc < 2) {
- INFO1("Usage: %s platform_file", argv[0]);
- INFO1("example: %s sd_platform.xml", argv[0]);
+ XBT_INFO("Usage: %s platform_file", argv[0]);
+ XBT_INFO("example: %s sd_platform.xml", argv[0]);
exit(1);
}
for (i = 0; i < 2; i++) {
SD_workstation_set_access_mode(workstations[i],
SD_WORKSTATION_SEQUENTIAL_ACCESS);
- INFO2("Access mode of %s is %s",
+ XBT_INFO("Access mode of %s is %s",
SD_workstation_get_name(workstations[i]),
(SD_workstation_get_access_mode(workstations[i]) ==
SD_WORKSTATION_SEQUENTIAL_ACCESS) ? "sequential" : "shared");
if (task)
kind = SD_task_get_kind(task);
else {
- INFO1("There is no task running on %s",
+ XBT_INFO("There is no task running on %s",
SD_workstation_get_name(workstations[i]));
continue;
}
switch (kind) {
case SD_TASK_COMP_SEQ:
- INFO2("%s is currently running on %s (SD_TASK_COMP_SEQ)",
+ XBT_INFO("%s is currently running on %s (SD_TASK_COMP_SEQ)",
SD_task_get_name(task),
SD_workstation_get_name(workstations[i]));
break;
case SD_TASK_COMM_E2E:
- INFO2("%s is currently running on %s (SD_TASK_COMM_E2E)",
+ XBT_INFO("%s is currently running on %s (SD_TASK_COMM_E2E)",
SD_task_get_name(task),
SD_workstation_get_name(workstations[i]));
break;
case SD_TASK_NOT_TYPED:
- INFO1("Task running on %s has no type",
+ XBT_INFO("Task running on %s has no type",
SD_workstation_get_name(workstations[i]));
break;
default:
- ERROR0("Shouldn't be here");
+ XBT_ERROR("Shouldn't be here");
}
}
xbt_dynar_free_container(&changed_tasks);
}
- DEBUG0("Destroying tasks...");
+ XBT_DEBUG("Destroying tasks...");
SD_task_destroy(taskA);
SD_task_destroy(taskB);
SD_task_destroy(taskC);
- DEBUG0("Tasks destroyed. Exiting SimDag...");
+ XBT_DEBUG("Tasks destroyed. Exiting SimDag...");
SD_exit();
return 0;
xbt_os_sem_destroy(sem);
- INFO1("sem_basic terminated with exit code %d (success)", EXIT_SUCCESS);
+ XBT_INFO("sem_basic terminated with exit code %d (success)", EXIT_SUCCESS);
return EXIT_SUCCESS;
int exit_code = 0;
xbt_os_sem_acquire(sem);
- INFO1("Hello i'm the thread %d", thread_index);
+ XBT_INFO("Hello i'm the thread %d", thread_index);
value++;
- INFO1("The new value of the global variable is %d, bye", value);
+ XBT_INFO("The new value of the global variable is %d, bye", value);
xbt_os_sem_release(sem);
xbt_os_thread_exit(&exit_code);
xbt_init(&argc, argv);
if (argc != 2) {
- INFO1("Usage: %s job count", argv[0]);
+ XBT_INFO("Usage: %s job count", argv[0]);
exit(EXIT_FAILURE);
}
sched = sched_new(size);
if (!sched) {
- INFO1("sched_new() failed : errno %d", errno);
+ XBT_INFO("sched_new() failed : errno %d", errno);
exit(EXIT_FAILURE);
}
/* initialize the scheduler */
if (sched_init(sched) < 0) {
sched_free(&sched);
- INFO1("sched_init() failed : errno %d\n", errno);
+ XBT_INFO("sched_init() failed : errno %d\n", errno);
exit(EXIT_FAILURE);
}
/* schedule the jobs */
if (sched_schedule(sched) < 0) {
sched_free(&sched);
- INFO1("sched_init() failed : errno %d", errno);
+ XBT_INFO("sched_init() failed : errno %d", errno);
exit(EXIT_FAILURE);
}
/* cleanup */
if (sched_clean(sched) < 0) {
sched_free(&sched);
- INFO1("sched_init() failed : errno %d", errno);
+ XBT_INFO("sched_init() failed : errno %d", errno);
exit(EXIT_FAILURE);
}
/* destroy the scheduler */
sched_free(&sched);
- INFO1("sem_sched terminated with exit code %d (success)", EXIT_SUCCESS);
+ XBT_INFO("sem_sched terminated with exit code %d (success)", EXIT_SUCCESS);
return EXIT_SUCCESS;
int exit_code = 1;
ctx_t ctx = (ctx_t) param;
- INFO1("Hello i'm the owner of the context %d, i'm waiting for starting",
+ XBT_INFO("Hello i'm the owner of the context %d, i'm waiting for starting",
ctx->index);
unschedule(ctx);
if (ctx->failure) {
- INFO1("0ups the scheduler initialization failed bye {%d}.",
+ XBT_INFO("0ups the scheduler initialization failed bye {%d}.",
ctx->index);
xbt_os_thread_exit(&exit_code);
}
- INFO1("I'm the owner of the context %d : I'm started", ctx->index);
- INFO0("Wait a minute, I do my job");
+ XBT_INFO("I'm the owner of the context %d : I'm started", ctx->index);
+ XBT_INFO("Wait a minute, I do my job");
/* do its job */
exit_code = job_execute(ctx->job);
- INFO1("Have finished my job, bye {%d}\n", ctx->index);
+ XBT_INFO("Have finished my job, bye {%d}\n", ctx->index);
xbt_os_sem_release(ctx->end);
{
int i = 0;
- INFO0
+ XBT_INFO
("I'm the job : I'm going to print all the args of my commande line");
- INFO1("-- Arguments (%d):", argc);
+ XBT_INFO("-- Arguments (%d):", argc);
for (i = 0; i < argc; i++)
- INFO2(" ---- [%i] %s", i, argv[i]);
+ XBT_INFO(" ---- [%i] %s", i, argv[i]);
return 0;
}
if (dynar->mutex) /* ie _dynar_lock(dynar) but not public */
xbt_mutex_acquire(dynar->mutex);
- //DEBUG1("Set cursor on %p to the first position", (void *) dynar);
+ //XBT_DEBUG("Set cursor on %p to the first position", (void *) dynar);
*cursor = 0;
}
{
if (idx >= dynar->used) {
- //DEBUG1("Cursor on %p already on last elem", (void *) dynar);
+ //XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
if (dynar->mutex) /* unlock */
xbt_mutex_release(dynar->mutex);
return FALSE;
}
- // DEBUG2("Cash out cursor on %p at %u", (void *) dynar, *idx);
+ // XBT_DEBUG("Cash out cursor on %p at %u", (void *) dynar, *idx);
memcpy(dst, ((char *) dynar->data) + idx * dynar->elmsize,
dynar->elmsize);
*/
#define XBT_HERE XBT_LOG(xbt_log_priority_trace, "-- was here")
-#define XBT_LOG_OLD_STYLE
#ifdef XBT_LOG_OLD_STYLE
/* Kept for backward compatibility. */
request->msg_amount = msg_amount;
request->peer.name = NULL;
request->peer.port = gras_socket_my_port(measMasterIn);
- DEBUG6
+ XBT_DEBUG
("Handshaking with %s:%d to connect it back on my %d (bufsize=%ld, msg_size=%ld, msg_amount=%ld)",
gras_socket_peer_name(peer), gras_socket_peer_port(peer),
request->peer.port, request->buf_size, request->msg_size,
("Error encountered while opening the measurement socket to %s:%d for BW test: %s",
gras_socket_peer_name(peer), request_ack->peer.port);
}
- DEBUG2
+ XBT_DEBUG
("Got ACK; conduct the experiment (msg_size = %ld, msg_amount=%ld)",
request->msg_size, request->msg_amount);
request->msg_size = 64 * 1024 * 1024;
}
- VERB5
+ XBT_VERB
("The experiment was too short (%f sec<%f sec). Redo it with msg_size=%lu (nb_messages=%lu) (got %fMb/s)",
meas_duration, min_duration, request->msg_size,
request->msg_amount,
TRY {
gras_socket_meas_send(measOut, 120, request->msg_size,
request->msg_amount);
- DEBUG0("Data sent. Wait ACK");
+ XBT_DEBUG("Data sent. Wait ACK");
gras_socket_meas_recv(measIn, 120, 1, 1);
} CATCH(e) {
gras_socket_close(measOut);
((double) request->msg_size) * ((double) request->msg_amount) /
(*sec);
}
- DEBUG1("Experiment done ; it took %f sec", *sec);
+ XBT_DEBUG("Experiment done ; it took %f sec", *sec);
if (*sec <= 0) {
- CRITICAL1("Nonpositive value (%f) found for BW test time.", *sec);
+ XBT_CRITICAL("Nonpositive value (%f) found for BW test time.", *sec);
}
} while (*sec < min_duration);
- DEBUG2
+ XBT_DEBUG
("This measurement was long enough (%f sec; found %f b/s). Stop peer",
*sec, *bw);
gras_msg_send(peer, "BW stop", NULL);
gras_msg_cb_ctx_t ctx_reask;
static xbt_dynar_t msgtwaited = NULL;
- DEBUG5
+ XBT_DEBUG
("Handshaked to connect to %s:%d (sizes: buf=%lu msg=%lu msg_amount=%lu)",
gras_socket_peer_name(expeditor), request->peer.port,
request->buf_size, request->msg_size, request->msg_amount);
TRY {
measIn = gras_socket_meas_accept(measMasterIn);
- DEBUG4
+ XBT_DEBUG
("BW handshake answered. buf_size=%lu msg_size=%lu msg_amount=%lu port=%d",
answer->buf_size, answer->msg_size, answer->msg_amount,
answer->peer.port);
tooshort = 1;
free(request);
request = (bw_request_t) payload;
- VERB0("Return the reasking RPC");
+ XBT_VERB("Return the reasking RPC");
gras_msg_rpcreturn(60, ctx_reask, NULL);
}
gras_msg_cb_ctx_free(ctx_reask);
gras_socket_close(measOut);
free(answer);
free(request);
- VERB0("BW experiment done.");
+ XBT_VERB("BW experiment done.");
return 0;
}
- DEBUG4("Ask for a BW test between %s:%d and %s:%d", from_name, from_port,
+ XBT_DEBUG("Ask for a BW test between %s:%d and %s:%d", from_name, from_port,
to_name, to_port);
gras_msg_rpccall(sock, 20 * 60, "BW request", &request, &result);
if (bw)
*bw = result->bw;
- VERB6("BW test (%s:%d -> %s:%d) took %f sec (%f kb/s)",
+ XBT_VERB("BW test (%s:%d -> %s:%d) took %f sec (%f kb/s)",
from_name, from_port, to_name, to_port,
result->sec, ((double) result->bw) / 1024.0);
gras_socket_t peer, asker;
asker = gras_msg_cb_ctx_from(ctx);
- VERB6("Asked by %s:%d to conduct a bw XP with %s:%d (request: %ld %ld)",
+ XBT_VERB("Asked by %s:%d to conduct a bw XP with %s:%d (request: %ld %ld)",
gras_socket_peer_name(asker), gras_socket_peer_port(asker),
request->peer.name, request->peer.port,
request->msg_size, request->msg_amount);
gras_socket_t sock;
sat_request_t request = xbt_new(s_sat_request_t, 1);
- VERB4("Start from_name %s:%d -> to_name %s:%d",
+ XBT_VERB("Start from_name %s:%d -> to_name %s:%d",
from_name, from_port, to_name, to_port);
sock = gras_socket_client(from_name, from_port);
sat_request_t request = *(sat_request_t *) payload;
gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
- VERB4("Asked by %s:%d to start a saturation to %s:%d",
+ XBT_VERB("Asked by %s:%d to start a saturation to %s:%d",
gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),
request->peer.name, request->peer.port);
/* Negociate the saturation with the peer */
sat_request_t request = xbt_new(s_sat_request_t, 1);
- DEBUG2("Begin to saturate to %s:%d", to_name, to_port);
+ XBT_DEBUG("Begin to saturate to %s:%d", to_name, to_port);
memset(&msg_got, 0, sizeof(msg_got));
request->msg_size = msg_size;
1, /* at least one sec */
&sec, &bw);
msg_size = request->msg_size = (int) bw;
- DEBUG1("Saturate with packets of %d bytes", request->msg_size);
+ XBT_DEBUG("Saturate with packets of %d bytes", request->msg_size);
}
/* Launch the saturation */
free(request);
gras_socket_close(peer_cmd);
- INFO4("Saturation(%s:%d->%s:%d) started", gras_os_myname(),
+ XBT_INFO("Saturation(%s:%d->%s:%d) started", gras_os_myname(),
gras_os_myport(), to_name, to_port);
/* Start experiment */
/* Check whether the experiment has to be terminated by now */
elapsed = gras_os_time() - start;
- DEBUG3("elapsed %f duration %f (msg_size=%d)", elapsed, duration,
+ XBT_DEBUG("elapsed %f duration %f (msg_size=%d)", elapsed, duration,
msg_size);
} while (saturate_further && (duration == 0 || elapsed < duration));
bw_res_t answer = xbt_new(s_bw_res_t, 1);
s_gras_msg_cb_ctx_t ctx;
- INFO6("Saturation from %s:%d to %s:%d stopped by %s:%d",
+ XBT_INFO("Saturation from %s:%d to %s:%d stopped by %s:%d",
gras_os_myname(), gras_os_myport(), to_name, to_port,
gras_socket_peer_name(msg_got.expe),
gras_socket_peer_port(msg_got.expe));
gras_msg_rpcreturn(60, &ctx, &answer);
free(answer);
} else {
- INFO6
+ XBT_INFO
("Saturation from %s:%d to %s:%d elapsed after %f sec (achieving %f kb/s)",
gras_os_myname(), gras_os_myport(), to_name, to_port, elapsed,
bw / 1024.0);
TRY {
meas = gras_socket_meas_accept(measMaster);
- DEBUG0("saturation handshake answered");
+ XBT_DEBUG("saturation handshake answered");
}
CATCH(e) {
gras_socket_close(measMaster);
xbt_ex_free(e);
}
}
- INFO4("Saturation comming from %s:%d stopped on %s:%d",
+ XBT_INFO("Saturation comming from %s:%d stopped on %s:%d",
gras_socket_peer_name(from), gras_socket_peer_port(from),
gras_os_myname(), gras_os_myport());
gras_socket_t sock = gras_socket_client(from_name, from_port);
bw_res_t answer;
- VERB2("Ask %s:%d to stop the saturation", from_name, from_port);
+ XBT_VERB("Ask %s:%d to stop the saturation", from_name, from_port);
TRY {
gras_msg_rpccall(sock, 60, "amok_bw_sat stop", NULL, &answer);
} CATCH(e) {
rank = xbt_dynar_length(group);
xbt_dynar_push(group, &dude);
- VERB3("Contacted by %s:%d. Give it rank #%d", dude->name, dude->port,
+ XBT_VERB("Contacted by %s:%d. Give it rank #%d", dude->name, dude->port,
rank);
gras_msg_rpcreturn(10, ctx, &rank);
goto end;
}
}
- WARN3("Asked to remove %s:%d from group '%s', but not found. Ignoring",
+ XBT_WARN("Asked to remove %s:%d from group '%s', but not found. Ignoring",
dude->name, dude->port, name);
end:
xbt_assert0(amok_pm_moddata_id != -1, "Run amok_pm_init first!");
g = gras_moddata_by_id(amok_pm_moddata_id);
- DEBUG1("retrieved groups=%p", g->groups);
+ XBT_DEBUG("retrieved groups=%p", g->groups);
xbt_dict_set(g->groups, group_name, res, NULL); /*FIXME: leaking xbt_dynar_free_voidp); */
- VERB1("Group %s created", group_name);
+ XBT_VERB("Group %s created", group_name);
return res;
}
int amok_pm_group_join(gras_socket_t master, const char *group_name)
{
int rank;
- VERB3("Join group '%s' on %s:%d",
+ XBT_VERB("Join group '%s' on %s:%d",
group_name, gras_socket_peer_name(master),
gras_socket_peer_port(master));
gras_msg_rpccall(master, 30, "amok_pm_join", &group_name, &rank);
- VERB4("Joined group '%s' on %s:%d. Got rank %d",
+ XBT_VERB("Joined group '%s' on %s:%d. Got rank %d",
group_name, gras_socket_peer_name(master),
gras_socket_peer_port(master), rank);
return rank;
void amok_pm_group_leave(gras_socket_t master, const char *group_name)
{
gras_msg_rpccall(master, 30, "amok_pm_leave", &group_name, NULL);
- VERB3("Leaved group '%s' on %s:%d",
+ XBT_VERB("Leaved group '%s' on %s:%d",
group_name, gras_socket_peer_name(master),
gras_socket_peer_port(master));
}
mode = lua_tostring(L, -1);
lua_pop(L, 1);
} else {
- ERROR0
+ XBT_ERROR
("Bad Arguments to AS.new, Should be a table with named arguments");
return -1;
}
lua_pop(L, 1);
} else {
- ERROR0
+ XBT_ERROR
("Bad Arguments to create host, Should be a table with named arguments");
return -1;
}
lua_pop(L, 1);
} else {
- ERROR0
+ XBT_ERROR
("Bad Arguments to create link, Should be a table with named arguments");
return -1;
}
{
link_id = lua_tostring(L, -1);
xbt_dynar_push(route->links_id, &link_id);
- DEBUG2("index = %f , Link_id = %s \n", lua_tonumber(L, -2),
+ XBT_DEBUG("index = %f , Link_id = %s \n", lua_tonumber(L, -2),
lua_tostring(L, -1));
lua_pop(L, 1);
}
lua_pop(L, 1);
}
else {
- ERROR0("Bad Arguments to create link, Should be a table with named arguments");
+ XBT_ERROR("Bad Arguments to create link, Should be a table with named arguments");
return -1;
}
return 0;
}
}
- ERROR1("Host : %s Not Found !!", host);
+ XBT_ERROR("Host : %s Not Found !!", host);
return 1;
}
}
p += sprintf(p, " "); /* put a separator */
}
- INFO2("%s%s", msg, buff);
+ XBT_INFO("%s%s", msg, buff);
}
/** @brief ensures that a userdata on the stack is a task and returns the pointer inside the userdata */
if (res != MSG_OK)
switch (res) {
case MSG_TIMEOUT:
- ERROR0("MSG_task_send failed : Timeout");
+ XBT_ERROR("MSG_task_send failed : Timeout");
break;
case MSG_TRANSFER_FAILURE:
- ERROR0("MSG_task_send failed : Transfer Failure");
+ XBT_ERROR("MSG_task_send failed : Transfer Failure");
break;
case MSG_HOST_FAILURE:
- ERROR0("MSG_task_send failed : Host Failure ");
+ XBT_ERROR("MSG_task_send failed : Host Failure ");
break;
default:
- ERROR0
+ XBT_ERROR
("MSG_task_send failed : Unexpected error , please report this bug");
break;
}
if (res != MSG_OK)
switch (res) {
case MSG_TIMEOUT:
- ERROR0("MSG_task_receive failed : Timeout");
+ XBT_ERROR("MSG_task_receive failed : Timeout");
break;
case MSG_TRANSFER_FAILURE:
- ERROR0("MSG_task_receive failed : Transfer Failure");
+ XBT_ERROR("MSG_task_receive failed : Transfer Failure");
break;
case MSG_HOST_FAILURE:
- ERROR0("MSG_task_receive failed : Host Failure ");
+ XBT_ERROR("MSG_task_receive failed : Host Failure ");
break;
default:
- ERROR0
+ XBT_ERROR
("MSG_task_receive failed : Unexpected error , please report this bug");
break;
}
static int Host_get_by_name(lua_State * L)
{
const char *name = luaL_checkstring(L, 1);
- DEBUG0("Getting Host from name...");
+ XBT_DEBUG("Getting Host from name...");
m_host_t msg_host = MSG_get_host_by_name(name);
if (!msg_host) {
luaL_error(L, "null Host : MSG_get_host_by_name failled");
xbt_realloc(process.argv, (process.argc) * sizeof(char *));
process.argv[(process.argc) - 1] = xbt_strdup(arg);
- DEBUG2("index = %f , arg = %s \n", lua_tonumber(L, -2),
+ XBT_DEBUG("index = %f , arg = %s \n", lua_tonumber(L, -2),
lua_tostring(L, -1));
lua_pop(L, 1);
}
static int run_lua_code(int argc, char **argv)
{
- DEBUG1("Run lua code %s", argv[0]);
+ XBT_DEBUG("Run lua code %s", argv[0]);
lua_State *L = lua_newthread(simgrid_lua_state);
int ref = luaL_ref(simgrid_lua_state, LUA_REGISTRYINDEX); // protect the thread from being garbage collected
int res = 1;
}
// cleanups
luaL_unref(simgrid_lua_state, LUA_REGISTRYINDEX, ref);
- DEBUG1("Execution of lua code %s is over", (argv ? argv[0] : "(null)"));
+ XBT_DEBUG("Execution of lua code %s is over", (argv ? argv[0] : "(null)"));
return res;
}
static int create_environment(lua_State * L)
{
const char *file = luaL_checkstring(L, 1);
- DEBUG1("Loading environment file %s", file);
+ XBT_DEBUG("Loading environment file %s", file);
MSG_create_environment(file);
/*
const char *name;
xbt_dict_foreach(hosts, c, name, host) {
- DEBUG1("We have an host %s", SIMIX_host_get_name(host));
+ XBT_DEBUG("We have an host %s", SIMIX_host_get_name(host));
}
*/
static int debug(lua_State * L)
{
const char *str = luaL_checkstring(L, 1);
- DEBUG1("%s", str);
+ XBT_DEBUG("%s", str);
return 0;
}
static int info(lua_State * L)
{
const char *str = luaL_checkstring(L, 1);
- INFO1("%s", str);
+ XBT_INFO("%s", str);
return 0;
}
__FILE__, LUA_MAX_ARGS_COUNT - 1);
argv[argc - 1] = (char *) luaL_checkstring(L, -1);
lua_pop(L, 1);
- DEBUG1("Got command line argument %s from lua", argv[argc - 1]);
+ XBT_DEBUG("Got command line argument %s from lua", argv[argc - 1]);
}
}
argv[argc--] = NULL;
/* Initialize the MSG core */
MSG_global_init(&argc, argv);
- DEBUG1("Still %d arguments on command line", argc); // FIXME: update the lua's arg table to reflect the changes from SimGrid
+ XBT_DEBUG("Still %d arguments on command line", argc); // FIXME: update the lua's arg table to reflect the changes from SimGrid
}
/* register the core C functions to lua */
luaL_register(L, "simgrid", simgrid_funcs);
rb_raise(rb_eRuntimeError,
"Internal error: Process name cannot be NULL");
name = RSTRING_PTR(fct_name);
- DEBUG1("Create native process %s", name);
+ XBT_DEBUG("Create native process %s", name);
char **argv = xbt_new(char *, 2);
argv[0] = bprintf("%s@%s", name, RSTRING_PTR(ht_name));
data = MSG_task_get_data(tk);
data->ruby_task = (void *) task;
MSG_task_set_data(tk, (void *) data);
- DEBUG1("Sending task %p", tk);
+ XBT_DEBUG("Sending task %p", tk);
rv = MSG_task_send(tk, RSTRING_PTR(mailbox));
if (rv != MSG_OK) {
if (rv == MSG_TRANSFER_FAILURE)
m_task_t task;
*ptask = NULL;
rb_data_t data = NULL;
- DEBUG2("Receiving a task on mailbox '%s', store it into %p",
+ XBT_DEBUG("Receiving a task on mailbox '%s', store it into %p",
RSTRING_PTR(mailbox), &task);
MSG_task_receive(ptask, RSTRING_PTR(mailbox));
task = *ptask;
Data_Get_Struct(task, s_m_task_t, tk);
rb_data_t rb_data = MSG_task_get_data(tk);
if (!rb_data->user_data)
- ERROR1("the task %s contain no user data", MSG_task_get_name(tk));
+ XBT_ERROR("the task %s contain no user data", MSG_task_get_name(tk));
return (VALUE) rb_data->user_data;
}
//Init Msg_Run From Ruby
static void msg_run(VALUE class)
{
- DEBUG0("Start Running...");
+ XBT_DEBUG("Start Running...");
m_host_t *hosts;
int cpt, host_count;
VALUE rbHost;
rb_raise(rb_eRuntimeError, "MSG_main() failed");
}
- DEBUG0
+ XBT_DEBUG
("MSG_main finished. Bail out before cleanup since there is a bug in this part.");
/* Cleanup Ruby hosts */
- DEBUG0("Clean Ruby World ");
+ XBT_DEBUG("Clean Ruby World ");
hosts = MSG_get_host_table();
host_count = MSG_get_host_number();
for (cpt = 0; cpt < host_count; cpt++) {
rb_raise(rb_eRuntimeError, "Bad Argument's Type");
const char *platform = RSTRING_PTR(plateformFile);
MSG_create_environment(platform);
- DEBUG1("Create Environment (%s)...Done", platform);
+ XBT_DEBUG("Create Environment (%s)...Done", platform);
}
//deploy Application
rb_application_handler_on_end_document();
- DEBUG1("Deploy Application(%s)...Done", dep_file);
+ XBT_DEBUG("Deploy Application(%s)...Done", dep_file);
}
// INFO
static void msg_info(VALUE class, VALUE msg)
{
const char *s = RSTRING_PTR(msg);
- INFO1("%s", s);
+ XBT_INFO("%s", s);
}
static void msg_debug(VALUE class, VALUE msg)
{
const char *s = RSTRING_PTR(msg);
- DEBUG1("%s", s);
+ XBT_DEBUG("%s", s);
}
// get Clock
}
SD_init(&argc, argv);
free(argv);
-// INFO0("SD Init...Done");
+// XBT_INFO("SD Init...Done");
printf("SD Init...Done\n");
return;
static void sd_info(VALUE class, VALUE msg)
{
const char *s = RSTRING(msg)->ptr;
-// INFO1("%s",s);
+// XBT_INFO("%s",s);
printf("%s\n", s);
}
char *varname = (char *) xbt_strdup(name);
xbt_ex_t e;
- DEBUG2("push(%s,%p)", name, (void *) data);
+ XBT_DEBUG("push(%s,%p)", name, (void *) data);
TRY {
varstack = xbt_dict_get(ps->space, name);
if (e.category != mismatch_error)
RETHROW;
- DEBUG1("Create a new variable stack for '%s' into the space", name);
+ XBT_DEBUG("Create a new variable stack for '%s' into the space", name);
varstack = xbt_dynar_new(sizeof(gras_cbps_elm_t *), NULL);
xbt_dict_set(ps->space, varname, (void **) varstack, NULL);
xbt_ex_free(e);
xbt_dynar_push(varstack, &var);
xbt_dynar_pop(ps->frames, &frame);
- DEBUG4("Push %s (%p @%p) into frame %p", varname, (void *) varname,
+ XBT_DEBUG("Push %s (%p @%p) into frame %p", varname, (void *) varname,
(void *) &varname, (void *) frame);
xbt_dynar_push(frame, &varname);
xbt_dynar_push(ps->frames, &frame);
void *data = NULL;
xbt_ex_t e;
- DEBUG1("pop(%s)", name);
+ XBT_DEBUG("pop(%s)", name);
TRY {
varstack = xbt_dict_get(ps->space, name);
} CATCH(e) {
xbt_dynar_pop(varstack, &var);
if (!xbt_dynar_length(varstack)) {
- DEBUG1("Last incarnation of %s poped. Kill it", name);
+ XBT_DEBUG("Last incarnation of %s poped. Kill it", name);
xbt_dict_remove(ps->space, name);
xbt_dynar_free(&varstack);
}
xbt_dynar_t dynar = NULL;
gras_cbps_elm_t elm = NULL;
- DEBUG1("set(%s)", name);
+ XBT_DEBUG("set(%s)", name);
dynar = xbt_dict_get_or_null(ps->space, name);
if (dynar == NULL) {
xbt_dynar_t dynar = NULL;
gras_cbps_elm_t elm = NULL;
- DEBUG1("get(%s)", name);
+ XBT_DEBUG("get(%s)", name);
dynar = xbt_dict_get(ps->space, name);
xbt_dynar_pop(dynar, &elm);
xbt_dynar_push(dynar, &elm);
xbt_dynar_t dynar = NULL;
- DEBUG0(">>> Block begin");
+ XBT_DEBUG(">>> Block begin");
dynar = xbt_dynar_new(sizeof(char *), NULL);
xbt_dynar_push(ps->frames, &dynar);
}
xbt_dynar_t varstack = NULL;
gras_cbps_elm_t var = NULL;
- DEBUG2("Get ride of %s (%p)", name, (void *) name);
+ XBT_DEBUG("Get ride of %s (%p)", name, (void *) name);
varstack = xbt_dict_get(ps->space, name);
xbt_dynar_pop(varstack, &var);
free(name);
}
xbt_dynar_free_container(&frame); /* we just emptied it */
- DEBUG0("<<< Block end");
+ XBT_DEBUG("<<< Block end");
}
/** \brief Push a new integer value into the cbps. */
void gras_cbps_i_push(gras_cbps_t ps, int val)
{
- DEBUG1("push %d as a size", val);
+ XBT_DEBUG("push %d as a size", val);
xbt_dynar_push_as(ps->lints, int, val);
}
xbt_assert0(xbt_dynar_length(ps->lints) > 0,
"gras_cbps_i_pop: no value to pop");
ret = xbt_dynar_pop_as(ps->lints, int);
- DEBUG1("pop %d as a size", ret);
+ XBT_DEBUG("pop %d as a size", ret);
return ret;
}
{
int old = *(int *) data;
int new = gras_cbps_i_pop(vars);
- DEBUG2("push %d x %d as a size", old, new);
+ XBT_DEBUG("push %d x %d as a size", old, new);
gras_cbps_i_push(vars, old * new);
}
unsigned int old = *(unsigned int *) data;
unsigned int new = gras_cbps_i_pop(vars);
- DEBUG2("push %d x %d as a size", old, new);
+ XBT_DEBUG("push %d x %d as a size", old, new);
gras_cbps_i_push(vars, (int) (old * new));
}
unsigned long int old = *(unsigned long int *) data;
unsigned long int new = gras_cbps_i_pop(vars);
- DEBUG2("push %ld x %ld as a size", old, new);
+ XBT_DEBUG("push %ld x %ld as a size", old, new);
gras_cbps_i_push(vars, (int) (old * new));
}
if (gras_datadesc_set_local != NULL)
return;
- VERB0("Initializing DataDesc");
+ XBT_VERB("Initializing DataDesc");
gras_datadesc_set_local = xbt_set_new();
**/
void gras_datadesc_exit(void)
{
- VERB0("Exiting DataDesc");
+ XBT_VERB("Exiting DataDesc");
xbt_set_free(&gras_datadesc_set_local);
xbt_dict_free(&gras_dd_constants);
- DEBUG0("Exited DataDesc");
+ XBT_DEBUG("Exited DataDesc");
}
/** This is mainly to debug */
r_size = type->size[r_arch];
l_size = type->size[GRAS_THISARCH];
- DEBUG4("r_size=%lu l_size=%lu, src=%p dst=%p", r_size, l_size, src,
+ XBT_DEBUG("r_size=%lu l_size=%lu, src=%p dst=%p", r_size, l_size, src,
dst);
- DEBUG2("remote=%c local=%c", gras_arches[r_arch].endian ? 'B' : 'l',
+ XBT_DEBUG("remote=%c local=%c", gras_arches[r_arch].endian ? 'B' : 'l',
gras_arches[GRAS_THISARCH].endian ? 'B' : 'l');
if (r_size != l_size) {
int lowOrderFirst = !gras_arches[r_arch].endian ||
gras_arches[r_arch].endian == gras_arches[GRAS_THISARCH].endian;
- DEBUG5("Resize integer %d from %lu @%p to %lu @%p",
+ XBT_DEBUG("Resize integer %d from %lu @%p to %lu @%p",
cpt, r_size, r_data, l_size, l_data);
xbt_assert0(r_data != l_data, "Impossible to resize in place");
if (sizeChange < 0) {
- DEBUG3("Truncate %d bytes (%s,%s)", -sizeChange,
+ XBT_DEBUG("Truncate %d bytes (%s,%s)", -sizeChange,
lowOrderFirst ? "lowOrderFirst" : "bigOrderFirst",
scal.encoding ==
e_gras_dd_scalar_encoding_sint ? "signed" : "unsigned");
: r_data, l_size);
if (scal.encoding == e_gras_dd_scalar_encoding_sint) {
- DEBUG0("This is signed");
+ XBT_DEBUG("This is signed");
/* Make sure the high order bit of r_data and l_data are the same */
l_sign = gras_arches[GRAS_THISARCH].endian
? ((unsigned char *) l_data + l_size - 1)
r_sign = gras_arches[r_arch].endian
? ((unsigned char *) r_data + r_size - 1)
: (unsigned char *) r_data;
- DEBUG2("This is signed (r_sign=%c l_sign=%c", *r_sign, *l_sign);
+ XBT_DEBUG("This is signed (r_sign=%c l_sign=%c", *r_sign, *l_sign);
if ((*r_sign > 127) != (*l_sign > 127)) {
if (*r_sign > 127)
}
}
} else {
- DEBUG1("Extend %d bytes", sizeChange);
+ XBT_DEBUG("Extend %d bytes", sizeChange);
if (scal.encoding != e_gras_dd_scalar_encoding_sint) {
- DEBUG0("This is signed");
+ XBT_DEBUG("This is signed");
padding = 0; /* pad unsigned with 0 */
} else {
/* extend sign */
for (cpt = 0, r_data = dst, l_data = dst; cpt < count; cpt++, r_data = (char *) r_data + l_size, /* resizing already done */
l_data = (char *) l_data + l_size) {
- DEBUG1("Flip elm %d", cpt);
+ XBT_DEBUG("Flip elm %d", cpt);
gras_dd_reverse_bytes(l_data, r_data, l_size);
}
}
{
gras_datadesc_type_t res;
- XBT_IN1("(%s)", name);
+ XBT_IN_F("(%s)", name);
res = xbt_new0(s_gras_datadesc_type_t, 1);
res->name = (char *) strdup(name);
"Redefinition of type %s does not match", name);
xbt_assert1(res->category.scalar_data.type == type,
"Redefinition of type %s does not match", name);
- VERB1("Discarding redefinition of %s", name);
+ XBT_VERB("Discarding redefinition of %s", name);
return res;
}
res = gras_ddt_new(name);
gras_datadesc_type_t res;
long int arch;
- XBT_IN1("(%s)", name);
+ XBT_IN_F("(%s)", name);
res = gras_datadesc_by_name_or_null(name);
if (res) {
/* FIXME: Check that field redefinition matches */
xbt_assert1(res->category_code == e_gras_datadesc_type_cat_struct,
"Redefinition of type %s does not match", name);
- DEBUG1("Discarding redefinition of %s", name);
+ XBT_DEBUG("Discarding redefinition of %s", name);
return res;
}
res = gras_ddt_new(name);
xbt_assert2(field_type,
"Cannot add the field '%s' into struct '%s': its type is NULL",
name, struct_type->name);
- XBT_IN3("(%s %s.%s;)", field_type->name, struct_type->name, name);
+ XBT_IN_F("(%s %s.%s;)", field_type->name, struct_type->name, name);
if (struct_type->category.struct_data.closed) {
- DEBUG1
+ XBT_DEBUG
("Ignoring request to add field to struct %s (closed. Redefinition?)",
struct_type->name);
return;
field = xbt_new(s_gras_dd_cat_field_t, 1);
field->name = (char *) strdup(name);
- DEBUG0("----------------");
- DEBUG3("PRE s={size=%ld,align=%ld,asize=%ld}",
+ XBT_DEBUG("----------------");
+ XBT_DEBUG("PRE s={size=%ld,align=%ld,asize=%ld}",
struct_type->size[GRAS_THISARCH],
struct_type->alignment[GRAS_THISARCH],
struct_type->aligned_size[GRAS_THISARCH]);
xbt_dynar_push(struct_type->category.struct_data.fields, &field);
- DEBUG3("Push a %s into %s at offset %ld.",
+ XBT_DEBUG("Push a %s into %s at offset %ld.",
field_type->name, struct_type->name,
field->offset[GRAS_THISARCH]);
- DEBUG3(" f={size=%ld,align=%ld,asize=%ld}",
+ XBT_DEBUG(" f={size=%ld,align=%ld,asize=%ld}",
field_type->size[GRAS_THISARCH],
field_type->alignment[GRAS_THISARCH],
field_type->aligned_size[GRAS_THISARCH]);
- DEBUG3(" s={size=%ld,align=%ld,asize=%ld}",
+ XBT_DEBUG(" s={size=%ld,align=%ld,asize=%ld}",
struct_type->size[GRAS_THISARCH],
struct_type->alignment[GRAS_THISARCH],
struct_type->aligned_size[GRAS_THISARCH]);
for (arch = 0; arch < gras_arch_count; arch++) {
struct_type->size[arch] = struct_type->aligned_size[arch];
}
- DEBUG4("structure %s closed. size=%ld,align=%ld,asize=%ld",
+ XBT_DEBUG("structure %s closed. size=%ld,align=%ld,asize=%ld",
struct_type->name,
struct_type->size[GRAS_THISARCH],
struct_type->alignment[GRAS_THISARCH],
gras_datadesc_type_t res;
int arch;
- XBT_IN1("(%s)", name);
+ XBT_IN_F("(%s)", name);
xbt_assert0(selector,
"Attempt to creat an union without field_count function");
"Redefinition of type %s does not match", name);
xbt_assert1(res->category.union_data.selector == selector,
"Redefinition of type %s does not match", name);
- VERB1("Discarding redefinition of %s", name);
+ XBT_VERB("Discarding redefinition of %s", name);
return res;
}
gras_dd_cat_field_t field;
int arch;
- XBT_IN3("(%s %s.%s;)", field_type->name, union_type->name, name);
+ XBT_IN_F("(%s %s.%s;)", field_type->name, union_type->name, name);
xbt_assert1(field_type->size[GRAS_THISARCH] >= 0,
"Cannot add a dynamically sized field in union %s",
union_type->name);
if (union_type->category.union_data.closed) {
- VERB1("Ignoring request to add field to union %s (closed)",
+ XBT_VERB("Ignoring request to add field to union %s (closed)",
union_type->name);
return;
}
gras_datadesc_by_name("data pointer");
int arch;
- XBT_IN1("(%s)", name);
+ XBT_IN_F("(%s)", name);
res = gras_datadesc_by_name_or_null(name);
if (res) {
xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
"Redefinition of %s does not match", name);
xbt_assert1(res->category.ref_data.selector == NULL,
"Redefinition of %s does not match", name);
- DEBUG1("Discarding redefinition of %s", name);
+ XBT_DEBUG("Discarding redefinition of %s", name);
return res;
}
gras_datadesc_by_name("data pointer");
int arch;
- XBT_IN1("(%s)", name);
+ XBT_IN_F("(%s)", name);
res = gras_datadesc_by_name_or_null(name);
if (res) {
"Redefinition of type %s does not match", name);
xbt_assert1(res->category.ref_data.selector == selector,
"Redefinition of type %s does not match", name);
- VERB1("Discarding redefinition of %s", name);
+ XBT_VERB("Discarding redefinition of %s", name);
return res;
}
res = gras_ddt_new(name);
gras_datadesc_type_t res;
int arch;
- XBT_IN1("(%s)", name);
+ XBT_IN_F("(%s)", name);
res = gras_datadesc_by_name_or_null(name);
if (res) {
xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array,
"Redefinition of type %s does not match", name);
if (res->category.array_data.type != element_type) {
- ERROR1
+ XBT_ERROR
("Redefinition of type %s does not match: array elements differ",
name);
gras_datadesc_type_dump(res->category.array_data.type);
"Redefinition of type %s does not match", name);
xbt_assert1(res->category.array_data.dynamic_size == NULL,
"Redefinition of type %s does not match", name);
- VERB1("Discarding redefinition of %s", name);
+ XBT_VERB("Discarding redefinition of %s", name);
return res;
}
gras_datadesc_type_t res;
int arch;
- XBT_IN1("(%s)", name);
+ XBT_IN_F("(%s)", name);
xbt_assert1(dynamic_size,
"'%s' is a dynamic array without size discriminant", name);
"Redefinition of type %s does not match", name);
xbt_assert1(res->category.array_data.dynamic_size == dynamic_size,
"Redefinition of type %s does not match", name);
- VERB1("Discarding redefinition of %s", name);
+ XBT_VERB("Discarding redefinition of %s", name);
return res;
}
subtype = subtype->category.ref_data.type;
subtype = subtype->category.array_data.type;
- DEBUG1("subtype is %s", subtype->name);
+ XBT_DEBUG("subtype is %s", subtype->name);
dynar->elmsize = subtype->size[GRAS_THISARCH];
dynar->size = dynar->used;
subtype = subtype->category.ref_data.type;
subtype = subtype->category.array_data.type;
- DEBUG1("subtype is %s", subtype->name);
+ XBT_DEBUG("subtype is %s", subtype->name);
matrix->elmsize = subtype->size[GRAS_THISARCH];
}
} else if (type->category_code == e_gras_datadesc_type_cat_struct) {
field_array = type->category.struct_data.fields;
} else {
- ERROR2("%s (%p) is not a struct nor an union. There is no field.",
+ XBT_ERROR("%s (%p) is not a struct nor an union. There is no field.",
type->name, (void *) type);
xbt_abort();
}
return field;
}
}
- ERROR2("No field named '%s' in '%s'", field_name, type->name);
+ XBT_ERROR("No field named '%s' in '%s'", field_name, type->name);
xbt_abort();
}
gras_dd_cat_field_t field = gras_dd_find_field(type, field_name);
gras_datadesc_type_t sub_type = field->type;
- DEBUG3("add a PUSHy cb to '%s' field (type '%s') of '%s'",
+ XBT_DEBUG("add a PUSHy cb to '%s' field (type '%s') of '%s'",
field_name, sub_type->name, type->name);
if (!strcmp("int", sub_type->name)) {
field->send = gras_datadesc_cb_push_int;
} else if (!strcmp("unsigned long int", sub_type->name)) {
field->send = gras_datadesc_cb_push_ulint;
} else {
- ERROR1
+ XBT_ERROR
("Field %s is not an int, unsigned int, long int neither unsigned long int",
sub_type->name);
xbt_abort();
gras_dd_cat_field_t field = gras_dd_find_field(type, field_name);
gras_datadesc_type_t sub_type = field->type;
- DEBUG3("add a MPUSHy cb to '%s' field (type '%s') of '%s'",
+ XBT_DEBUG("add a MPUSHy cb to '%s' field (type '%s') of '%s'",
field_name, sub_type->name, type->name);
if (!strcmp("int", sub_type->name)) {
field->send = gras_datadesc_cb_push_int_mult;
} else if (!strcmp("unsigned long int", sub_type->name)) {
field->send = gras_datadesc_cb_push_ulint_mult;
} else {
- ERROR1
+ XBT_ERROR
("Field %s is not an int, unsigned int, long int neither unsigned long int",
sub_type->name);
xbt_abort();
void gras_datadesc_free(gras_datadesc_type_t * type)
{
- DEBUG1("Let's free ddt %s", (*type)->name);
+ XBT_DEBUG("Let's free ddt %s", (*type)->name);
switch ((*type)->category_code) {
case e_gras_datadesc_type_cat_scalar:
return 0; /* easy optimization */
if (!d1 && d2) {
- DEBUG0("ddt_cmp: !d1 && d2 => 1");
+ XBT_DEBUG("ddt_cmp: !d1 && d2 => 1");
return 1;
}
if (!d1 && !d2) {
- DEBUG0("ddt_cmp: !d1 && !d2 => 0");
+ XBT_DEBUG("ddt_cmp: !d1 && !d2 => 0");
return 0;
}
if (d1 && !d2) {
- DEBUG0("ddt_cmp: d1 && !d2 => -1");
+ XBT_DEBUG("ddt_cmp: d1 && !d2 => -1");
return -1;
}
for (cpt = 0; cpt < gras_arch_count; cpt++) {
if (d1->size[cpt] != d2->size[cpt]) {
- DEBUG5("ddt_cmp: %s->size=%ld != %s->size=%ld (on %s)",
+ XBT_DEBUG("ddt_cmp: %s->size=%ld != %s->size=%ld (on %s)",
d1->name, d1->size[cpt], d2->name, d2->size[cpt],
gras_arches[cpt].name);
return d1->size[cpt] > d2->size[cpt] ? 1 : -1;
}
if (d1->alignment[cpt] != d2->alignment[cpt]) {
- DEBUG5("ddt_cmp: %s->alignment=%ld != %s->alignment=%ld (on %s)",
+ XBT_DEBUG("ddt_cmp: %s->alignment=%ld != %s->alignment=%ld (on %s)",
d1->name, d1->alignment[cpt], d2->name, d2->alignment[cpt],
gras_arches[cpt].name);
return d1->alignment[cpt] > d2->alignment[cpt] ? 1 : -1;
}
if (d1->aligned_size[cpt] != d2->aligned_size[cpt]) {
- DEBUG5
+ XBT_DEBUG
("ddt_cmp: %s->aligned_size=%ld != %s->aligned_size=%ld (on %s)",
d1->name, d1->aligned_size[cpt], d2->name,
d2->aligned_size[cpt], gras_arches[cpt].name);
}
if (d1->category_code != d2->category_code) {
- DEBUG4("ddt_cmp: %s->cat=%s != %s->cat=%s",
+ XBT_DEBUG("ddt_cmp: %s->cat=%s != %s->cat=%s",
d1->name, gras_datadesc_cat_names[d1->category_code],
d2->name, gras_datadesc_cat_names[d2->category_code]);
return d1->category_code > d2->category_code ? 1 : -1;
}
if (d1->send != d2->send) {
- DEBUG4("ddt_cmp: %s->send=%p != %s->send=%p",
+ XBT_DEBUG("ddt_cmp: %s->send=%p != %s->send=%p",
d1->name, (void *) d1->send, d2->name, (void *) d2->send);
return 1; /* ISO C forbids ordered comparisons of pointers to functions */
}
if (d1->recv != d2->recv) {
- DEBUG4("ddt_cmp: %s->recv=%p != %s->recv=%p",
+ XBT_DEBUG("ddt_cmp: %s->recv=%p != %s->recv=%p",
d1->name, (void *) d1->recv, d2->name, (void *) d2->recv);
return 1; /* ISO C forbids ordered comparisons of pointers to functions */
}
case e_gras_datadesc_type_cat_struct:
if (xbt_dynar_length(d1->category.struct_data.fields) !=
xbt_dynar_length(d2->category.struct_data.fields)) {
- DEBUG4("ddt_cmp: %s (having %lu fields) != %s (having %lu fields)",
+ XBT_DEBUG("ddt_cmp: %s (having %lu fields) != %s (having %lu fields)",
d1->name, xbt_dynar_length(d1->category.struct_data.fields),
d2->name, xbt_dynar_length(d2->category.struct_data.fields));
field_desc_2 = field2->type;
ret = gras_datadesc_type_cmp(field_desc_1, field_desc_2);
if (ret) {
- DEBUG6("%s->field[%d]=%s != %s->field[%d]=%s",
+ XBT_DEBUG("%s->field[%d]=%s != %s->field[%d]=%s",
d1->name, cpt, field1->name, d2->name, cpt, field2->name);
return ret;
}
xbt_assert(int_type);
}
- DEBUG1("send_int(%u)", *i);
+ XBT_DEBUG("send_int(%u)", *i);
gras_trp_send(sock, (char *) i, int_type->size[GRAS_THISARCH], stable);
}
gras_dd_convert_elm(int_type, 1, r_arch, ptr, i);
free(ptr);
}
- DEBUG1("recv_int(%u)", *i);
+ XBT_DEBUG("recv_int(%u)", *i);
}
/*
l_data = xbt_malloc((size_t) size);
*l_ref = l_data;
- DEBUG5
+ XBT_DEBUG
("alloc_ref: l_data=%p, &l_data=%p; r_ref=%p; *r_ref=%p, r_len=%ld",
(void *) l_data, (void *) &l_data, (void *) r_ref,
(void *) (r_ref ? *r_ref : NULL), r_len);
memcpy(ptr, l_ref, sizeof(void *));
- DEBUG2("Insert l_ref=%p under r_ref=%p", *(void **) ptr,
+ XBT_DEBUG("Insert l_ref=%p under r_ref=%p", *(void **) ptr,
*(void **) r_ref);
if (detect_cycle)
gras_datadesc_type_t sub_type; /* type on which we recurse */
int count = 0;
- VERB5("Copy a %s (%s) from %p to %p (local sizeof=%ld)",
+ XBT_VERB("Copy a %s (%s) from %p to %p (local sizeof=%ld)",
type->name, gras_datadesc_cat_names[type->category_code],
src, dst, type->size[GRAS_THISARCH]);
xbt_assert1(struct_data.closed,
"Please call gras_datadesc_declare_struct_close on %s before copying it",
type->name);
- VERB1(">> Copy all fields of the structure %s", type->name);
+ XBT_VERB(">> Copy all fields of the structure %s", type->name);
xbt_dynar_foreach(struct_data.fields, cpt, field) {
field_src = src + field->offset[GRAS_THISARCH];
field_dst = dst + field->offset[GRAS_THISARCH];
if (field->send)
field->send(type, state, field_src);
- DEBUG1("Copy field %s", field->name);
+ XBT_DEBUG("Copy field %s", field->name);
count +=
gras_datadesc_memcpy_rec(state, refs, sub_type, field_src,
field_dst, 0, detect_cycle
if (XBT_LOG_ISENABLED(gras_ddt_exchange, xbt_log_priority_verbose)) {
if (sub_type == gras_datadesc_by_name("unsigned int")) {
- VERB2("Copied value for field '%s': %d (type: unsigned int)",
+ XBT_VERB("Copied value for field '%s': %d (type: unsigned int)",
field->name, *(unsigned int *) field_dst);
} else if (sub_type == gras_datadesc_by_name("int")) {
- VERB2("Copied value for field '%s': %d (type: int)",
+ XBT_VERB("Copied value for field '%s': %d (type: int)",
field->name, *(int *) field_dst);
} else if (sub_type ==
gras_datadesc_by_name("unsigned long int")) {
- VERB2
+ XBT_VERB
("Copied value for field '%s': %ld (type: unsigned long int)",
field->name, *(unsigned long int *) field_dst);
} else if (sub_type == gras_datadesc_by_name("long int")) {
- VERB2("Copied value for field '%s': %ld (type: long int)",
+ XBT_VERB("Copied value for field '%s': %ld (type: long int)",
field->name, *(long int *) field_dst);
} else if (sub_type == gras_datadesc_by_name("string")) {
- VERB2("Copied value for field '%s': '%s' (type: string)",
+ XBT_VERB("Copied value for field '%s': '%s' (type: string)",
field->name, *(char **) field_dst);
} else {
- VERB1("Copied a value for field '%s' (type not scalar?)",
+ XBT_VERB("Copied a value for field '%s' (type not scalar?)",
field->name);
}
}
}
- VERB1("<< Copied all fields of the structure %s", type->name);
+ XBT_VERB("<< Copied all fields of the structure %s", type->name);
break;
}
/* Send the pointed data only if not already sent */
if (*(void **) src == NULL) {
- VERB0("Not copying NULL referenced data");
+ XBT_VERB("Not copying NULL referenced data");
*(void **) dst = NULL;
break;
}
xbt_dict_get_or_null_ext(refs, (char *) o_ref,
sizeof(char *)))) {
/* already known, no need to copy it */
- //INFO0("Cycle detected");
+ //XBT_INFO("Cycle detected");
reference_is_to_cpy = 0;
}
if (reference_is_to_cpy) {
int subsubcount = -1;
void *l_referenced = NULL;
- VERB2("Copy a ref to '%s' referenced at %p", sub_type->name,
+ XBT_VERB("Copy a ref to '%s' referenced at %p", sub_type->name,
(void *) *o_ref);
if (!pointer_type) {
|| sub_type->cycle);
*(void **) dst = l_referenced;
- VERB3("'%s' previously referenced at %p now at %p",
+ XBT_VERB("'%s' previously referenced at %p now at %p",
sub_type->name, *(void **) o_ref, l_referenced);
} else {
- VERB2
+ XBT_VERB
("NOT copying data previously referenced @%p (already done, @%p now)",
*(void **) o_ref, *(void **) n_ref);
sub_type = array_data.type;
elm_size = sub_type->aligned_size[GRAS_THISARCH];
if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
- VERB1("Array of %ld scalars, copy it in one shot", array_count);
+ XBT_VERB("Array of %ld scalars, copy it in one shot", array_count);
memcpy(dst, src,
sub_type->aligned_size[GRAS_THISARCH] * array_count);
count += sub_type->aligned_size[GRAS_THISARCH] * array_count;
&& sub_type->category.array_data.type->category_code ==
e_gras_datadesc_type_cat_scalar) {
- VERB1("Array of %ld fixed array of scalars, copy it in one shot",
+ XBT_VERB("Array of %ld fixed array of scalars, copy it in one shot",
array_count);
memcpy(dst, src,
sub_type->category.array_data.
* array_count * sub_type->category.array_data.fixed_size;
} else {
- VERB1("Array of %ld stuff, copy it in one after the other",
+ XBT_VERB("Array of %ld stuff, copy it in one after the other",
array_count);
for (cpt = 0; cpt < array_count; cpt++) {
- VERB2("Copy the %dth stuff out of %ld", cpt, array_count);
+ XBT_VERB("Copy the %dth stuff out of %ld", cpt, array_count);
count +=
gras_datadesc_memcpy_rec(state, refs, sub_type, src_ptr,
dst_ptr, 0, detect_cycle
xbt_assert0(type, "called with NULL type descriptor");
- DEBUG3("Memcopy a %s from %p to %p", gras_datadesc_get_name(type), src,
+ XBT_DEBUG("Memcopy a %s from %p to %p", gras_datadesc_get_name(type), src,
dst);
if (!state) {
state = gras_cbps_new();
unsigned int cpt;
gras_datadesc_type_t sub_type; /* type on which we recurse */
- VERB2("Send a %s (%s)",
+ XBT_VERB("Send a %s (%s)",
type->name, gras_datadesc_cat_names[type->category_code]);
if (!strcmp(type->name, "string"))
- VERB1("value: '%s'", *(char **) data);
+ XBT_VERB("value: '%s'", *(char **) data);
if (type->send) {
type->send(type, state, data);
- DEBUG0("Run the emission callback");
+ XBT_DEBUG("Run the emission callback");
}
switch (type->category_code) {
xbt_assert1(struct_data.closed,
"Please call gras_datadesc_declare_struct_close on %s before sending it",
type->name);
- VERB1(">> Send all fields of the structure %s", type->name);
+ XBT_VERB(">> Send all fields of the structure %s", type->name);
xbt_dynar_foreach(struct_data.fields, cpt, field) {
field_data = data;
field_data += field->offset[GRAS_THISARCH];
sub_type = field->type;
if (field->send) {
- DEBUG1("Run the emission callback of field %s", field->name);
+ XBT_DEBUG("Run the emission callback of field %s", field->name);
field->send(type, state, field_data);
}
- VERB1("Send field %s", field->name);
+ XBT_VERB("Send field %s", field->name);
gras_datadesc_send_rec(sock, state, refs, sub_type, field_data,
detect_cycle || sub_type->cycle);
}
- VERB1("<< Sent all fields of the structure %s", type->name);
+ XBT_VERB("<< Sent all fields of the structure %s", type->name);
break;
}
/* Send the pointed data only if not already sent */
if (*(void **) data == NULL) {
- VERB0("Not sending NULL referenced data");
+ XBT_VERB("Not sending NULL referenced data");
break;
}
if (detect_cycle
&& xbt_dict_get_or_null_ext(refs, (char *) ref,
sizeof(char *))) {
- //INFO0("Cycle detected");
+ //XBT_INFO("Cycle detected");
reference_is_to_send = 0;
}
if (reference_is_to_send) {
- VERB1("Sending data referenced at %p", (void *) *ref);
+ XBT_VERB("Sending data referenced at %p", (void *) *ref);
if (detect_cycle)
xbt_dict_set_ext(refs, (char *) ref, sizeof(void *), ref, NULL);
gras_datadesc_send_rec(sock, state, refs, sub_type, *ref,
detect_cycle || sub_type->cycle);
} else {
- VERB1("Not sending data referenced at %p (already done)",
+ XBT_VERB("Not sending data referenced at %p (already done)",
(void *) *ref);
}
sub_type = array_data.type;
elm_size = sub_type->aligned_size[GRAS_THISARCH];
if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
- VERB1("Array of %d scalars, send it in one shot", count);
+ XBT_VERB("Array of %d scalars, send it in one shot", count);
gras_trp_send(sock, data,
sub_type->aligned_size[GRAS_THISARCH] * count,
0 /* not stable */ );
&& sub_type->category.array_data.type->category_code ==
e_gras_datadesc_type_cat_scalar) {
- VERB1("Array of %d fixed array of scalars, send it in one shot",
+ XBT_VERB("Array of %d fixed array of scalars, send it in one shot",
count);
gras_trp_send(sock, data,
sub_type->category.array_data.
unsigned int cpt;
gras_datadesc_type_t sub_type;
- VERB2("Recv a %s @%p", type->name, (void *) l_data);
+ XBT_VERB("Recv a %s @%p", type->name, (void *) l_data);
xbt_assert(l_data);
switch (type->category_code) {
xbt_assert1(struct_data.closed,
"Please call gras_datadesc_declare_struct_close on %s before receiving it",
type->name);
- VERB1(">> Receive all fields of the structure %s", type->name);
+ XBT_VERB(">> Receive all fields of the structure %s", type->name);
xbt_dynar_foreach(struct_data.fields, cpt, field) {
char *field_data = l_data + field->offset[GRAS_THISARCH];
detect_cycle || sub_type->cycle);
if (field->recv) {
- DEBUG1("Run the reception callback of field %s", field->name);
+ XBT_DEBUG("Run the reception callback of field %s", field->name);
field->recv(type, state, (void *) l_data);
}
}
- VERB1("<< Received all fields of the structure %s", type->name);
+ XBT_VERB("<< Received all fields of the structure %s", type->name);
break;
}
/* Receive the pointed data only if not already sent */
if (gras_dd_is_r_null(r_ref, pointer_type->size[r_arch])) {
- VERB1("Not receiving data remotely referenced @%p since it's NULL",
+ XBT_VERB("Not receiving data remotely referenced @%p since it's NULL",
*(void **) r_ref);
*(void **) l_data = NULL;
free(r_ref);
pointer_type->size
[r_arch]))) {
reference_is_to_recv = 0;
- //INFO0("Cycle detected");
+ //XBT_INFO("Cycle detected");
}
if (reference_is_to_recv) {
int subsubcount = -1;
void *l_referenced = NULL;
- VERB2("Receiving a ref to '%s', remotely @%p",
+ XBT_VERB("Receiving a ref to '%s', remotely @%p",
sub_type->name, *(void **) r_ref);
if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
/* Damn. Reference to a dynamic array. Allocating the space for it is more complicated */
detect_cycle || sub_type->cycle);
*(void **) l_data = l_referenced;
- VERB3("'%s' remotely referenced at %p locally at %p",
+ XBT_VERB("'%s' remotely referenced at %p locally at %p",
sub_type->name, *(void **) r_ref, l_referenced);
} else {
- VERB2
+ XBT_VERB
("NOT receiving data remotely referenced @%p (already done, @%p here)",
*(void **) r_ref, *(void **) l_ref);
/* receive the content */
sub_type = array_data.type;
if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
- VERB1("Array of %d scalars, get it in one shoot", count);
+ XBT_VERB("Array of %d scalars, get it in one shoot", count);
if (sub_type->aligned_size[GRAS_THISARCH] >=
sub_type->aligned_size[r_arch]) {
gras_trp_recv(sock, (char *) l_data,
array_data = sub_type->category.array_data;
subsub_type = array_data.type;
- VERB1("Array of %d fixed array of scalars, get it in one shot",
+ XBT_VERB("Array of %d fixed array of scalars, get it in one shot",
count);
if (subsub_type->aligned_size[GRAS_THISARCH] >=
subsub_type->aligned_size[r_arch]) {
} else {
/* not scalar content, get it recursively (may contain pointers) */
elm_size = sub_type->aligned_size[GRAS_THISARCH];
- VERB2("Receive a %d-long array of %s", count, sub_type->name);
+ XBT_VERB("Receive a %d-long array of %s", count, sub_type->name);
ptr = l_data;
for (cpt = 0; cpt < count; cpt++) {
type->recv(type, state, l_data);
if (!strcmp(type->name, "string"))
- VERB1("value: '%s'", *(char **) l_data);
+ XBT_VERB("value: '%s'", *(char **) l_data);
}
do {
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
/* This only used when parsing 'short *' since this function returns when int, float, double,... is encountered */
- DEBUG0("This is a reference");
+ XBT_DEBUG("This is a reference");
type_modifier->is_ref++;
} else if (!strcmp(gras_ddt_parse_text, "unsigned")) {
- DEBUG0("This is an unsigned");
+ XBT_DEBUG("This is an unsigned");
type_modifier->is_unsigned = 1;
} else if (!strcmp(gras_ddt_parse_text, "short")) {
- DEBUG0("This is short");
+ XBT_DEBUG("This is short");
type_modifier->is_short = 1;
} else if (!strcmp(gras_ddt_parse_text, "long")) {
- DEBUG0("This is long");
+ XBT_DEBUG("This is long");
type_modifier->is_long++; /* handle "long long" */
} else if (!strcmp(gras_ddt_parse_text, "struct")) {
- DEBUG0("This is a struct");
+ XBT_DEBUG("This is a struct");
type_modifier->is_struct = 1;
} else if (!strcmp(gras_ddt_parse_text, "union")) {
- DEBUG0("This is an union");
+ XBT_DEBUG("This is an union");
type_modifier->is_union = 1;
} else if (!strcmp(gras_ddt_parse_text, "enum")) {
- DEBUG0("This is an enum");
+ XBT_DEBUG("This is an enum");
type_modifier->is_enum = 1;
} else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_EMPTY) {
- DEBUG0("Pass space");
+ XBT_DEBUG("Pass space");
} else {
- DEBUG1("Done with modifiers (got %s)", gras_ddt_parse_text);
+ XBT_DEBUG("Done with modifiers (got %s)", gras_ddt_parse_text);
break;
}
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if ((gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD) &&
(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_STAR)) {
- DEBUG2("Done with modifiers (got %s,%d)", gras_ddt_parse_text,
+ XBT_DEBUG("Done with modifiers (got %s,%d)", gras_ddt_parse_text,
gras_ddt_parse_tok_num);
break;
}
XBT_IN;
xbt_dynar_pop(dynar, &former);
array.type_name = (char *) xbt_malloc(strlen(former.type->name) + 48);
- DEBUG2("Array specification (size=%ld, elm='%s'), change pushed type",
+ XBT_DEBUG("Array specification (size=%ld, elm='%s'), change pushed type",
size, former.type_name);
sprintf(array.type_name, "%s%s%s%s[%ld]",
(former.tm.is_unsigned ? "u " : ""),
XBT_IN;
xbt_dynar_pop(dynar, &former);
ref.type_name = (char *) xbt_malloc(strlen(former.type->name) + 2);
- DEBUG1("Ref specification (elm='%s'), change pushed type",
+ XBT_DEBUG("Ref specification (elm='%s'), change pushed type",
former.type_name);
sprintf(ref.type_name, "%s*", former.type_name);
free(former.type_name);
for (colon_pos = gras_ddt_parse_col_pos;
definition[colon_pos] != ';'; colon_pos++);
definition[colon_pos] = '\0';
- DEBUG3("Parse the statement \"%s%s;\" (col_pos=%d)",
+ XBT_DEBUG("Parse the statement \"%s%s;\" (col_pos=%d)",
gras_ddt_parse_text,
definition + gras_ddt_parse_col_pos, gras_ddt_parse_col_pos);
definition[colon_pos] = ';';
/* bastard user, they omited "int" ! */
identifier.type_name = (char *) strdup("int");
- DEBUG0("the base type is 'int', which were omited (you vicious user)");
+ XBT_DEBUG("the base type is 'int', which were omited (you vicious user)");
} else {
identifier.type_name = (char *) strdup(gras_ddt_parse_text);
- DEBUG1("the base type is '%s'", identifier.type_name);
+ XBT_DEBUG("the base type is '%s'", identifier.type_name);
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
}
identifier.type = gras_datadesc_by_name("char");
} else {
- DEBUG1("Base type is a constructed one (%s)", identifier.type_name);
+ XBT_DEBUG("Base type is a constructed one (%s)", identifier.type_name);
if (!strcmp(identifier.type_name, "xbt_matrix_t")) {
identifier.tm.is_matrix = 1;
} else if (!strcmp(identifier.type_name, "xbt_dynar_t")) {
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RB)
PARSE_ERROR0("Unparsable size of array");
- DEBUG1("Fixed size array, size=%ld", size);
+ XBT_DEBUG("Fixed size array, size=%ld", size);
continue;
} else {
PARSE_ERROR0("Unparsable size of array");
/* Done with parsing the annotation. Now deal with it by replacing previously pushed type with the right one */
- DEBUG2("Anotation: %s=%s", keyname, keyval);
+ XBT_DEBUG("Anotation: %s=%s", keyname, keyval);
if (!strcmp(keyname, "size")) {
if (!identifier.tm.is_ref)
PARSE_ERROR0
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
identifier.name = (char *) strdup(gras_ddt_parse_text);
- DEBUG1("Found the identifier \"%s\"", identifier.name);
+ XBT_DEBUG("Found the identifier \"%s\"", identifier.name);
xbt_dynar_push(identifiers, &identifier);
- DEBUG1("Dynar_len=%lu", xbt_dynar_length(identifiers));
+ XBT_DEBUG("Dynar_len=%lu", xbt_dynar_length(identifiers));
expect_id_separator = 1;
continue;
}
/* Create the struct descriptor */
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
struct_type = gras_datadesc_struct(gras_ddt_parse_text);
- VERB1("Parse the struct '%s'", gras_ddt_parse_text);
+ XBT_VERB("Parse the struct '%s'", gras_ddt_parse_text);
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
} else {
sprintf(buffname, "anonymous struct %d", anonymous_struct++);
- VERB1("Parse the anonymous struct nb %d", anonymous_struct);
+ XBT_VERB("Parse the anonymous struct nb %d", anonymous_struct);
struct_type = gras_datadesc_struct(buffname);
}
done = 1;
}
- DEBUG1("This statement contained %lu identifiers",
+ XBT_DEBUG("This statement contained %lu identifiers",
xbt_dynar_length(identifiers));
/* append the identifiers we've found */
xbt_dynar_foreach(identifiers, iter, field) {
("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
field.name, field.tm.is_ref);
- VERB2("Append field '%s' to %p", field.name, (void *) struct_type);
+ XBT_VERB("Append field '%s' to %p", field.name, (void *) struct_type);
gras_datadesc_struct_append(struct_type, field.name, field.type);
free(field.name);
free(field.type_name);
}
xbt_dynar_reset(identifiers);
- DEBUG1("struct_type=%p", (void *) struct_type);
+ XBT_DEBUG("struct_type=%p", (void *) struct_type);
/* Make sure that all fields declaring a size push it into the cbps */
xbt_dynar_foreach(fields_to_push, iter, name) {
- DEBUG1("struct_type=%p", (void *) struct_type);
+ XBT_DEBUG("struct_type=%p", (void *) struct_type);
if (name[0] == '*') {
- VERB2("Push field '%s' as a multiplier into size stack of %p",
+ XBT_VERB("Push field '%s' as a multiplier into size stack of %p",
name + 1, (void *) struct_type);
gras_datadesc_cb_field_push_multiplier(struct_type, name + 1);
} else {
- VERB2("Push field '%s' into size stack of %p",
+ XBT_VERB("Push field '%s' into size stack of %p",
name, (void *) struct_type);
gras_datadesc_cb_field_push(struct_type, name);
}
definition[def_count] = '\0';
/* init */
- VERB2("_gras_ddt_type_parse(%s) -> %d chars", definition, def_count);
+ XBT_VERB("_gras_ddt_type_parse(%s) -> %d chars", definition, def_count);
gras_ddt_parse_pointer_string_init(definition);
/* Do I have a typedef, or a raw struct ? */
res = parse_typedef(definition);
} else {
- ERROR1
+ XBT_ERROR
("Failed to parse the following symbol (not a struct neither a typedef) :\n%s",
definition);
xbt_abort();
}
gras_ddt_parse_pointer_string_close();
- VERB0("end of _gras_ddt_type_parse()");
+ XBT_VERB("end of _gras_ddt_type_parse()");
free(definition);
/* register it under the name provided as symbol */
if (strcmp(res->name, name)) {
- ERROR2
+ XBT_ERROR
("In GRAS_DEFINE_TYPE, the provided symbol (here %s) must be the C type name (here %s)",
name, res->name);
xbt_abort();
int gras_ddt_parse_tok_num = 0;
const char *definition;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_lexer,gras_ddt_parse,"The crude internals of the lexer used for type parsing");
-#define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,gras_ddt_parse_text)
+#define SHOW_WHERE XBT_DEBUG("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,gras_ddt_parse_text)
#define INITIAL 0
#define annotate 1
case 2:
YY_RULE_SETUP
{ /****************** ANNOTATION ************************/
- DEBUG0("Begin annotation");
+ XBT_DEBUG("Begin annotation");
annotate_caller = INITIAL;
gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
case 3:
YY_RULE_SETUP
{ /* trim annotation */
- DEBUG0("Begin annotation");
+ XBT_DEBUG("Begin annotation");
annotate_caller = foo;
gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
case 4:
YY_RULE_SETUP
{
- DEBUG0("End annotation");
+ XBT_DEBUG("End annotation");
gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
BEGIN(annotate_caller);
#define PARSE_ERROR_POST xbt_abort();} while (0)
#define PARSE_ERROR0(fmt) PARSE_ERROR_PRE \
- ERROR3(fmt " at %d:%d of :\n%s", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
+ XBT_ERROR(fmt " at %d:%d of :\n%s", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
PARSE_ERROR_POST
#define PARSE_ERROR1(fmt,a) PARSE_ERROR_PRE \
- ERROR4(fmt " at %d:%d of :\n%s",a, gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
+ XBT_ERROR(fmt " at %d:%d of :\n%s",a, gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
PARSE_ERROR_POST
#define PARSE_ERROR2(fmt,a,b) PARSE_ERROR_PRE \
- ERROR5(fmt " at %d:%d of :\n%s",a,b, gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
+ XBT_ERROR(fmt " at %d:%d of :\n%s",a,b, gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
PARSE_ERROR_POST
int gras_ddt_parse_tok_num = 0;
const char *definition;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_lexer,gras_ddt_parse,"The crude internals of the lexer used for type parsing");
-#define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,yytext)
+#define SHOW_WHERE XBT_DEBUG("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,yytext)
%}
%x annotate comment foo
"//"[^\n]*
"/*g"{space}* { /****************** ANNOTATION ************************/
- DEBUG0("Begin annotation");
+ XBT_DEBUG("Begin annotation");
annotate_caller = INITIAL;
gras_ddt_parse_char_pos+= strlen(yytext);
gras_ddt_parse_col_pos+= strlen(yytext);
BEGIN(annotate);
}
<foo>"/*g"{space}* { /* trim annotation */
- DEBUG0("Begin annotation");
+ XBT_DEBUG("Begin annotation");
annotate_caller = foo;
gras_ddt_parse_char_pos+= strlen(yytext);
gras_ddt_parse_col_pos+= strlen(yytext);
}
<annotate>{space}*"g*/" {
- DEBUG0("End annotation");
+ XBT_DEBUG("End annotation");
gras_ddt_parse_char_pos+= strlen(yytext);
gras_ddt_parse_col_pos+= strlen(yytext);
BEGIN(annotate_caller);
xbt_assert0(msg_got, "msg_got is an output parameter");
start = gras_os_time();
- VERB2("Waiting for message '%s' for %fs",
+ XBT_VERB("Waiting for message '%s' for %fs",
msgt_want ? msgt_want->name : "(any)", timeout);
xbt_dynar_foreach(pd->msg_waitqueue, cpt, msg) {
memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
xbt_dynar_cursor_rm(pd->msg_waitqueue, &cpt);
- VERB0("The waited message was queued");
+ XBT_VERB("The waited message was queued");
return;
}
}
memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
xbt_dynar_cursor_rm(pd->msg_queue, &cpt);
- VERB0("The waited message was queued");
+ XBT_VERB("The waited message was queued");
return;
}
}
if (need_restart)
goto restart_receive;
- DEBUG0("Got a message from the socket");
+ XBT_DEBUG("Got a message from the socket");
if ((!msgt_want || (msg.type->code == msgt_want->code))
&& (!expe_want || (!strcmp(gras_socket_peer_name(msg.expe),
&& (!filter || filter(&msg, filter_ctx))) {
memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
- DEBUG0("Message matches expectations. Use it.");
+ XBT_DEBUG("Message matches expectations. Use it.");
return;
}
- DEBUG0("Message does not match expectations. Queue it.");
+ XBT_DEBUG("Message does not match expectations. Queue it.");
/* not expected msg type. Queue it for later */
xbt_dynar_push(pd->msg_queue, &msg);
xbt_dynar_t dyn = (xbt_dynar_t) ctx;
int res = xbt_dynar_member(dyn, msg->type);
if (res)
- VERB1("Got matching message (type=%s)", msg->type->name);
+ XBT_VERB("Got matching message (type=%s)", msg->type->name);
else
- VERB0("Got message not matching our expectations");
+ XBT_VERB("Got message not matching our expectations");
return res;
}
{
s_gras_msg_t msg;
- VERB1("Wait %f seconds for several message types", timeout);
+ XBT_VERB("Wait %f seconds for several message types", timeout);
gras_msg_wait_ext_(timeout,
NULL, NULL,
&gras_msg_wait_or_filter, (void *) msgt_want, &msg);
msgtype->name);
}
- DEBUG2("Send a oneway message of type '%s'. Payload=%p",
+ XBT_DEBUG("Send a oneway message of type '%s'. Payload=%p",
msgtype->name, payload);
gras_msg_send_ext(sock, e_gras_msg_kind_oneway, 0, msgtype, payload);
- VERB2("Sent a oneway message of type '%s'. Payload=%p",
+ XBT_VERB("Sent a oneway message of type '%s'. Payload=%p",
msgtype->name, payload);
}
int timerexpected, timeouted;
xbt_ex_t e;
- VERB1("Handling message within the next %.2fs", timeOut);
+ XBT_VERB("Handling message within the next %.2fs", timeOut);
untiltimer = gras_msg_timer_handle();
- DEBUG1("Next timer in %f sec", untiltimer);
+ XBT_DEBUG("Next timer in %f sec", untiltimer);
if (untiltimer == 0.0) {
/* A timer was already elapsed and handled */
return;
/* get a message (from the queue or from the net) */
timeouted = 0;
if (xbt_dynar_length(pd->msg_queue)) {
- DEBUG0("Get a message from the queue");
+ XBT_DEBUG("Get a message from the queue");
xbt_dynar_shift(pd->msg_queue, &msg);
} else {
TRY {
CATCH(e) {
if (e.category != timeout_error)
RETHROW;
- DEBUG0("Damn. Timeout while getting a message from the queue");
+ XBT_DEBUG("Damn. Timeout while getting a message from the queue");
xbt_ex_free(e);
timeouted = 1;
}
} else {
xbt_assert1(untiltimer > 0, "Negative timer (%f). I'm 'puzzeled'",
untiltimer);
- WARN1
+ XBT_WARN
("No timer elapsed, in contrary to expectations (next in %f sec)",
untiltimer);
THROW1(timeout_error, 0,
}
}
if (!list) {
- INFO4
+ XBT_INFO
("No callback for message '%s' (type:%s) from %s:%d. Queue it for later gras_msg_wait() use.",
msg.type->name, e_gras_msg_kind_names[msg.kind],
gras_socket_peer_name(msg.expe), gras_socket_peer_port(msg.expe));
TRY {
xbt_dynar_foreach(list->cbs, cpt, cb) {
if (!ran_ok) {
- DEBUG4
+ XBT_DEBUG
("Use the callback #%d (@%p) for incomming msg '%s' (payload_size=%d)",
cpt + 1, cb, msg.type->name, msg.payl_size);
if (!(*cb) (&ctx, msg.payl)) {
e.host = (char *) gras_os_myname();
xbt_ex_setup_backtrace(&e);
}
- INFO5
+ XBT_INFO
("Propagate %s exception ('%s') from '%s' RPC cb back to %s:%d",
(e.remote ? "remote" : "local"), e.msg, msg.type->name,
gras_socket_peer_name(msg.expe),
"Bug in user code: RPC callback to message '%s' didn't call gras_msg_rpcreturn",
msg.type->name);
if (ctx.answer_due)
- CRITICAL1
+ XBT_CRITICAL
("BUGS BOTH IN USER CODE (RPC callback to message '%s' didn't call gras_msg_rpcreturn) "
"AND IN SIMGRID (process wasn't killed by an assert)",
msg.type->name);
case e_gras_msg_kind_rpcanswer:
- INFO3("Unexpected RPC answer discarded (type: %s; from:%s:%d)",
+ XBT_INFO("Unexpected RPC answer discarded (type: %s; from:%s:%d)",
msg.type->name, gras_socket_peer_name(msg.expe),
gras_socket_peer_port(msg.expe));
- WARN0
+ XBT_WARN
("FIXME: gras_datadesc_free not implemented => leaking the payload");
return;
case e_gras_msg_kind_rpcerror:
- INFO3("Unexpected RPC error discarded (type: %s; from:%s:%d)",
+ XBT_INFO("Unexpected RPC error discarded (type: %s; from:%s:%d)",
msg.type->name, gras_socket_peer_name(msg.expe),
gras_socket_peer_port(msg.expe));
- WARN0
+ XBT_WARN
("FIXME: gras_datadesc_free not implemented => leaking the payload");
return;
xbt_ex_t e;
gras_msgtype_t msg_wakeup_listener_t =
gras_msgtype_by_name("_wakeup_listener");
- DEBUG0("I'm the listener");
+ XBT_DEBUG("I'm the listener");
/* get a free socket for the receiving part of the listener */
me->wakeup_sock_listener_side =NULL;
if (msg->type != msg_wakeup_listener_t) {
/* Cannot display who sent this since in SG, gras_socket_peer_* wont work:
I'm not the user process but I'm just the listener. Too bad */
- VERB3("Got a '%s' message (%s) from sock %p. Queue it for handling by main thread",
+ XBT_VERB("Got a '%s' message (%s) from sock %p. Queue it for handling by main thread",
gras_msgtype_get_name(msg->type),e_gras_msg_kind_names[msg->kind],msg->expe);
xbt_queue_push(me->incomming_messages, msg);
} else {
char got = *(char *) msg->payl;
if (got == '1') {
- VERB0("Asked to get awake");
+ XBT_VERB("Asked to get awake");
free(msg->payl);
free(msg);
} else {
- VERB0("Asked to die");
+ XBT_VERB("Asked to die");
//gras_socket_close(me->wakeup_sock_listener_side);
free(msg->payl);
free(msg);
xbt_queue_shift_timed(me->socks_to_close, &sock, 0);
if (tcp_close(sock) < 0) {
#ifdef _XBT_WIN32
- WARN2("error while closing tcp socket %d: %d\n", sock,
+ XBT_WARN("error while closing tcp socket %d: %d\n", sock,
sock_errno);
#else
- WARN3("error while closing tcp socket %d: %d (%s)\n",
+ XBT_WARN("error while closing tcp socket %d: %d (%s)\n",
sock, sock_errno, sock_errstr(sock_errno));
#endif
}
{
gras_msg_listener_t arg = xbt_new0(s_gras_msg_listener_t, 1);
- VERB0("Launch listener");
+ XBT_VERB("Launch listener");
arg->incomming_messages = msg_received;
arg->socks_to_close = xbt_queue_new(0, sizeof(int));
arg->init_mutex = xbt_mutex_init();
{
gras_procdata_t *pd = gras_procdata_get();
char kill = '0';
- DEBUG0("Listener quit");
+ XBT_DEBUG("Listener quit");
if (pd->listener)
gras_msg_send(pd->listener->wakeup_sock_master_side,
gras_procdata_t *pd;
char c = '1';
- DEBUG0("Awaking the listener");
+ XBT_DEBUG("Awaking the listener");
pd = gras_procdata_get();
if (pd->listener) {
gras_msg_send(pd->listener->wakeup_sock_master_side,
if (_gras_msgtype_set != NULL)
return;
- VERB0("Initializing Msg");
+ XBT_VERB("Initializing Msg");
_gras_msgtype_set = xbt_set_new();
*/
void gras_msg_exit(void)
{
- VERB0("Exiting Msg");
+ XBT_VERB("Exiting Msg");
xbt_set_free(&_gras_msgtype_set);
xbt_mallocator_free(gras_msg_ctx_mallocator);
xbt_set_cursor_t cursor;
gras_msgtype_t msgtype = NULL;
- INFO0("Dump of all registered messages:");
+ XBT_INFO("Dump of all registered messages:");
xbt_set_foreach(_gras_msgtype_set, cursor, msgtype) {
- INFO6(" Message name: %s (v%d) %s; %s%s%s",
+ XBT_INFO(" Message name: %s (v%d) %s; %s%s%s",
msgtype->name, msgtype->version,
e_gras_msg_kind_names[msgtype->kind],
gras_datadesc_get_name(msgtype->ctn_type),
}
if (found) {
- DEBUG2
+ XBT_DEBUG
("Re-register version %d of message '%s' (same kind & payload, ignored).",
version, name);
xbt_assert3(msgtype->kind == kind,
return; /* do really ignore it */
}
- VERB4("Register version %d of message '%s' "
+ XBT_VERB("Register version %d of message '%s' "
"(payload: %s; answer payload: %s).",
version, name, gras_datadesc_get_name(payload_request),
gras_datadesc_get_name(payload_answer));
gras_cblist_t *list = NULL;
unsigned int cpt;
- DEBUG2("Register %p as callback to '%s'", cb, msgtype->name);
+ XBT_DEBUG("Register %p as callback to '%s'", cb, msgtype->name);
/* search the list of cb for this message on this host (creating if NULL) */
xbt_dynar_foreach(pd->cbl_list, cpt, list) {
}
}
if (!found)
- VERB1("Ignoring removal of unexisting callback to msg id %d",
+ XBT_VERB("Ignoring removal of unexisting callback to msg id %d",
msgtype->code);
}
{
gras_msg_t msg = xbt_new0(s_gras_msg_t, 1);
msg->expe = gras_trp_select(-1);
- DEBUG0("Select returned something");
+ XBT_DEBUG("Select returned something");
gras_msg_recv(msg->expe, msg);
return msg;
}
xbt_assert(ulong_type);
}
- DEBUG3("send '%s' to %s:%d", msgtype->name,
+ XBT_DEBUG("send '%s' to %s:%d", msgtype->name,
gras_socket_peer_name(sock), gras_socket_peer_port(sock));
gras_trp_send(sock, _GRAS_header, 6, 1 /* stable */ );
gras_trp_send(sock, &c_kind, 1, 1 /* stable */ );
}
gras_datadesc_recv(sock, string_type, r_arch, &msg_name);
- DEBUG4
+ XBT_DEBUG
("Handle an incoming message '%s' (%s) using protocol %d (remote is %s)",
msg_name, e_gras_msg_kind_names[msg->kind], (int) header[4],
gras_datadesc_arch_name(r_arch));
gras_msg_cb_ctx_t rpc_ctx;
- DEBUG5
+ XBT_DEBUG
("Filter a message of ID %lu, type '%s' and kind '%s'. Waiting for ID=%lu. %s",
msg->ID, msg->type->name, e_gras_msg_kind_names[msg->kind], ID,
res ? "take it" : "reject");
/* Check whether it is an old answer to a message we already canceled */
xbt_dynar_foreach(_gras_rpc_cancelled, cursor, rpc_ctx) {
if (msg->ID == rpc_ctx->ID && msg->kind == e_gras_msg_kind_rpcanswer) {
- VERB1
+ XBT_VERB
("Got an answer to the already canceled (timeouted?) RPC %ld. Ignore it (leaking the payload!).",
msg->ID);
xbt_dynar_cursor_rm(_gras_rpc_cancelled, &cursor);
ctx->msgtype = msgtype;
ctx->timeout = timeOut;
- VERB4("Send to %s:%d a RPC of type '%s' (ID=%lu)",
+ XBT_VERB("Send to %s:%d a RPC of type '%s' (ID=%lu)",
gras_socket_peer_name(server),
gras_socket_peer_port(server), msgtype->name, ctx->ID);
if (!_gras_rpc_cancelled)
_gras_rpc_cancelled = xbt_dynar_new(sizeof(ctx), NULL);
xbt_dynar_push(_gras_rpc_cancelled, &ctx);
- INFO5
+ XBT_INFO
("canceled RPC %ld pushed onto the stack (%s from %s:%d) Reason: %s",
ctx->ID, ctx->msgtype->name,
gras_socket_peer_name(ctx->expeditor),
xbt_ex_t e;
memcpy(&e, received.payl, received.payl_size);
free(received.payl);
- VERB3("Raise a remote exception cat:%d coming from %s (%s)",
+ XBT_VERB("Raise a remote exception cat:%d coming from %s (%s)",
e.category, e.host, e.msg);
__xbt_running_ctx_fetch()->exception.msg = e.msg;
__xbt_running_ctx_fetch()->exception.category = e.category;
xbt_assert0(ctx->answer_due,
"RPC return not allowed here. Either not a RPC message or already returned a result");
ctx->answer_due = 0;
- DEBUG5("Return to RPC '%s' from %s:%d (tOut=%f, payl=%p)",
+ XBT_DEBUG("Return to RPC '%s' from %s:%d (tOut=%f, payl=%p)",
ctx->msgtype->name,
gras_socket_peer_name(ctx->expeditor),
gras_socket_peer_port(ctx->expeditor), timeOut, answer);
smx_process_t server_listener_process=NULL;
smx_process_t client_listener_process = NULL;
- VERB4("Am I the server of socket %p (client = %p, server = %p) ? process self: %p", sock, sock_data->client, sock_data->server, SIMIX_process_self());
+ XBT_VERB("Am I the server of socket %p (client = %p, server = %p) ? process self: %p", sock, sock_data->client, sock_data->server, SIMIX_process_self());
if (sock_data->server == SIMIX_process_self()) {
- VERB0("I am the server");
+ XBT_VERB("I am the server");
return 1;
}
if (sock_data->client == SIMIX_process_self()) {
- VERB0("I am the client");
+ XBT_VERB("I am the client");
return 0;
}
- VERB0("I am neither the client nor the server, probably a listener");
+ XBT_VERB("I am neither the client nor the server, probably a listener");
/* neither the client nor the server. Check their respective listeners */
pd = ((gras_procdata_t*)SIMIX_process_get_data(sock_data->server));
listener_thread = ((fake_gras_msg_listener_t)l)->listener;
server_listener_process = ((fake_xbt_thread_t)listener_thread)->s_process;
if (server_listener_process == SIMIX_process_self()) {
- VERB0("I am the listener of the server");
+ XBT_VERB("I am the listener of the server");
return 1;
}
}
listener_thread = ((fake_gras_msg_listener_t)l)->listener;
client_listener_process = ((fake_xbt_thread_t)listener_thread)->s_process;
if (client_listener_process == SIMIX_process_self()) {
- VERB0("I am the listener of the client");
+ XBT_VERB("I am the listener of the client");
return 0;
}
}
xbt_backtrace_display_current();
((char*)sock)[sizeof(*sock)+1] = '0'; /* Try to make valgrind angry to see where that damn socket comes from */
if(system(bprintf("cat /proc/%d/maps 1>&2",getpid()))){}
- INFO6("I'm not the client in socket %p (comm:%p, rdvser=%p, rdvcli=%p) to %s, that's %s",
+ XBT_INFO("I'm not the client in socket %p (comm:%p, rdvser=%p, rdvcli=%p) to %s, that's %s",
sock,sock_data->comm_recv,sock_data->rdv_server,sock_data->rdv_client,
SIMIX_host_get_name(SIMIX_process_get_host(sock_data->server)),
sock_data->client?SIMIX_host_get_name(SIMIX_process_get_host(sock_data->client)):"(no client)");
- INFO7("server:%s (%p) server_listener=%p client:%s (%p) client_listener=%p, I'm %p",
+ XBT_INFO("server:%s (%p) server_listener=%p client:%s (%p) client_listener=%p, I'm %p",
SIMIX_host_get_name(SIMIX_process_get_host(sock_data->server)), sock_data->server,server_listener_process,
sock_data->client?SIMIX_host_get_name(SIMIX_process_get_host(sock_data->client)):"(no client)", sock_data->client,client_listener_process,
SIMIX_process_self());
sock_data = (gras_trp_sg_sock_data_t) sock->data;
- DEBUG5
+ XBT_DEBUG
("Consider socket %p (data:%p; Here rdv: %p; Remote rdv: %p; Comm %p) to get a message",
sock, sock_data,
gras_socket_im_the_server(sock)?
sock);
/* End of paranoia */
- VERB3("Consider receiving messages from on comm_recv %p rdv:%p (other rdv:%p)",
+ XBT_VERB("Consider receiving messages from on comm_recv %p rdv:%p (other rdv:%p)",
sock_data->comm_recv,
gras_socket_im_the_server(sock)?
sock_data->rdv_server : sock_data->rdv_client,
sock_data->rdv_client : sock_data->rdv_server);
xbt_dynar_push(comms, &(sock_data->comm_recv));
}
- VERB1("Wait on %ld 'sockets'", xbt_dynar_length(comms));
+ XBT_VERB("Wait on %ld 'sockets'", xbt_dynar_length(comms));
/* Wait for the end of any of these communications */
got = SIMIX_req_comm_waitany(comms);
sock = xbt_dynar_get_as(trp_proc->sockets, got, gras_socket_t);
sock_data = (gras_trp_sg_sock_data_t) sock->data;
msg = sock_data->msg;
- VERB2("Got something. Communication over rdv_server=%p, rdv_client=%p",
+ XBT_VERB("Got something. Communication over rdv_server=%p, rdv_client=%p",
sock_data->rdv_server,sock_data->rdv_client);
/* Reinstall a waiting communication on that rdv */
msg->type = msgtype;
msg->ID = ID;
- VERB4("Send msg %s (%s) to rdv %p sock %p",
+ XBT_VERB("Send msg %s (%s) to rdv %p sock %p",
msgtype->name, e_gras_msg_kind_names[kind], target_rdv, sock);
if (kind == e_gras_msg_kind_rpcerror) {
comm = SIMIX_req_comm_isend(target_rdv, whole_payload_size, -1, msg, sizeof(void *), NULL, msg, 0);
SIMIX_req_comm_wait(comm, -1);
- VERB0("Message sent (and received)");
+ XBT_VERB("Message sent (and received)");
}
gras_timer_t timer = xbt_dynar_push_ptr(pd->timers);
- VERB1("Register delayed action %p", action);
+ XBT_VERB("Register delayed action %p", action);
timer->period = delay;
timer->expiry = delay + gras_os_time();
timer->action = action;
gras_timer_t timer = xbt_dynar_push_ptr(pd->timers);
- VERB1("Register repetitive action %p", action);
+ XBT_VERB("Register repetitive action %p", action);
timer->period = interval;
timer->expiry = interval + gras_os_time();
timer->action = action;
timer = xbt_dynar_get_ptr(pd->timers, cursor);
untilthis = timer->expiry - now;
- DEBUG2("Action %p expires in %f", timer->action, untilthis);
+ XBT_DEBUG("Action %p expires in %f", timer->action, untilthis);
if (untilthis <= 0.0) {
void_f_void_t action = timer->action;
- DEBUG5("[%.0f] Serve %s action %p (%f<%f)", gras_os_time(),
+ XBT_DEBUG("[%.0f] Serve %s action %p (%f<%f)", gras_os_time(),
timer->repeat ? "repetitive" : "delayed", timer->action,
timer->expiry, now);
if (timer->repeat) {
timer->expiry = now + timer->period;
- DEBUG4("[%.0f] Re-arm repetitive action %p for %f (period=%f)",
+ XBT_DEBUG("[%.0f] Re-arm repetitive action %p for %f (period=%f)",
gras_os_time(), timer->action, timer->expiry,
timer->period);
} else {
- DEBUG2("[%.0f] Remove %p now that it's done", gras_os_time(),
+ XBT_DEBUG("[%.0f] Remove %p now that it's done", gras_os_time(),
timer->action);
xbt_dynar_cursor_rm(pd->timers, &cursor);
}
This can happen with tcp buffered sockets since we try to get as much data as we can for them */
if (_gras_lastly_selected_socket
&& _gras_lastly_selected_socket->moredata) {
- VERB0
+ XBT_VERB
("Returning _gras_lastly_selected_socket since there is more data on it");
return _gras_lastly_selected_socket;
}
while (done == -1) {
if (timeout > 0) { /* did we timeout already? */
now = gras_os_time();
- DEBUG2("wakeup=%f now=%f", wakeup, now);
+ XBT_DEBUG("wakeup=%f now=%f", wakeup, now);
if (now == -1 || now >= wakeup) {
/* didn't find anything; no need to update _gras_lastly_selected_socket since its moredata is 0 (or we would have returned it directly) */
THROW1(timeout_error, 0,
continue;
if (sock_iter->incoming) {
- DEBUG1("Considering socket %d for select", sock_iter->sd);
+ XBT_DEBUG("Considering socket %d for select", sock_iter->sd);
#ifndef HAVE_WINSOCK_H
if (max_fds < sock_iter->sd)
max_fds = sock_iter->sd;
#endif
FD_SET(sock_iter->sd, &FDS);
} else {
- DEBUG1("Not considering socket %d for select", sock_iter->sd);
+ XBT_DEBUG("Not considering socket %d for select", sock_iter->sd);
}
}
if (max_fds == -1) {
if (timeout > 0) {
- DEBUG1("No socket to select onto. Sleep %f sec instead.", timeout);
+ XBT_DEBUG("No socket to select onto. Sleep %f sec instead.", timeout);
gras_os_sleep(timeout);
THROW1(timeout_error, 0,
"No socket to select onto. Sleep %f sec instead", timeout);
} else {
- DEBUG0("No socket to select onto. Return directly.");
+ XBT_DEBUG("No socket to select onto. Return directly.");
THROW0(timeout_error, 0,
"No socket to select onto. Return directly.");
}
/* we cannot have more than FD_SETSIZE sockets
... but with WINSOCK which returns sockets higher than the limit (killing this optim) */
if (++max_fds > fd_setsize && fd_setsize > 0) {
- WARN1("too many open sockets (%d).", max_fds);
+ XBT_WARN("too many open sockets (%d).", max_fds);
done = 0;
break;
}
p_tout = NULL;
}
- DEBUG2("Selecting over %d socket(s); timeout=%f", max_fds - 1,
+ XBT_DEBUG("Selecting over %d socket(s); timeout=%f", max_fds - 1,
timeout);
ready = select(max_fds, &FDS, NULL, NULL, p_tout);
- DEBUG1("select returned %d", ready);
+ XBT_DEBUG("select returned %d", ready);
if (ready == -1) {
switch (errno) {
case EINTR: /* a signal we don't care about occured. we don't care */
xbt_dynar_cursor_unlock(sockets);
accepted = (sock_iter->plugin->socket_accept) (sock_iter);
- DEBUG2("accepted=%p,&accepted=%p", accepted, &accepted);
+ XBT_DEBUG("accepted=%p,&accepted=%p", accepted, &accepted);
accepted->meas = sock_iter->meas;
break;
}
if (recvd < 0) {
- WARN2("socket %d failed: %s", sock_iter->sd, strerror(errno));
+ XBT_WARN("socket %d failed: %s", sock_iter->sd, strerror(errno));
/* done with this socket; remove it and break the foreach since it will change the dynar */
xbt_dynar_cursor_unlock(sockets);
gras_socket_close(sock_iter);
break;
} else if (recvd == 0) {
/* Connection reset (=closed) by peer. */
- DEBUG1("Connection %d reset by peer", sock_iter->sd);
+ XBT_DEBUG("Connection %d reset by peer", sock_iter->sd);
sock_iter->valid = 0; /* don't close it. User may keep references to it */
} else {
/* Got a suited socket ! */
XBT_OUT;
sock_iter->recvd = 1;
- DEBUG3("Filled little buffer (%c %x %d)", sock_iter->recvd_val,
+ XBT_DEBUG("Filled little buffer (%c %x %d)", sock_iter->recvd_val,
sock_iter->recvd_val, recvd);
_gras_lastly_selected_socket = sock_iter;
/* break sync dynar iteration */
}
/* No socket found. Maybe we had timeout=0 and nothing to do */
- DEBUG0("TIMEOUT");
+ XBT_DEBUG("TIMEOUT");
THROW0(timeout_error, 0, "Timeout");
}
gras_socket_t sock_iter; /* iterating over all sockets */
unsigned int cursor;
- DEBUG3("select on %s@%s with timeout=%f",
+ XBT_DEBUG("select on %s@%s with timeout=%f",
SIMIX_process_self_get_name(),
SIMIX_host_self_get_name(), timeout);
if (timeout >= 0) {
}
if (active_socket == NULL) {
- DEBUG0("TIMEOUT");
+ XBT_DEBUG("TIMEOUT");
THROW0(timeout_error, 0, "Timeout");
}
active_socket_data = (gras_trp_sg_sock_data_t *) active_socket->data;
/* Ok, got something. Open a socket back to the expeditor */
/* Try to reuse an already openned socket to that expeditor */
- DEBUG1("Open sockets size %lu", xbt_dynar_length(pd->sockets));
+ XBT_DEBUG("Open sockets size %lu", xbt_dynar_length(pd->sockets));
xbt_dynar_foreach(pd->sockets, cursor, sock_iter) {
gras_trp_sg_sock_data_t *sock_data;
- DEBUG1("Consider %p as outgoing socket to expeditor", sock_iter);
+ XBT_DEBUG("Consider %p as outgoing socket to expeditor", sock_iter);
if (sock_iter->meas || !sock_iter->outgoing)
continue;
}
/* Socket to expeditor not created yet */
- DEBUG0("Create a socket to the expeditor");
+ XBT_DEBUG("Create a socket to the expeditor");
trp = gras_trp_plugin_get_by_name("sg");
gras_trp_buf_init_sock(res);
- DEBUG4("Create socket to process:%s(Port %d) from process: %s(Port %d)",
+ XBT_DEBUG("Create socket to process:%s(Port %d) from process: %s(Port %d)",
SIMIX_req_process_get_name(sockdata->from_process),
res->peer_port,
SIMIX_req_process_get_name(sockdata->to_process), res->port);
gras_trp_plugin_t plug = xbt_new0(s_gras_trp_plugin_t, 1);
- DEBUG1("Create plugin %s", name);
+ XBT_DEBUG("Create plugin %s", name);
plug->name = xbt_strdup(name);
xbt_assert0(LOBYTE(wsaData.wVersion) == 2 &&
HIBYTE(wsaData.wVersion) == 0,
"Cannot find a usable WinSock DLL");
- INFO0("Found and initialized winsock2");
+ XBT_INFO("Found and initialized winsock2");
} /* The WinSock DLL is acceptable. Proceed. */
#elif HAVE_WINSOCK_H
{
WSADATA wsaData;
xbt_assert0(WSAStartup(0x0101, &wsaData) == 0,
"Cannot find a usable WinSock DLL");
- INFO0("Found and initialized winsock");
+ XBT_INFO("Found and initialized winsock");
}
#endif
void gras_trp_exit(void)
{
- DEBUG1("gras_trp value %d", _gras_trp_started);
+ XBT_DEBUG("gras_trp value %d", _gras_trp_started);
if (_gras_trp_started == 0) {
return;
}
if (plug->exit) {
plug->exit(plug);
} else if (plug->data) {
- DEBUG1("Plugin %s lacks exit(). Free data anyway.", plug->name);
+ XBT_DEBUG("Plugin %s lacks exit(). Free data anyway.", plug->name);
free(plug->data);
}
gras_socket_t sock = xbt_new0(s_gras_socket_t, 1);
- VERB1("Create a new socket (%p)", (void *) sock);
+ XBT_VERB("Create a new socket (%p)", (void *) sock);
sock->plugin = NULL;
gras_trp_plugin_t trp;
gras_socket_t sock;
- DEBUG2("Create a server socket from plugin %s on port %d",
+ XBT_DEBUG("Create a server socket from plugin %s on port %d",
gras_if_RL()? "tcp" : "sg", port);
trp = gras_trp_plugin_get_by_name(gras_if_SG()? "sg" : "tcp");
sock->meas = measurement;
/* Call plugin socket creation function */
- DEBUG1("Prepare socket with plugin (fct=%p)", trp->socket_server);
+ XBT_DEBUG("Prepare socket with plugin (fct=%p)", trp->socket_server);
TRY {
trp->socket_server(trp, port, sock);
- DEBUG3("in=%c out=%c accept=%c",
+ XBT_DEBUG("in=%c out=%c accept=%c",
sock->incoming ? 'y' : 'n',
sock->outgoing ? 'y' : 'n', sock->accepting ? 'y' : 'n');
} CATCH(e) {
trp = gras_trp_plugin_get_by_name(gras_if_SG()? "sg" : "tcp");
- DEBUG1("Create a client socket from plugin %s",
+ XBT_DEBUG("Create a client socket from plugin %s",
gras_if_RL()? "tcp" : "sg");
/* defaults settings */
gras_trp_socket_new(0, &sock);
/* plugin-specific */
TRY {
(*trp->socket_client) (trp,host,port,sock);
- DEBUG3("in=%c out=%c accept=%c",
+ XBT_DEBUG("in=%c out=%c accept=%c",
sock->incoming ? 'y' : 'n',
sock->outgoing ? 'y' : 'n', sock->accepting ? 'y' : 'n');
} CATCH(e) {
unsigned int cursor;
XBT_IN;
- VERB1("Close %p", sock);
+ XBT_VERB("Close %p", sock);
if (sock == _gras_lastly_selected_socket) {
xbt_assert0(!gras_opt_trp_nomoredata_on_close || !sock->moredata,
"Closing a socket having more data in buffer while the nomoredata_on_close option is activated");
if (sock->moredata)
- CRITICAL0
+ XBT_CRITICAL
("Closing a socket having more data in buffer. Option nomoredata_on_close disabled, so continuing.");
_gras_lastly_selected_socket = NULL;
}
/* FIXME: Issue an event when the socket is closed */
- DEBUG1("sockets pointer before %p", sockets);
+ XBT_DEBUG("sockets pointer before %p", sockets);
if (sock) {
/* FIXME: Cannot get the dynar mutex, because it can be already locked */
// _xbt_dynar_foreach(sockets,cursor,sock_iter) {
for (cursor = 0; cursor < xbt_dynar_length(sockets); cursor++) {
_xbt_dynar_cursor_get(sockets, cursor, &sock_iter);
if (sock == sock_iter) {
- DEBUG2("remove sock cursor %d dize %lu\n", cursor,
+ XBT_DEBUG("remove sock cursor %d dize %lu\n", cursor,
xbt_dynar_length(sockets));
xbt_dynar_cursor_rm(sockets, &cursor);
if (sock->plugin->socket_close)
return;
}
}
- WARN1
+ XBT_WARN
("Ignoring request to free an unknown socket (%p). Execution stack:",
sock);
xbt_backtrace_display_current();
"Socket not suited for data send (was created with gras_socket_server(), not gras_socket_client())");
for (sent_sofar = 0; sent_sofar < msg_amount; sent_sofar++) {
- CDEBUG5(gras_trp_meas,
+ XBT_CDEBUG(gras_trp_meas,
"Sent %lu msgs of %lu (size of each: %ld) to %s:%d",
sent_sofar, msg_amount, msg_size, gras_socket_peer_name(peer),
gras_socket_peer_port(peer));
(*peer->plugin->raw_send) (peer, chunk, msg_size);
}
- CDEBUG5(gras_trp_meas,
+ XBT_CDEBUG(gras_trp_meas,
"Sent %lu msgs of %lu (size of each: %ld) to %s:%d", sent_sofar,
msg_amount, msg_size, gras_socket_peer_name(peer),
gras_socket_peer_port(peer));
xbt_assert0(peer->incoming, "Socket not suited for data receive");
for (got_sofar = 0; got_sofar < msg_amount; got_sofar++) {
- CDEBUG5(gras_trp_meas,
+ XBT_CDEBUG(gras_trp_meas,
"Recvd %ld msgs of %lu (size of each: %ld) from %s:%d",
got_sofar, msg_amount, msg_size, gras_socket_peer_name(peer),
gras_socket_peer_port(peer));
(peer->plugin->raw_recv) (peer, chunk, msg_size);
}
- CDEBUG5(gras_trp_meas,
+ XBT_CDEBUG(gras_trp_meas,
"Recvd %ld msgs of %lu (size of each: %ld) from %s:%d",
got_sofar, msg_amount, msg_size, gras_socket_peer_name(peer),
gras_socket_peer_port(peer));
res = (peer->plugin->socket_accept) (peer);
res->meas = peer->meas;
- CDEBUG1(gras_trp_meas, "meas_accepted onto %d", res->sd);
+ XBT_CDEBUG(gras_trp_meas, "meas_accepted onto %d", res->sd);
return res;
}
unsigned int it;
gras_socket_t s;
- INFO1("** Dump the socket set %s", name);
+ XBT_INFO("** Dump the socket set %s", name);
xbt_dynar_foreach(procdata->sockets, it, s) {
- INFO4(" %p -> %s:%d %s",
+ XBT_INFO(" %p -> %s:%d %s",
s, gras_socket_peer_name(s), gras_socket_peer_port(s),
s->valid ? "(valid)" : "(peer dead)");
}
- INFO1("** End of socket set %s", name);
+ XBT_INFO("** End of socket set %s", name);
}
/*
res->sd = 1; /* stdout */
}
- DEBUG5("sock_client_from_file(%s): sd=%d in=%c out=%c accept=%c",
+ XBT_DEBUG("sock_client_from_file(%s): sd=%d in=%c out=%c accept=%c",
path,
res->sd,
res->incoming ? 'y' : 'n',
res->sd = 0; /* stdin */
}
- DEBUG4("sd=%d in=%c out=%c accept=%c",
+ XBT_DEBUG("sd=%d in=%c out=%c accept=%c",
res->sd,
res->incoming ? 'y' : 'n',
res->outgoing ? 'y' : 'n', res->accepting ? 'y' : 'n');
data = sock->plugin->data;
if (sock->sd == 0) {
- DEBUG0("Do not close stdin");
+ XBT_DEBUG("Do not close stdin");
} else if (sock->sd == 1) {
- DEBUG0("Do not close stdout");
+ XBT_DEBUG("Do not close stdout");
} else {
- DEBUG1("close file connection %d", sock->sd);
+ XBT_DEBUG("close file connection %d", sock->sd);
/* forget about the socket */
FD_CLR(sock->sd, &(data->incoming_socks));
/* close the socket */
if (close(sock->sd) < 0) {
- WARN2("error while closing file %d: %s", sock->sd, strerror(errno));
+ XBT_WARN("error while closing file %d: %s", sock->sd, strerror(errno));
}
}
}
while (size) {
int status = 0;
- DEBUG3("write(%d, %p, %ld);", sock->sd, data, (long int) size);
+ XBT_DEBUG("write(%d, %p, %ld);", sock->sd, data, (long int) size);
status = write(sock->sd, data, (long int) size);
if (status == -1) {
int status = 0;
status = read(sock->sd, data + got, (long int) size);
- DEBUG3("read(%d, %p, %ld);", sock->sd, data + got, size);
+ XBT_DEBUG("read(%d, %p, %ld);", sock->sd, data + got, size);
if (status < 0) {
THROW4(system_error, 0, "read(%d,%p,%d) failed: %s",
sock->data = data;
sock->incoming = 1;
- DEBUG8("%s (PID %d) connects in %s mode to %s:%d (rdv_ser:%p, rdv_cli:%p, comm:%p)",
+ XBT_DEBUG("%s (PID %d) connects in %s mode to %s:%d (rdv_ser:%p, rdv_cli:%p, comm:%p)",
SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid(),
sock->meas ? "meas" : "regular", host, port,
data->rdv_server,data->rdv_client,data->comm_recv);
sock->data = data;
- VERB10
+ XBT_VERB
("'%s' (%d) ears on %s:%d%s (%p; data:%p); Here rdv: %p; Remote rdv: %p; Comm %p",
SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid(),
SIMIX_host_self_get_name(), port,
unsigned int cpt;
gras_sg_portrec_t pr;
- XBT_IN1(" (sock=%p)", sock);
+ XBT_IN_F(" (sock=%p)", sock);
if (!sock)
return;
if (sock->incoming && !sock->outgoing && sockdata->server_port >= 0) {
/* server mode socket. Unregister it from 'OS' tables */
xbt_dynar_foreach(hd->ports, cpt, pr) {
- DEBUG2("Check pr %d of %lu", cpt, xbt_dynar_length(hd->ports));
+ XBT_DEBUG("Check pr %d of %lu", cpt, xbt_dynar_length(hd->ports));
if (pr->port == sockdata->server_port) {
xbt_dynar_cursor_rm(hd->ports, &cpt);
XBT_OUT;
return;
}
}
- WARN2
+ XBT_WARN
("socket_close called on the unknown incoming socket %p (port=%d)",
sock, sockdata->server_port);
}
(sock->sd, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof(size))
|| setsockopt(sock->sd, SOL_SOCKET, SO_SNDBUF, (char *) &size,
sizeof(size))) {
- VERB1("setsockopt failed, cannot set buffer size: %s",
+ XBT_VERB("setsockopt failed, cannot set buffer size: %s",
sock_errstr(sock_errno));
}
}
gras_trp_tcp_send(sock, (char *) &myport, sizeof(uint32_t));
- DEBUG1("peerport sent to %d", sockdata->peer_port);
+ XBT_DEBUG("peerport sent to %d", sockdata->peer_port);
- VERB4("Connect to %s:%d (sd=%d, port %d here)",
+ XBT_VERB("Connect to %s:%d (sd=%d, port %d here)",
sockdata->peer_name, sockdata->peer_port, sock->sd, sockdata->port);
}
(char *) &size, sizeof(size))
|| setsockopt(sock->sd, SOL_SOCKET, SO_SNDBUF,
(char *) &size, sizeof(size))) {
- VERB1("setsockopt failed, cannot set buffer size: %s",
+ XBT_VERB("setsockopt failed, cannot set buffer size: %s",
sock_errstr(sock_errno));
}
sock_errstr(sock_errno));
}
- DEBUG2("Listen on port %d (sd=%d)", sockdata->port, sock->sd);
+ XBT_DEBUG("Listen on port %d (sd=%d)", sockdata->port, sock->sd);
if (listen(sock->sd, 5) < 0) {
tcp_close(sock->sd);
THROW2(system_error, 0,
sockdata->port, sock_errstr(sock_errno));
}
- VERB2("Openned a server socket on port %d (sd=%d)", sockdata->port,
+ XBT_VERB("Openned a server socket on port %d (sd=%d)", sockdata->port,
sock->sd);
}
if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof(size))
|| setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *) &size,
sizeof(size)))
- VERB1("setsockopt failed, cannot set buffer size: %s",
+ XBT_VERB("setsockopt failed, cannot set buffer size: %s",
sock_errstr(tmp_errno));
res->plugin = sock->plugin;
gras_trp_tcp_recv(res, (char *) &hisport, sizeof(hisport));
sockdata->peer_port = ntohl(hisport);
- DEBUG1("peerport %d received", sockdata->peer_port);
+ XBT_DEBUG("peerport %d received", sockdata->peer_port);
/* FIXME: Lock to protect inet_ntoa */
if (((struct sockaddr *) &peer_in)->sa_family != AF_INET) {
}
}
- VERB3("Accepted from %s:%d (sd=%d)", sockdata->peer_name, sockdata->peer_port, sd);
+ XBT_VERB("Accepted from %s:%d (sd=%d)", sockdata->peer_name, sockdata->peer_port, sd);
xbt_dynar_push(((gras_trp_procdata_t)
gras_libdata_by_id(gras_trp_libdata_id))->sockets, &res);
free(((gras_trp_tcp_sock_data_t)sock->data)->peer_name);
free(sock->data);
- VERB1("close tcp connection %d", sock->sd);
+ XBT_VERB("close tcp connection %d", sock->sd);
/* ask the listener to close the socket */
gras_msg_listener_close_socket(sock->sd);
int status = 0;
status = tcp_write(sock->sd, data, (size_t) size);
- DEBUG3("write(%d, %p, %ld);", sock->sd, data, size);
+ XBT_DEBUG("write(%d, %p, %ld);", sock->sd, data, size);
if (status < 0) {
#ifdef EWOULDBLOCK
while (size > got) {
int status = 0;
- DEBUG5("read(%d, %p, %ld) got %d so far (%s)",
+ XBT_DEBUG("read(%d, %p, %ld) got %d so far (%s)",
sock->sd, data + got, bufsize, got,
hexa_str((unsigned char *) data, got, 0));
status = tcp_read(sock->sd, data + got, (size_t) bufsize);
sock->sd, data + got, (int) size, gras_socket_peer_name(sock),
gras_socket_peer_port(sock), sock_errstr(sock_errno), got);
}
- DEBUG2("Got %d more bytes (%s)", status,
+ XBT_DEBUG("Got %d more bytes (%s)", status,
hexa_str((unsigned char *) data + got, status, 0));
if (status) {
gras_trp_bufdata_t *data = sock->bufdata;
XBT_IN;
- DEBUG0("Flush");
+ XBT_DEBUG("Flush");
if (data->out == buffering_buf) {
if (XBT_LOG_ISENABLED(gras_trp_tcp, xbt_log_priority_debug))
hexa_print("chunk to send ",
(unsigned char *) data->out_buf.data, data->out_buf.size);
if ((data->out_buf.size - data->out_buf.pos) != 0) {
- DEBUG3("Send the chunk (size=%d) to %s:%d", data->out_buf.size,
+ XBT_DEBUG("Send the chunk (size=%d) to %s:%d", data->out_buf.size,
gras_socket_peer_name(sock), gras_socket_peer_port(sock));
gras_trp_tcp_send(sock, data->out_buf.data, data->out_buf.size);
- VERB1("Chunk sent (size=%d)", data->out_buf.size);
+ XBT_VERB("Chunk sent (size=%d)", data->out_buf.size);
data->out_buf.size = 0;
}
}
#ifdef HAVE_READV
if (data->out == buffering_iov) {
- DEBUG0("Flush out iov");
+ XBT_DEBUG("Flush out iov");
vect = sock->bufdata->out_buf_v;
if ((size = xbt_dynar_length(vect))) {
- DEBUG1("Flush %d chunks out of this socket", size);
+ XBT_DEBUG("Flush %d chunks out of this socket", size);
writev(sock->sd, xbt_dynar_get_ptr(vect, 0), size);
xbt_dynar_reset(vect);
}
}
if (data->in == buffering_iov) {
- DEBUG0("Flush in iov");
+ XBT_DEBUG("Flush in iov");
vect = sock->bufdata->in_buf_v;
if ((size = xbt_dynar_length(vect))) {
- DEBUG1("Get %d chunks from of this socket", size);
+ XBT_DEBUG("Get %d chunks from of this socket", size);
readv(sock->sd, xbt_dynar_get_ptr(vect, 0), size);
xbt_dynar_reset(vect);
}
/* size of the chunk to receive in that shot */
long int thissize =
min(size - chunk_pos, data->buffsize - data->out_buf.size);
- DEBUG4("Set the chars %d..%ld into the buffer; size=%ld, ctn=(%s)",
+ XBT_DEBUG("Set the chars %d..%ld into the buffer; size=%ld, ctn=(%s)",
(int) data->out_buf.size,
((int) data->out_buf.size) + thissize - 1, size,
hexa_str((unsigned char *) chunk, thissize, 0));
data->out_buf.size += thissize;
chunk_pos += thissize;
- DEBUG4("New pos = %d; Still to send = %ld of %ld; ctn sofar=(%s)",
+ XBT_DEBUG("New pos = %d; Still to send = %ld of %ld; ctn sofar=(%s)",
data->out_buf.size, size - chunk_pos, size,
hexa_str((unsigned char *) chunk, chunk_pos, 0));
if (data->in_buf.size == data->in_buf.pos) { /* out of data. Get more */
- DEBUG2("Get more data (size=%d,bufsize=%d)",
+ XBT_DEBUG("Get more data (size=%d,bufsize=%d)",
(int) MIN(size - chunk_pos, data->buffsize),
(int) data->buffsize);
data->in_buf.pos += thissize;
chunk_pos += thissize;
- DEBUG4("New pos = %d; Still to receive = %ld of %ld. Ctn so far=(%s)",
+ XBT_DEBUG("New pos = %d; Still to receive = %ld of %ld. Ctn so far=(%s)",
data->in_buf.pos, size - chunk_pos, size,
hexa_str((unsigned char *) chunk, chunk_pos, 0));
}
/* indicate on need to the gras_select function that there is more to read on this socket so that it does not actually select */
sock->moredata = (data->in_buf.size > data->in_buf.pos);
- DEBUG1("There is %smore data", (sock->moredata ? "" : "no "));
+ XBT_DEBUG("There is %smore data", (sock->moredata ? "" : "no "));
XBT_OUT;
return chunk_pos;
gras_trp_bufdata_t *data = (gras_trp_bufdata_t *) sock->bufdata;
- DEBUG1("Buffer one chunk to be sent later (%s)",
+ XBT_DEBUG("Buffer one chunk to be sent later (%s)",
hexa_str((char *) chunk, size, 0));
elm.iov_len = (size_t) size;
{
struct iovec elm;
- DEBUG0("Buffer one chunk to be received later");
+ XBT_DEBUG("Buffer one chunk to be received later");
elm.iov_base = (void *) chunk;
elm.iov_len = (size_t) size;
xbt_dynar_push(sock->bufdata->in_buf_v, &elm);
gras_trp_bufdata_t *data = sock->bufdata;
if (data->in_buf.size != data->in_buf.pos) {
- WARN3("Socket closed, but %d bytes were unread (size=%d,pos=%d)",
+ XBT_WARN("Socket closed, but %d bytes were unread (size=%d,pos=%d)",
data->in_buf.size - data->in_buf.pos,
data->in_buf.size, data->in_buf.pos);
}
free(data->in_buf.data);
if (data->out_buf.size != data->out_buf.pos) {
- DEBUG2("Flush the socket before closing (in=%d,out=%d)",
+ XBT_DEBUG("Flush the socket before closing (in=%d,out=%d)",
data->in_buf.size, data->out_buf.size);
gras_trp_bufiov_flush(sock);
}
#ifdef HAVE_READV
if (data->in_buf_v) {
if (xbt_dynar_length(data->in_buf_v))
- WARN0("Socket closed, but some bytes were unread");
+ XBT_WARN("Socket closed, but some bytes were unread");
xbt_dynar_free(&data->in_buf_v);
}
if (data->out_buf_v) {
if (xbt_dynar_length(data->out_buf_v)) {
- DEBUG0("Flush the socket before closing");
+ XBT_DEBUG("Flush the socket before closing");
gras_trp_bufiov_flush(sock);
}
xbt_dynar_free(&data->out_buf_v);
"Module %s reregistered with a different p_id field!",
name);
- DEBUG1("Module %s already registered. Ignoring re-registration", name);
+ XBT_DEBUG("Module %s already registered. Ignoring re-registration", name);
return;
}
- VERB1("Register module %s", name);
+ XBT_VERB("Register module %s", name);
mod = xbt_new(s_gras_module_t, 1);
mod->name = xbt_strdup(name);
mod->name_len = strlen(name);
gras_module_t mod =
(gras_module_t) xbt_set_get_by_name(_gras_modules, name);
- VERB2("Join to module %s (%p)", name, mod);
+ XBT_VERB("Join to module %s (%p)", name, mod);
/* NEW */
if (mod->refcount == 0) {
- VERB1("Init module %s", name);
+ XBT_VERB("Init module %s", name);
mod->name = xbt_strdup(name);
(*mod->init_f) ();
} else {
- DEBUG3("Module %s already inited. Refcount=%d ID=%d",
+ XBT_DEBUG("Module %s already inited. Refcount=%d ID=%d",
mod->name, mod->refcount, *(mod->p_id));
}
mod->refcount++;
(*mod->join_f) (moddata);
- DEBUG2("Module %s joined successfully (ID=%d)", name, *(mod->p_id));
+ XBT_DEBUG("Module %s joined successfully (ID=%d)", name, *(mod->p_id));
}
void gras_module_leave(const char *name)
gras_module_t mod =
(gras_module_t) xbt_set_get_by_name(_gras_modules, name);
- VERB1("Leave module %s", name);
+ XBT_VERB("Leave module %s", name);
/* LEAVE */
moddata = gras_moddata_by_id(*(mod->p_id));
/* EXIT */
mod->refcount--;
if (!mod->refcount) {
- VERB1("Exit module %s", name);
+ XBT_VERB("Exit module %s", name);
(*mod->exit_f) ();
volatile int found = 0;
if (cursor + 1 <= xbt_set_length(pd->libdata)) {
- DEBUG2("Skip fabric %d: there is already %ld libdata",
+ XBT_DEBUG("Skip fabric %d: there is already %ld libdata",
cursor, xbt_set_length(pd->libdata));
continue; /* allow to recall this function to get recently added fabrics */
}
- DEBUG2("Go ahead for cursor %d, there is %ld libdata",
+ XBT_DEBUG("Go ahead for cursor %d, there is %ld libdata",
cursor, xbt_set_length(pd->libdata));
xbt_assert1(fab.name, "Name of fabric #%d is NULL!", cursor);
- DEBUG1("Create the procdata for %s", fab.name);
+ XBT_DEBUG("Create the procdata for %s", fab.name);
/* Check for our own errors */
TRY {
xbt_set_get_by_name(pd->libdata, fab.name);
elem = (*(fab.constructor)) ();
if (elem->name_len && elem->name_len != strlen(elem->name)) {
elem->name_len = strlen(elem->name);
- WARN1
+ XBT_WARN
("Module '%s' constructor is borken: it does not set elem->name_len",
fab.name);
}
char *equal, *buf = xbt_strdup(*env_iter);
equal = strchr(buf, '=');
if (!equal) {
- WARN1
+ XBT_WARN
("The environment contains an entry without '=' char: %s (ignore it)",
*env_iter);
continue;
ir = xbt_dict_get_or_null(benchmark_set, locbuf);
if (!ir) {
- DEBUG1("%s", locbuf);
+ XBT_DEBUG("%s", locbuf);
duration = 1;
xbt_os_timer_start(timer);
return 1;
} else {
duration = get_from_dict(benchmark_set, locbuf);
}
- DEBUG2("Simulate the run of a task of %f sec for %s", duration, locbuf);
+ XBT_DEBUG("Simulate the run of a task of %f sec for %s", duration, locbuf);
gras_cpu_burn(duration / reference);
return 0;
}
trp_pd->meas_selectable_sockets =
xbt_queue_new(0, sizeof(gras_socket_t));
- VERB2("Creating process '%s' (%d)", SIMIX_process_self_get_name(),
+ XBT_VERB("Creating process '%s' (%d)", SIMIX_process_self_get_name(),
gras_os_getpid());
}
xbt_assert0(hd, "Run gras_process_init (ie, gras_init)!!");
- VERB2("GRAS: Finalizing process '%s' (%d)",
+ XBT_VERB("GRAS: Finalizing process '%s' (%d)",
SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid());
if (xbt_dynar_length(msg_pd->msg_queue)) {
unsigned int cpt;
s_gras_msg_t msg;
- WARN2
+ XBT_WARN
("process %d terminated, but %ld messages are still queued. Message list:",
gras_os_getpid(), xbt_dynar_length(msg_pd->msg_queue));
xbt_dynar_foreach(msg_pd->msg_queue, cpt, msg) {
- WARN5(" Message %s (%s) from %s@%s:%d", msg.type->name,
+ XBT_WARN(" Message %s (%s) from %s@%s:%d", msg.type->name,
e_gras_msg_kind_names[msg.kind],
gras_socket_peer_proc(msg.expe),
gras_socket_peer_name(msg.expe),
/* if each process has its sockets list, we need to close them when the
process finish */
xbt_dynar_foreach(sockets, cursor, sock_iter) {
- VERB1("Closing the socket %p left open on exit. Maybe a socket leak?",
+ XBT_VERB("Closing the socket %p left open on exit. Maybe a socket leak?",
sock_iter);
gras_socket_close(sock_iter);
}
#if defined(HAVE_SIGNAL) && defined(HAVE_SIGNAL_H)
static void gras_sigusr_handler(int sig)
{
- INFO0("SIGUSR1 received. Display the backtrace");
+ XBT_INFO("SIGUSR1 received. Display the backtrace");
xbt_backtrace_display_current();
}
int first = 0;
gras_procdata_t *pd;
gras_msg_procdata_t msg_pd;
- VERB0("Initialize GRAS");
+ XBT_VERB("Initialize GRAS");
xbt_getpid = gras_os_getpid;
/* First initialize the XBT */
void gras_exit(void)
{
gras_procdata_t *pd;
- INFO0("Exiting GRAS");
+ XBT_INFO("Exiting GRAS");
amok_exit();
gras_moddata_leave();
pd = gras_procdata_get();
return 0;
}
- DEBUG0("Tracing starts");
+ XBT_DEBUG("Tracing starts");
/* open the trace file */
TRACE_paje_start();
/* activate trace */
TRACE_desactivate ();
- DEBUG0("Tracing system is shutdown");
+ XBT_DEBUG("Tracing system is shutdown");
return 0;
}
{
xbt_assert0 (trace_active==0, "Tracing is already active.");
trace_active = 1;
- DEBUG0 ("Tracing is on");
+ XBT_DEBUG ("Tracing is on");
}
void TRACE_desactivate (void)
{
trace_active = 0;
- DEBUG0 ("Tracing is off");
+ XBT_DEBUG ("Tracing is off");
}
int TRACE_is_active (void)
//check if we do have categories declared
if (xbt_dict_length(created_categories) == 0){
- INFO0("No categories declared, ignoring generation of triva graph configuration");
+ XBT_INFO("No categories declared, ignoring generation of triva graph configuration");
return;
}
snprintf (final_color, INSTR_DEFAULT_STR_SIZE, "%s", color);
}
- DEBUG2("CAT,declare %s, %s", category, final_color);
+ XBT_DEBUG("CAT,declare %s, %s", category, final_color);
//FIXME
// - if (final) {
if (!mark_type)
return;
- DEBUG1("MARK,declare %s", mark_type);
+ XBT_DEBUG("MARK,declare %s", mark_type);
getEventType(mark_type, NULL, getRootType());
}
if (!mark_type || !mark_value)
return;
- DEBUG2("MARK %s %s", mark_type, mark_value);
+ XBT_DEBUG("MARK %s %s", mark_type, mark_value);
type_t type = getEventType (mark_type, NULL, getRootContainer()->type);
val_t value = getValue (mark_value, NULL, type);
new_pajeNewEvent (MSG_get_clock(), getRootContainer(), type, value);
//set task category
task->category = xbt_strdup (category);
- DEBUG3("MSG task %p(%s), category %s", task, task->name, task->category);
+ XBT_DEBUG("MSG task %p(%s), category %s", task, task->name, task->category);
if (TRACE_msg_task_is_enabled()){
m_host_t host = MSG_host_self();
static long long counter = 0;
task->counter = counter++;
task->category = NULL;
- DEBUG2("CREATE %p, %lld", task, task->counter);
+ XBT_DEBUG("CREATE %p, %lld", task, task->counter);
}
/* MSG_task_execute related functions */
void TRACE_msg_task_execute_start(m_task_t task)
{
- DEBUG3("EXEC,in %p, %lld, %s", task, task->counter, task->category);
+ XBT_DEBUG("EXEC,in %p, %lld, %s", task, task->counter, task->category);
if (TRACE_msg_task_is_enabled()){
container_t task_container = getContainer (task->name);
void TRACE_msg_task_execute_end(m_task_t task)
{
- DEBUG3("EXEC,out %p, %lld, %s", task, task->counter, task->category);
+ XBT_DEBUG("EXEC,out %p, %lld, %s", task, task->counter, task->category);
if (TRACE_msg_task_is_enabled()){
container_t task_container = getContainer (task->name);
/* MSG_task_destroy related functions */
void TRACE_msg_task_destroy(m_task_t task)
{
- DEBUG3("DESTROY %p, %lld, %s", task, task->counter, task->category);
+ XBT_DEBUG("DESTROY %p, %lld, %s", task, task->counter, task->category);
if (TRACE_msg_task_is_enabled()){
//that's the end, let's destroy it
/* MSG_task_get related functions */
void TRACE_msg_task_get_start(void)
{
- DEBUG0("GET,in");
+ XBT_DEBUG("GET,in");
if (TRACE_msg_task_is_enabled()){
//task not received yet, nothing to do
void TRACE_msg_task_get_end(double start_time, m_task_t task)
{
- DEBUG3("GET,out %p, %lld, %s", task, task->counter, task->category);
+ XBT_DEBUG("GET,out %p, %lld, %s", task, task->counter, task->category);
if (TRACE_msg_task_is_enabled()){
/* MSG_task_put related functions */
int TRACE_msg_task_put_start(m_task_t task)
{
- DEBUG3("PUT,in %p, %lld, %s", task, task->counter, task->category);
+ XBT_DEBUG("PUT,in %p, %lld, %s", task, task->counter, task->category);
if (TRACE_msg_task_is_enabled()){
void TRACE_msg_task_put_end(void)
{
- DEBUG0("PUT,out");
+ XBT_DEBUG("PUT,out");
if (TRACE_msg_task_is_enabled()){
//task no longer exists here
ret->id = xbt_strdup (str_id);
xbt_dict_set (father->values, valuename, ret, NULL);
- DEBUG2("new value %s, child of %s", ret->name, ret->father->name);
+ XBT_DEBUG("new value %s, child of %s", ret->name, ret->father->name);
return ret;
}
val_t ret = (val_t)xbt_dict_get_or_null (father->values, valuename);
if (ret == NULL){
ret = newValue (valuename, color, father);
- DEBUG4("EntityValue %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
+ XBT_DEBUG("EntityValue %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
new_pajeDefineEntityValue(ret);
}
return ret;
if (father != NULL){
xbt_dict_set (father->children, key, ret, NULL);
- DEBUG2("new type %s, child of %s", typename, father->name);
+ XBT_DEBUG("new type %s, child of %s", typename, father->name);
}
return ret;
}
}else{
ret = newType (typename, typename, color, TYPE_EVENT, father);
}
- DEBUG4("EventType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
+ XBT_DEBUG("EventType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
new_pajeDefineEventType(ret);
}
return ret;
}else{
ret = newType (typename, typename, color, TYPE_VARIABLE, father);
}
- DEBUG4("VariableType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
+ XBT_DEBUG("VariableType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
new_pajeDefineVariableType (ret);
}
return ret;
type_t ret = xbt_dict_get_or_null (father->children, key);
if (ret == NULL){
ret = newType (typename, key, NULL, TYPE_LINK, father);
- DEBUG8("LinkType %s(%s), child of %s(%s) %s(%s)->%s(%s)", ret->name, ret->id, father->name, father->id, source->name, source->id, dest->name, dest->id);
+ XBT_DEBUG("LinkType %s(%s), child of %s(%s) %s(%s)->%s(%s)", ret->name, ret->id, father->name, father->id, source->name, source->id, dest->name, dest->id);
new_pajeDefineLinkType(ret, source, dest);
}
return ret;
type_t ret = xbt_dict_get_or_null (father->children, typename);
if (ret == NULL){
ret = newType (typename, typename, NULL, TYPE_STATE, father);
- DEBUG4("StateType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
+ XBT_DEBUG("StateType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
new_pajeDefineStateType(ret);
}
return ret;
// level depends on level of father
if (new->father){
new->level = new->father->level+1;
- DEBUG2("new container %s, child of %s", name, father->name);
+ XBT_DEBUG("new container %s, child of %s", name, father->name);
}else{
new->level = 0;
}
xbt_dict_remove(container->father->children, container->name);
}
- DEBUG1("destroy container %s", container->name);
+ XBT_DEBUG("destroy container %s", container->name);
//obligation to dump previous events because they might
//reference the container that is about to be destroyed
tracing_file = fopen(filename, "w");
xbt_assert1 (tracing_file != NULL, "Tracefile %s could not be opened for writing.", filename);
- DEBUG1("Filename %s is open for writing", filename);
+ XBT_DEBUG("Filename %s is open for writing", filename);
/* output header */
TRACE_paje_create_header();
{
fclose(tracing_file);
char *filename = TRACE_get_filename();
- DEBUG1("Filename %s is closed", filename);
+ XBT_DEBUG("Filename %s is closed", filename);
}
double TRACE_last_timestamp_to_dump = 0;
//dumps the trace file until the timestamp TRACE_last_timestamp_to_dump
void TRACE_paje_dump_buffer (int force)
{
- DEBUG2("%s: dump until %f. starts", __FUNCTION__, TRACE_last_timestamp_to_dump);
+ XBT_DEBUG("%s: dump until %f. starts", __FUNCTION__, TRACE_last_timestamp_to_dump);
if (force){
paje_event_t event;
unsigned int i;
event->free (event);
}
}
- DEBUG1("%s: ends", __FUNCTION__);
+ XBT_DEBUG("%s: ends", __FUNCTION__);
}
void TRACE_paje_create_header(void)
{
- DEBUG0 ("Define paje header");
+ XBT_DEBUG ("Define paje header");
fprintf(tracing_file, "\
%%EventDef PajeDefineContainerType %d \n\
%% Alias string \n\
/* internal do the instrumentation module */
static void insert_into_buffer (paje_event_t tbi)
{
- DEBUG4("%s: insert event_type=%d, timestamp=%f, buffersize=%ld)", __FUNCTION__, tbi->event_type, tbi->timestamp, xbt_dynar_length(buffer));
+ XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%ld)", __FUNCTION__, tbi->event_type, tbi->timestamp, xbt_dynar_length(buffer));
unsigned int i;
unsigned long len = xbt_dynar_length(buffer);
if (len == 0){
xbt_dynar_push (buffer, &tbi);
- DEBUG1("%s: inserted at beginning", __FUNCTION__);
+ XBT_DEBUG("%s: inserted at beginning", __FUNCTION__);
}else{
//check if last event has the same timestamp that tbi event
paje_event_t e2 = *(paje_event_t*)xbt_dynar_get_ptr (buffer, len-1);
if (e2->timestamp == tbi->timestamp){
//insert at the end
- DEBUG2("%s: inserted at end, pos = %ld", __FUNCTION__, len);
+ XBT_DEBUG("%s: inserted at end, pos = %ld", __FUNCTION__, len);
xbt_dynar_insert_at (buffer, len, &tbi);
return;
}
paje_event_t e1 = *(paje_event_t*)xbt_dynar_get_ptr(buffer, i);
if (e1->timestamp > tbi->timestamp){
xbt_dynar_insert_at (buffer, i, &tbi);
- DEBUG2("%s: inserted at %d", __FUNCTION__, i);
+ XBT_DEBUG("%s: inserted at %d", __FUNCTION__, i);
inserted = 1;
break;
}
}
if (!inserted){
xbt_dynar_push (buffer, &tbi);
- DEBUG1("%s: inserted at end", __FUNCTION__);
+ XBT_DEBUG("%s: inserted at end", __FUNCTION__);
}
}
}
static void print_pajeDefineContainerType(paje_event_t event)
{
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
fprintf(tracing_file, "%d %s %s %s\n",
event->event_type,
((defineContainerType_t)event->data)->type->id,
static void print_pajeDefineVariableType(paje_event_t event)
{
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
fprintf(tracing_file, "%d %s %s %s \"%s\"\n",
event->event_type,
((defineVariableType_t)event->data)->type->id,
static void print_pajeDefineStateType(paje_event_t event)
{
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
fprintf(tracing_file, "%d %s %s %s\n",
event->event_type,
((defineStateType_t)event->data)->type->id,
static void print_pajeDefineEventType(paje_event_t event)
{
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
fprintf(tracing_file, "%d %s %s %s \"%s\"\n",
event->event_type,
((defineEventType_t)event->data)->type->id,
static void print_pajeDefineLinkType(paje_event_t event)
{
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
fprintf(tracing_file, "%d %s %s %s %s %s\n",
event->event_type,
((defineLinkType_t)event->data)->type->id,
static void print_pajeDefineEntityValue (paje_event_t event)
{
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
fprintf(tracing_file, "%d %s %s %s \"%s\"\n",
event->event_type,
((defineEntityValue_t)event->data)->value->id,
static void print_pajeCreateContainer(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %s %s\n",
event->event_type,
static void print_pajeDestroyContainer(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s\n",
event->event_type,
static void print_pajeSetVariable(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %f\n",
event->event_type,
static void print_pajeAddVariable(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %f\n",
event->event_type,
static void print_pajeSubVariable(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %f\n",
event->event_type,
static void print_pajeSetState(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %s\n",
event->event_type,
static void print_pajePushState(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %s\n",
event->event_type,
static void print_pajePopState(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s\n",
event->event_type,
static void print_pajeStartLink(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %s %s %s\n",
event->event_type,
static void print_pajeEndLink(paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %s %s %s\n",
event->event_type,
static void print_pajeNewEvent (paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->timestamp == 0){
fprintf(tracing_file, "%d 0 %s %s %s\n",
event->event_type,
static void free_paje_event (paje_event_t event)
{
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
if (event->event_type == PAJE_StartLink){
xbt_free (((startLink_t)(event->data))->value);
xbt_free (((startLink_t)(event->data))->key);
event->data = xbt_new0(s_defineContainerType_t, 1);
((defineContainerType_t)(event->data))->type = type;
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
//print it
event->print (event);
event->data = xbt_new0(s_defineVariableType_t, 1);
((defineVariableType_t)(event->data))->type = type;
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
//print it
event->print (event);
event->data = xbt_new0(s_defineStateType_t, 1);
((defineStateType_t)(event->data))->type = type;
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
//print it
event->print (event);
event->data = xbt_new0(s_defineEventType_t, 1);
((defineEventType_t)(event->data))->type = type;
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
//print it
event->print (event);
((defineLinkType_t)(event->data))->source = source;
((defineLinkType_t)(event->data))->dest = dest;
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
//print it
event->print (event);
event->data = xbt_new0(s_defineEntityValue_t, 1);
((defineEntityValue_t)(event->data))->value = value;
- DEBUG2("%s: event_type=%d", __FUNCTION__, event->event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, event->event_type);
//print it
event->print (event);
event->data = xbt_new0(s_createContainer_t, 1);
((createContainer_t)(event->data))->container = container;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
//print it
event->print (event);
event->data = xbt_new0(s_destroyContainer_t, 1);
((destroyContainer_t)(event->data))->container = container;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
//print it
event->print (event);
((setVariable_t)(event->data))->container = container;
((setVariable_t)(event->data))->value = value;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
((addVariable_t)(event->data))->container = container;
((addVariable_t)(event->data))->value = value;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
((subVariable_t)(event->data))->container = container;
((subVariable_t)(event->data))->value = value;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
((setState_t)(event->data))->container = container;
((setState_t)(event->data))->value = value;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
((pushState_t)(event->data))->container = container;
((pushState_t)(event->data))->value = value;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
((popState_t)(event->data))->type = type;
((popState_t)(event->data))->container = container;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
((startLink_t)(event->data))->value = xbt_strdup(value);
((startLink_t)(event->data))->key = xbt_strdup(key);
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
((endLink_t)(event->data))->value = xbt_strdup(value);
((endLink_t)(event->data))->key = xbt_strdup(key);
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
((newEvent_t)(event->data))->container = container;
((newEvent_t)(event->data))->value = value;
- DEBUG3("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, event->event_type, event->timestamp);
insert_into_buffer (event);
}
//trace uncategorized link utilization
if (TRACE_uncategorized()){
- DEBUG4("UNCAT LINK [%f - %f] %s bandwidth_used %f", now, now+delta, resource, value);
+ XBT_DEBUG("UNCAT LINK [%f - %f] %s bandwidth_used %f", now, now+delta, resource, value);
container_t container = getContainerByName (resource);
type_t type = getVariableType("bandwidth_used", NULL, container->type);
TRACE_surf_resource_utilization_event(smx_action, now, delta, type->name, container->name, value);
if (TRACE_categorized()){
if (!surf_action->category)
return;
- DEBUG5("CAT LINK [%f - %f] %s %s %f", now, now+delta, resource, surf_action->category, value);
+ XBT_DEBUG("CAT LINK [%f - %f] %s %s %f", now, now+delta, resource, surf_action->category, value);
container_t container = getContainerByName (resource);
type_t type = getVariableType(surf_action->category, NULL, container->type);
TRACE_surf_resource_utilization_event(smx_action, now, delta, type->name, container->name, value);
//trace uncategorized host utilization
if (TRACE_uncategorized()){
- DEBUG4("UNCAT HOST [%f - %f] %s power_used %f", now, now+delta, resource, value);
+ XBT_DEBUG("UNCAT HOST [%f - %f] %s power_used %f", now, now+delta, resource, value);
container_t container = getContainerByName (resource);
type_t type = getVariableType("power_used", NULL, container->type);
TRACE_surf_resource_utilization_event(smx_action, now, delta, type->name, container->name, value);
if (TRACE_categorized()){
if (!surf_action->category)
return;
- DEBUG5("CAT HOST [%f - %f] %s %s %f", now, now+delta, resource, surf_action->category, value);
+ XBT_DEBUG("CAT HOST [%f - %f] %s %s %f", now, now+delta, resource, surf_action->category, value);
container_t container = getContainerByName (resource);
type_t type = getVariableType(surf_action->category, NULL, container->type);
TRACE_surf_resource_utilization_event(smx_action, now, delta, type->name, container->name, value);
{
if (!TRACE_is_active())
return;
- DEBUG1("START %p", action);
+ XBT_DEBUG("START %p", action);
TRACE_method_start(action);
}
{
if (!TRACE_is_active())
return;
- DEBUG6("EVENT %p [%f - %f] %s %s %f", action, now, now+delta, resource, variable, value);
+ XBT_DEBUG("EVENT %p [%f - %f] %s %s %f", action, now, now+delta, resource, variable, value);
TRACE_method_event(action, now, delta, variable, resource, value);
}
if (!TRACE_is_active())
return;
TRACE_method_end(action);
- DEBUG1("END %p", action);
+ XBT_DEBUG("END %p", action);
}
void TRACE_surf_resource_utilization_release()
xbt_fifo_unshift(mc_stack, initial_state);
MC_UNSET_RAW_MEM;
- DEBUG0("**************************************************");
- DEBUG0("Initial state");
+ XBT_DEBUG("**************************************************");
+ XBT_DEBUG("Initial state");
/* Wait for requests (schedules processes) */
MC_wait_for_requests();
state = (mc_state_t)
xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack));
- DEBUG0("**************************************************");
- DEBUG3("Exploration detph=%d (state=%p)(%u interleave)",
+ XBT_DEBUG("**************************************************");
+ XBT_DEBUG("Exploration detph=%d (state=%p)(%u interleave)",
xbt_fifo_size(mc_stack), state,
MC_state_interleave_size(state));
/* Debug information */
if(XBT_LOG_ISENABLED(mc_dpor, xbt_log_priority_debug)){
req_str = MC_request_to_string(req, value);
- DEBUG1("Execute: %s", req_str);
+ XBT_DEBUG("Execute: %s", req_str);
xbt_free(req_str);
}
/* The interleave set is empty or the maximum depth is reached, let's back-track */
} else {
- DEBUG0("There are no more processes to interleave.");
+ XBT_DEBUG("There are no more processes to interleave.");
/* Trash the current state, no longer needed */
MC_SET_RAW_MEM;
xbt_fifo_foreach(mc_stack, item, prev_state, mc_state_t) {
if(MC_request_depend(req, MC_state_get_internal_request(prev_state))){
if(XBT_LOG_ISENABLED(mc_dpor, xbt_log_priority_debug)){
- DEBUG0("Dependent Transitions:");
+ XBT_DEBUG("Dependent Transitions:");
prev_req = MC_state_get_executed_request(prev_state, &value);
req_str = MC_request_to_string(prev_req, value);
- DEBUG2("%s (state=%p)", req_str, prev_state);
+ XBT_DEBUG("%s (state=%p)", req_str, prev_state);
xbt_free(req_str);
prev_req = MC_state_get_executed_request(state, &value);
req_str = MC_request_to_string(prev_req, value);
- DEBUG2("%s (state=%p)", req_str, state);
+ XBT_DEBUG("%s (state=%p)", req_str, state);
xbt_free(req_str);
}
if(!MC_state_process_is_done(prev_state, req->issuer))
MC_state_interleave_process(prev_state, req->issuer);
else
- DEBUG1("Process %p is in done set", req->issuer);
+ XBT_DEBUG("Process %p is in done set", req->issuer);
break;
}
if (MC_state_interleave_size(state)) {
/* We found a back-tracking point, let's loop */
xbt_fifo_unshift(mc_stack, state);
- DEBUG1("Back-tracking to depth %d", xbt_fifo_size(mc_stack));
+ XBT_DEBUG("Back-tracking to depth %d", xbt_fifo_size(mc_stack));
MC_UNSET_RAW_MEM;
MC_replay(mc_stack);
break;
xbt_fifo_item_t item;
mc_state_t state;
- DEBUG0("**** Begin Replay ****");
+ XBT_DEBUG("**** Begin Replay ****");
/* Restore the initial state */
MC_restore_snapshot(initial_snapshot);
/* Debug information */
if(XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)){
req_str = MC_request_to_string(req, value);
- DEBUG2("Replay: %s (%p)", req_str, state);
+ XBT_DEBUG("Replay: %s (%p)", req_str, state);
xbt_free(req_str);
}
}
mc_stats->visited_states++;
mc_stats->executed_transitions++;
}
- DEBUG0("**** End Replay ****");
+ XBT_DEBUG("**** End Replay ****");
}
/**
req = MC_state_get_executed_request(state, &value);
if(req){
req_str = MC_request_to_string(req, value);
- INFO1("%s", req_str);
+ XBT_INFO("%s", req_str);
xbt_free(req_str);
}
}
void MC_show_deadlock(smx_req_t req)
{
/*char *req_str = NULL;*/
- INFO0("**************************");
- INFO0("*** DEAD-LOCK DETECTED ***");
- INFO0("**************************");
- INFO0("Locked request:");
+ XBT_INFO("**************************");
+ XBT_INFO("*** DEAD-LOCK DETECTED ***");
+ XBT_INFO("**************************");
+ XBT_INFO("Locked request:");
/*req_str = MC_request_to_string(req);
- INFO1("%s", req_str);
+ XBT_INFO("%s", req_str);
xbt_free(req_str);*/
- INFO0("Counter-example execution trace:");
+ XBT_INFO("Counter-example execution trace:");
MC_dump_stack(mc_stack);
}
void MC_print_statistics(mc_stats_t stats)
{
- INFO1("State space size ~= %lu", stats->state_size);
- INFO1("Expanded states = %lu", stats->expanded_states);
- INFO1("Visited states = %lu", stats->visited_states);
- INFO1("Executed transitions = %lu", stats->executed_transitions);
- INFO1("Expanded / Visited = %lf",
+ XBT_INFO("State space size ~= %lu", stats->state_size);
+ XBT_INFO("Expanded states = %lu", stats->expanded_states);
+ XBT_INFO("Visited states = %lu", stats->visited_states);
+ XBT_INFO("Executed transitions = %lu", stats->executed_transitions);
+ XBT_INFO("Expanded / Visited = %lf",
(double) stats->visited_states / stats->expanded_states);
- /*INFO1("Exploration coverage = %lf",
+ /*XBT_INFO("Exploration coverage = %lf",
(double)stats->expanded_states / stats->state_size); */
}
void MC_assert(int prop)
{
if (MC_IS_ENABLED && !prop) {
- INFO0("**************************");
- INFO0("*** PROPERTY NOT VALID ***");
- INFO0("**************************");
- INFO0("Counter-example execution trace:");
+ XBT_INFO("**************************");
+ XBT_INFO("*** PROPERTY NOT VALID ***");
+ XBT_INFO("**************************");
+ XBT_INFO("Counter-example execution trace:");
MC_dump_stack(mc_stack);
MC_print_statistics(mc_stats);
xbt_abort();
"This task is executed somewhere else. Go fix your code! %d",
task->simdata->isused);
- DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
+ XBT_DEBUG("Computing on %s", MSG_process_self()->simdata->m_host->name);
if (simdata->computation_amount == 0) {
#ifdef HAVE_TRACING
simdata->isused=0;
- DEBUG2("Execution task '%s' finished in state %d", task->name, comp_state);
+ XBT_DEBUG("Execution task '%s' finished in state %d", task->name, comp_state);
if (comp_state == SIMIX_DONE) {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
simdata->computation_amount = 0.0;
xbt_assert0(simdata->host_nb,
"This is not a parallel task. Go to hell.");
- DEBUG1("Parallel computing on %s", MSG_process_self()->simdata->m_host->name);
+ XBT_DEBUG("Parallel computing on %s", MSG_process_self()->simdata->m_host->name);
simdata->isused=1;
simdata->host_list,
simdata->comp_amount,
simdata->comm_amount, 1.0, -1.0);
- DEBUG1("Parallel execution action created: %p", simdata->compute);
+ XBT_DEBUG("Parallel execution action created: %p", simdata->compute);
self->simdata->waiting_action = simdata->compute;
comp_state = SIMIX_req_host_execution_wait(simdata->compute);
self->simdata->waiting_action = NULL;
- DEBUG2("Finished waiting for execution of action %p, state = %d", simdata->compute, comp_state);
+ XBT_DEBUG("Finished waiting for execution of action %p, state = %d", simdata->compute, comp_state);
simdata->isused=0;
MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout,
m_host_t host)
{
- DEBUG1
+ XBT_DEBUG
("MSG_task_receive_ext: Trying to receive a message on mailbox '%s'",
alias);
return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task,
xbt_assert0(task, "Null pointer for the task storage");
if (*task)
- CRITICAL0
+ XBT_CRITICAL
("MSG_task_get() was asked to write in a non empty task struct.");
/* Try to receive it by calling SIMIX network layer */
&& (channel < msg_global->max_channel), "Invalid channel %d",
channel);
- DEBUG1("MSG_task_put_with_timout: Trying to send a task to '%s'", dest->name);
+ XBT_DEBUG("MSG_task_put_with_timout: Trying to send a task to '%s'", dest->name);
return
MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_channel
(dest, channel), task, timeout);
MSG_error_t MSG_task_send(m_task_t task, const char *alias)
{
- DEBUG1("MSG_task_send: Trying to send a message on mailbox '%s'", alias);
+ XBT_DEBUG("MSG_task_send: Trying to send a message on mailbox '%s'", alias);
return MSG_task_send_with_timeout(task, alias, -1);
}
TRACE_msg_process_kill(process);
#endif
- DEBUG3("Killing %s(%d) on %s",
+ XBT_DEBUG("Killing %s(%d) on %s",
process->name, p_simdata->PID, p_simdata->m_host->name);
if (p_simdata->waiting_task && p_simdata->waiting_task->simdata->comm) {
(*function) (evt);
free(evt);
} else {
- WARN1("%s: Ignore trace element not for me",
+ XBT_WARN("%s: Ignore trace element not for me",
xbt_replay_trace_reader_position(reader));
}
}
res = MSG_main();
if (xbt_dict_size(action_queues)) {
- WARN0
+ XBT_WARN
("Not all actions got consumed. If the simulation ended successfully (without deadlock), you may want to add new processes to your deployment file.");
xbt_dict_foreach(action_queues, cursor, name, todo) {
- WARN2("Still %lu actions for %s", xbt_dynar_length(todo), name);
+ XBT_WARN("Still %lu actions for %s", xbt_dynar_length(todo), name);
}
}
xbt_assert0(task, "Null pointer for the task storage");
if (*task)
- CRITICAL0
+ XBT_CRITICAL
("MSG_task_get() was asked to write in a non empty task struct.");
/* Try to receive it by calling SIMIX network layer */
TRY {
SIMIX_req_comm_recv(mailbox, task, NULL, NULL, NULL, timeout);
- DEBUG2("Got task %s from %p",(*task)->name,mailbox);
+ XBT_DEBUG("Got task %s from %p",(*task)->name,mailbox);
(*task)->simdata->isused=0;
}
CATCH(e) {
/* why? if somebody is using, then you can't free! ok... but will return MSG_OK? when this task will be destroyed? isn't the user code wrong? */
if (task->simdata->isused > 0) {
- DEBUG1("Cannot destroy task %p since somebody is using it", task);
+ XBT_DEBUG("Cannot destroy task %p since somebody is using it", task);
return MSG_OK;
}
#ifdef HAVE_TRACING
{
xbt_assert0((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
- DEBUG1("calling SIMIX_req_communication_get_remains(%p)",
+ XBT_DEBUG("calling SIMIX_req_communication_get_remains(%p)",
task->simdata->comm);
return SIMIX_req_comm_get_remains(task->simdata->comm);
}
{
xbt_assert0((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
- DEBUG1("calling SIMIX_req_communication_is_latency_bounded(%p)",
+ XBT_DEBUG("calling SIMIX_req_communication_is_latency_bounded(%p)",
task->simdata->comm);
return SIMIX_req_comm_is_latency_bounded(task->simdata->comm);
}
if(task->kind == SD_TASK_COMM_E2E) continue;
//test if all tasks are marked
if(task->marked == 0){
- WARN1("the task %s is not marked",task->name);
+ XBT_WARN("the task %s is not marked",task->name);
all_marked = false;
break;
}
}
task = NULL;
if(!all_marked){
- VERB0("there is at least one cycle in your task graph");
+ XBT_VERB("there is at least one cycle in your task graph");
current = xbt_dynar_new(sizeof(SD_task_t),NULL);
xbt_dynar_foreach(dag,count,task){
if(task->kind == SD_TASK_COMM_E2E) continue;
//test if all tasks are marked
if(task->marked == 0){
- WARN1("the task %s is in a cycle",task->name);
+ XBT_WARN("the task %s is in a cycle",task->name);
all_marked = false;
}
}
unsigned int cursor;
SD_task_t task;
xbt_dynar_foreach(result, cursor, task) {
- INFO1("Task %d", cursor);
+ XBT_INFO("Task %d", cursor);
SD_task_dump(task);
}
}
xbt_dynar_foreach(file->tasks_before, cpt1, depbefore) {
xbt_dynar_foreach(file->tasks_after, cpt2, depafter) {
if (depbefore->src == depafter->dst) {
- WARN2
+ XBT_WARN
("File %s is produced and consumed by task %s. This loop dependency will prevent the execution of the task.",
file->name, depbefore->src->name);
}
double runtime = dax_parse_double(A_dax__job_runtime);
char *name = bprintf("%s@%s", A_dax__job_id, A_dax__job_name);
runtime *= 4200000000.; /* Assume that timings were done on a 4.2GFlops machine. I mean, why not? */
-// INFO3("See <job id=%s runtime=%s %.0f>",A_dax__job_id,A_dax__job_runtime,runtime);
+// XBT_INFO("See <job id=%s runtime=%s %.0f>",A_dax__job_id,A_dax__job_runtime,runtime);
current_job = SD_task_create_comp_seq(name, NULL, runtime);
#ifdef HAVE_TRACING
char *category = A_dax__job_name;
double size = dax_parse_double(A_dax__uses_size);
int is_input = (A_dax__uses_link == A_dax__uses_link_input);
-// INFO2("See <uses file=%s %s>",A_dax__uses_file,(is_input?"in":"out"));
+// XBT_INFO("See <uses file=%s %s>",A_dax__uses_file,(is_input?"in":"out"));
file = xbt_dict_get_or_null(files, A_dax__uses_file);
if (file == NULL) {
file = SD_task_create_comm_e2e(A_dax__uses_file, NULL, size);
xbt_dict_set(files, A_dax__uses_file, file, &dax_task_free);
} else {
if (SD_task_get_amount(file) != size) {
- WARN3("Ignoring file %s size redefinition from %.0f to %.0f",
+ XBT_WARN("Ignoring file %s size redefinition from %.0f to %.0f",
A_dax__uses_file, SD_task_get_amount(file), size);
}
}
} else {
SD_task_dependency_add(NULL, NULL, current_job, file);
if (xbt_dynar_length(file->tasks_before) > 1) {
- WARN1("File %s created at more than one location...", file->name);
+ XBT_WARN("File %s created at more than one location...", file->name);
}
}
}
current_child->name, A_dax__parent_ref,
A_dax__parent_ref));
SD_task_dependency_add(NULL, NULL, parent, current_child);
- DEBUG2("Control-flow dependency from %s to %s", current_child->name,
+ XBT_DEBUG("Control-flow dependency from %s to %s", current_child->name,
parent->name);
}
void ETag_dax__adag(void)
{
-// INFO0("See </adag>");
+// XBT_INFO("See </adag>");
}
void ETag_dax__job(void)
{
current_job = NULL;
-// INFO0("See </job>");
+// XBT_INFO("See </job>");
}
void ETag_dax__parent(void)
{
-// INFO0("See </parent>");
+// XBT_INFO("See </parent>");
}
void ETag_dax__uses(void)
{
-// INFO0("See </uses>");
+// XBT_INFO("See </uses>");
}
ret = sscanf(string, "%lg", &value);
if (ret != 1)
- WARN1("%s is not a double", string);
+ XBT_WARN("%s is not a double", string);
return value;
}
ret = sscanf(string, "%d", &value);
if (ret != 1)
- WARN1("%s is not an integer", string);
+ XBT_WARN("%s is not an integer", string);
return value;
}
unsigned int cursor;
SD_task_t task;
xbt_dynar_foreach(result, cursor, task) {
- INFO1("Task %d", cursor);
+ XBT_INFO("Task %d", cursor);
SD_task_dump(task);
}
}
if(acyclic_graph_detail(result))
return result;
else
- WARN0("There is at least one cycle in the provided task graph");
+ XBT_WARN("There is at least one cycle in the provided task graph");
}else{
- WARN0("The scheduling is ignored");
+ XBT_WARN("The scheduling is ignored");
}
return NULL;
}
xbt_dynar_foreach(file->tasks_before, cpt1, depbefore) {
xbt_dynar_foreach(file->tasks_after, cpt2, depafter) {
if (depbefore->src == depafter->dst) {
- WARN2
+ XBT_WARN
("File %s is produced and consumed by task %s. This loop dependency will prevent the execution of the task.",
file->name, depbefore->src->name);
}
SD_task_t current_job;
double runtime = dot_parse_double(agget(dag_node, (char *) "size"));
- DEBUG3("See <job id=%s runtime=%s %.0f>", name,
+ XBT_DEBUG("See <job id=%s runtime=%s %.0f>", name,
agget(dag_node, (char *) "size"), runtime);
current_job = xbt_dict_get_or_null(jobs, name);
if (current_job == NULL) {
if (char_order != NULL)
order = (long) dot_parse_int(char_order);
xbt_dynar_t computer = NULL;
- //INFO2("performer = %d, order=%d",performer,order);
+ //XBT_INFO("performer = %d, order=%d",performer,order);
if(performer != -1 && order != -1){
//necessary parameters are given
computer = xbt_dict_get_or_null(computers, char_performer);
if(task_test != NULL && *task_test != NULL && *task_test != current_job){
/*the user gives the same order to several tasks*/
schedule = false;
- VERB4("The task %s starts on the computer %s at the position : %s like the task %s",
+ XBT_VERB("The task %s starts on the computer %s at the position : %s like the task %s",
(*task_test)->name, char_performer, char_order, current_job->name);
}else{
//the parameter seems to be ok
/*the platform has not enough processors to schedule the DAG like
*the user wants*/
schedule = false;
- VERB0("The schedule is ignored, there are not enough computers");
+ XBT_VERB("The schedule is ignored, there are not enough computers");
}
}
else {
//one of necessary parameters are not given
schedule = false;
- VERB1("The schedule is ignored, the task %s is not correctly schedule", current_job->name);
+ XBT_VERB("The schedule is ignored, the task %s is not correctly schedule", current_job->name);
}
}
}
char name[80];
sprintf(name, "%s->%s", agnameof(agtail(edge)), agnameof(aghead(edge)));
double size = dot_parse_double(agget(edge, (char *) "size"));
- DEBUG2("size : %e, get size : %s", size, agget(edge, (char *) "size"));
+ XBT_DEBUG("size : %e, get size : %s", size, agget(edge, (char *) "size"));
if (size > 0) {
file = xbt_dict_get_or_null(files, name);
xbt_dict_set(files, name, file, &dot_task_free);
} else {
if (SD_task_get_amount(file) != size) {
- WARN3("Ignoring file %s size redefinition from %.0f to %.0f",
+ XBT_WARN("Ignoring file %s size redefinition from %.0f to %.0f",
name, SD_task_get_amount(file), size);
}
}
char name[80];
sprintf(name, "%s->%s", agnameof(agtail(edge)), agnameof(aghead(edge)));
double size = dot_parse_double(agget(edge, (char *) "size"));
- DEBUG2("size : %e, get size : %s", size, agget(edge, (char *) "size"));
+ XBT_DEBUG("size : %e, get size : %s", size, agget(edge, (char *) "size"));
if (size > 0) {
file = xbt_dict_get_or_null(files, name);
xbt_dict_set(files, name, file, &dot_task_free);
} else {
if (SD_task_get_amount(file) != size) {
- WARN3("Ignoring file %s size redefinition from %.0f to %.0f",
+ XBT_WARN("Ignoring file %s size redefinition from %.0f to %.0f",
name, SD_task_get_amount(file), size);
}
}
SD_task_dependency_add(NULL, NULL, current_job, file);
if (xbt_dynar_length(file->tasks_before) > 1) {
- WARN1("File %s created at more than one location...", file->name);
+ XBT_WARN("File %s created at more than one location...", file->name);
}
} else {
file = xbt_dict_get_or_null(jobs, agnameof(aghead(edge)));
s_SD_task_t task;
if (SD_INITIALISED()) {
- DEBUG0("Recreating the swags...");
+ XBT_DEBUG("Recreating the swags...");
xbt_swag_free(sd_global->not_scheduled_task_set);
xbt_swag_free(sd_global->schedulable_task_set);
xbt_swag_free(sd_global->scheduled_task_set);
#endif
} else {
- WARN0("SD_application_reinit called before initialization of SimDag");
+ XBT_WARN("SD_application_reinit called before initialization of SimDag");
/* we cannot use exceptions here because xbt is not running! */
}
__SD_link_create(surf_link, NULL);
}
- DEBUG2("Workstation number: %d, link number: %d",
+ XBT_DEBUG("Workstation number: %d, link number: %d",
SD_workstation_get_number(), SD_link_get_number());
#ifdef HAVE_JEDULE
jedule_setup_platform();
SD_CHECK_INIT_DONE();
if (first_time) {
- VERB0("Starting simulation...");
+ XBT_VERB("Starting simulation...");
surf_presolve(); /* Takes traces into account */
first_time = 0;
/* explore the runnable tasks */
xbt_swag_foreach_safe(task, task_safe, sd_global->runnable_task_set) {
- VERB1("Executing task '%s'", SD_task_get_name(task));
+ XBT_VERB("Executing task '%s'", SD_task_get_name(task));
if (__SD_task_try_to_run(task)
&& !xbt_dynar_member(changed_tasks, &task))
xbt_dynar_push(changed_tasks, &task);
/* dumb variables */
- DEBUG1("Total time: %f", total_time);
+ XBT_DEBUG("Total time: %f", total_time);
elapsed_time = surf_solve(how_long > 0 ? surf_get_clock() + how_long : -1.0);
- DEBUG1("surf_solve() returns %f", elapsed_time);
+ XBT_DEBUG("surf_solve() returns %f", elapsed_time);
if (elapsed_time > 0.0)
total_time += elapsed_time;
surf_workstation_model->
action_get_start_time(task->surf_action);
task->finish_time = surf_get_clock();
- VERB1("Task '%s' done", SD_task_get_name(task));
- DEBUG0("Calling __SD_task_just_done");
+ XBT_VERB("Task '%s' done", SD_task_get_name(task));
+ XBT_DEBUG("Calling __SD_task_just_done");
__SD_task_just_done(task);
- DEBUG1("__SD_task_just_done called on task '%s'",
+ XBT_DEBUG("__SD_task_just_done called on task '%s'",
SD_task_get_name(task));
/* the state has changed */
/* is dst runnable now? */
if (__SD_task_is_runnable(dst)
&& !sd_global->watch_point_reached) {
- VERB1("Executing task '%s'", SD_task_get_name(dst));
+ XBT_VERB("Executing task '%s'", SD_task_get_name(dst));
if (__SD_task_try_to_run(dst) &&
!xbt_dynar_member(changed_tasks, &task))
xbt_dynar_push(changed_tasks, &task);
surf_workstation_model->
action_get_start_time(task->surf_action);
task->finish_time = surf_get_clock();
- VERB1("Task '%s' failed", SD_task_get_name(task));
+ XBT_VERB("Task '%s' failed", SD_task_get_name(task));
__SD_task_set_state(task, SD_FAILED);
surf_workstation_model->action_unref(action);
task->surf_action = NULL;
if (!sd_global->watch_point_reached && how_long<0){
if (xbt_swag_size(sd_global->done_task_set) < sd_global->task_number){
- WARN0("Simulation is finished but some tasks are still not done");
+ XBT_WARN("Simulation is finished but some tasks are still not done");
xbt_swag_foreach_safe (task, task_safe,sd_global->not_scheduled_task_set){
- WARN1("%s is in SD_NOT_SCHEDULED state", SD_task_get_name(task));
+ XBT_WARN("%s is in SD_NOT_SCHEDULED state", SD_task_get_name(task));
}
xbt_swag_foreach_safe (task, task_safe,sd_global->schedulable_task_set){
- WARN1("%s is in SD_SCHEDULABLE state", SD_task_get_name(task));
+ XBT_WARN("%s is in SD_SCHEDULABLE state", SD_task_get_name(task));
}
xbt_swag_foreach_safe (task, task_safe,sd_global->scheduled_task_set){
- WARN1("%s is in SD_SCHEDULED state", SD_task_get_name(task));
+ XBT_WARN("%s is in SD_SCHEDULED state", SD_task_get_name(task));
}
}
}
- DEBUG3("elapsed_time = %f, total_time = %f, watch_point_reached = %d",
+ XBT_DEBUG("elapsed_time = %f, total_time = %f, watch_point_reached = %d",
elapsed_time, total_time, sd_global->watch_point_reached);
- DEBUG1("current time = %f", surf_get_clock());
+ XBT_DEBUG("current time = %f", surf_get_clock());
return changed_tasks;
}
TRACE_surf_release();
#endif
if (SD_INITIALISED()) {
- DEBUG0("Destroying workstation and link dictionaries...");
+ XBT_DEBUG("Destroying workstation and link dictionaries...");
xbt_dict_free(&sd_global->workstations);
xbt_dict_free(&sd_global->links);
- DEBUG0("Destroying workstation and link arrays if necessary...");
+ XBT_DEBUG("Destroying workstation and link arrays if necessary...");
if (sd_global->workstation_list != NULL)
xbt_free(sd_global->workstation_list);
if (sd_global->recyclable_route != NULL)
xbt_free(sd_global->recyclable_route);
- DEBUG0("Destroying the swags...");
+ XBT_DEBUG("Destroying the swags...");
xbt_swag_free(sd_global->not_scheduled_task_set);
xbt_swag_free(sd_global->schedulable_task_set);
xbt_swag_free(sd_global->scheduled_task_set);
jedule_sd_cleanup();
#endif
- DEBUG0("Exiting Surf...");
+ XBT_DEBUG("Exiting Surf...");
surf_exit();
} else {
- WARN0("SD_exit() called, but SimDag is not running");
+ XBT_WARN("SD_exit() called, but SimDag is not running");
/* we cannot use exceptions here because xbt is not running! */
}
}
task->state = new_state;
if (task->watch_points & new_state) {
- VERB1("Watch point reached with task '%s'!", SD_task_get_name(task));
+ XBT_VERB("Watch point reached with task '%s'!", SD_task_get_name(task));
sd_global->watch_point_reached = 1;
SD_task_unwatch(task, new_state); /* remove the watch point */
}
SD_dependency_t dependency;
char *statename;
- INFO1("Displaying task %s", SD_task_get_name(task));
+ XBT_INFO("Displaying task %s", SD_task_get_name(task));
statename = bprintf("%s %s %s %s %s %s %s %s",
(task->state & SD_NOT_SCHEDULED ? "not scheduled" :
""),
(task->state & SD_RUNNING ? "running" : ""),
(task->state & SD_DONE ? "done" : ""),
(task->state & SD_FAILED ? "failed" : ""));
- INFO1(" - state: %s", statename);
+ XBT_INFO(" - state: %s", statename);
free(statename);
if (task->kind != 0) {
switch (task->kind) {
case SD_TASK_COMM_E2E:
- INFO0(" - kind: end-to-end communication");
+ XBT_INFO(" - kind: end-to-end communication");
break;
case SD_TASK_COMP_SEQ:
- INFO0(" - kind: sequential computation");
+ XBT_INFO(" - kind: sequential computation");
break;
default:
- INFO1(" - (unknown kind %d)", task->kind);
+ XBT_INFO(" - (unknown kind %d)", task->kind);
}
}
- INFO1(" - amount: %.0f", SD_task_get_amount(task));
- INFO1(" - Dependencies to satisfy: %d", task->unsatisfied_dependencies);
+ XBT_INFO(" - amount: %.0f", SD_task_get_amount(task));
+ XBT_INFO(" - Dependencies to satisfy: %d", task->unsatisfied_dependencies);
if (xbt_dynar_length(task->tasks_before)) {
- INFO0(" - pre-dependencies:");
+ XBT_INFO(" - pre-dependencies:");
xbt_dynar_foreach(task->tasks_before, counter, dependency) {
- INFO1(" %s", SD_task_get_name(dependency->src));
+ XBT_INFO(" %s", SD_task_get_name(dependency->src));
}
}
if (xbt_dynar_length(task->tasks_after)) {
- INFO0(" - post-dependencies:");
+ XBT_INFO(" - post-dependencies:");
xbt_dynar_foreach(task->tasks_after, counter, dependency) {
- INFO1(" %s", SD_task_get_name(dependency->dst));
+ XBT_INFO(" %s", SD_task_get_name(dependency->dst));
}
}
}
"Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULABLE, SD_SCHEDULED or SD_RUNNABLE",
SD_task_get_name(dst));
- DEBUG2("SD_task_dependency_add: src = %s, dst = %s",
+ XBT_DEBUG("SD_task_dependency_add: src = %s, dst = %s",
SD_task_get_name(src), SD_task_get_name(dst));
for (i = 0; i < length && !found; i++) {
xbt_dynar_get_cpy(dynar, i, &dependency);
found = (dependency->dst == dst);
- DEBUG2("Dependency %d: dependency->dst = %s", i,
+ XBT_DEBUG("Dependency %d: dependency->dst = %s", i,
SD_task_get_name(dependency->dst));
}
/* if the task was runnable, then dst->tasks_before is not empty anymore,
so we must go back to state SD_SCHEDULED */
if (__SD_task_is_runnable(dst)) {
- DEBUG1
+ XBT_DEBUG
("SD_task_dependency_add: %s was runnable and becomes scheduled!",
SD_task_get_name(dst));
__SD_task_set_state(dst, SD_SCHEDULED);
};
int i;
- INFO2("Task '%s' watch points (%x): ", SD_task_get_name(task),
+ XBT_INFO("Task '%s' watch points (%x): ", SD_task_get_name(task),
task->watch_points);
for (i = 0; i < 5; i++) {
if (task->watch_points & state_masks[i])
- INFO1("%s ", state_names[i]);
+ XBT_INFO("%s ", state_names[i]);
}
}
- DEBUG1("Really running task '%s'", SD_task_get_name(task));
+ XBT_DEBUG("Really running task '%s'", SD_task_get_name(task));
/* set this task as current task for the workstations in sequential mode */
for (i = 0; i < task->workstation_nb; i++) {
}
}
- DEBUG1("Task '%s' set as current task for its workstations",
+ XBT_DEBUG("Task '%s' set as current task for its workstations",
SD_task_get_name(task));
/* start the task */
surf_workstation_model->action_data_set(task->surf_action, task);
- DEBUG1("surf_action = %p", task->surf_action);
+ XBT_DEBUG("surf_action = %p", task->surf_action);
#ifdef HAVE_TRACING
if (task->category)
!__SD_workstation_is_busy(task->workstation_list[i]);
}
- DEBUG2("Task '%s' can start: %d", SD_task_get_name(task), can_start);
+ XBT_DEBUG("Task '%s' can start: %d", SD_task_get_name(task), can_start);
if (!can_start) { /* if the task cannot start and is not in the fifos yet */
for (i = 0; i < task->workstation_nb; i++) {
workstation = task->workstation_list[i];
if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
- DEBUG2("Pushing task '%s' in the fifo of workstation '%s'",
+ XBT_DEBUG("Pushing task '%s' in the fifo of workstation '%s'",
SD_task_get_name(task),
SD_workstation_get_name(workstation));
xbt_fifo_push(workstation->task_fifo, task);
__SD_task_set_state(task, SD_IN_FIFO);
xbt_assert2(__SD_task_is_in_fifo(task), "Bad state of task '%s': %d",
SD_task_get_name(task), SD_task_get_state(task));
- DEBUG1("Task '%s' state is now SD_IN_FIFO", SD_task_get_name(task));
+ XBT_DEBUG("Task '%s' state is now SD_IN_FIFO", SD_task_get_name(task));
} else {
__SD_task_really_run(task);
}
surf_workstation_model->action_unref(task->surf_action);
task->surf_action = NULL;
- DEBUG0("Looking for candidates");
+ XBT_DEBUG("Looking for candidates");
/* if the task was executed on sequential workstations,
maybe we can execute the next task of the fifo for each workstation */
for (i = 0; i < task->workstation_nb; i++) {
workstation = task->workstation_list[i];
- DEBUG2("Workstation '%s': access_mode = %d",
+ XBT_DEBUG("Workstation '%s': access_mode = %d",
SD_workstation_get_name(workstation), workstation->access_mode);
if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
xbt_assert1(workstation->task_fifo != NULL,
/* the task is over so we can release the workstation */
workstation->current_task = NULL;
- DEBUG0("Getting candidate in fifo");
+ XBT_DEBUG("Getting candidate in fifo");
candidate =
xbt_fifo_get_item_content(xbt_fifo_get_first_item
(workstation->task_fifo));
if (candidate != NULL) {
- DEBUG1("Candidate: '%s'", SD_task_get_name(candidate));
+ XBT_DEBUG("Candidate: '%s'", SD_task_get_name(candidate));
xbt_assert2(__SD_task_is_in_fifo(candidate),
"Bad state of candidate '%s': %d",
SD_task_get_name(candidate),
SD_task_get_state(candidate));
}
- DEBUG1("Candidate in fifo: %p", candidate);
+ XBT_DEBUG("Candidate in fifo: %p", candidate);
/* if there was a task waiting for my place */
if (candidate != NULL) {
}
}
- DEBUG1("Candidates found: %d", candidate_nb);
+ XBT_DEBUG("Candidates found: %d", candidate_nb);
/* now we check every candidate task */
for (i = 0; i < candidate_nb; i++) {
(workstation->task_fifo));
}
- DEBUG2("Candidate '%s' can start: %d", SD_task_get_name(candidate),
+ XBT_DEBUG("Candidate '%s' can start: %d", SD_task_get_name(candidate),
can_start);
/* now we are sure that I can start! */
/* update the fifo */
if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
candidate = xbt_fifo_shift(workstation->task_fifo); /* the return value is stored just for debugging */
- DEBUG1("Head of the fifo: '%s'",
+ XBT_DEBUG("Head of the fifo: '%s'",
(candidate !=
NULL) ? SD_task_get_name(candidate) : "NULL");
xbt_assert0(candidate == candidates[i],
} /* for each workstation */
/* finally execute the task */
- DEBUG2("Task '%s' state: %d", SD_task_get_name(candidate),
+ XBT_DEBUG("Task '%s' state: %d", SD_task_get_name(candidate),
SD_task_get_state(candidate));
__SD_task_really_run(candidate);
- DEBUG4
+ XBT_DEBUG
("Calling __SD_task_is_running: task '%s', state set: %p, running_task_set: %p, is running: %d",
SD_task_get_name(candidate), candidate->state_set,
sd_global->running_task_set, __SD_task_is_running(candidate));
"Bad state of task '%s': %d",
SD_task_get_name(candidate),
SD_task_get_state(candidate));
- DEBUG0("Okay, the task is running.");
+ XBT_DEBUG("Okay, the task is running.");
} /* can start */
candidate->fifo_checked = 1;
SD_CHECK_INIT_DONE();
xbt_assert0(task != NULL, "Invalid parameter");
- DEBUG1("Destroying task %s...", SD_task_get_name(task));
+ XBT_DEBUG("Destroying task %s...", SD_task_get_name(task));
__SD_task_remove_dependencies(task);
/* if the task was scheduled or runnable we have to free the scheduling parameters */
sd_global->task_number--;
- DEBUG0("Task destroyed.");
+ XBT_DEBUG("Task destroyed.");
}
SD_task_get_name(task)));
}
if (task->kind == SD_TASK_COMM_E2E) {
- VERB4("Schedule comm task %s between %s -> %s. It costs %.f bytes",
+ XBT_VERB("Schedule comm task %s between %s -> %s. It costs %.f bytes",
SD_task_get_name(task),
SD_workstation_get_name(task->workstation_list[0]),
SD_workstation_get_name(task->workstation_list[1]),
}
/* Iterate over all childs and parent being COMM_E2E to say where I am located (and start them if runnable) */
if (task->kind == SD_TASK_COMP_SEQ) {
- VERB3("Schedule computation task %s on %s. It costs %.f flops",
+ XBT_VERB("Schedule computation task %s on %s. It costs %.f flops",
SD_task_get_name(task),
SD_workstation_get_name(task->workstation_list[0]),
task->computation_amount[0]);
(__SD_task_is_schedulable(before)
|| __SD_task_is_not_scheduled(before))) {
SD_task_do_schedule(before);
- VERB4
+ XBT_VERB
("Auto-Schedule comm task %s between %s -> %s. It costs %.f bytes",
SD_task_get_name(before),
SD_workstation_get_name(before->workstation_list[0]),
&& (__SD_task_is_not_scheduled(after)
|| __SD_task_is_schedulable(after))) {
SD_task_do_schedule(after);
- VERB4
+ XBT_VERB
("Auto-Schedule comm task %s between %s -> %s. It costs %.f bytes",
SD_task_get_name(after),
SD_workstation_get_name(after->workstation_list[0]),
SD_CHECK_INIT_DONE();
xbt_assert0(workstation != NULL, "Invalid parameter");
- DEBUG4
+ XBT_DEBUG
("Workstation '%s' access mode: '%s', current task: %s, fifo size: %d",
SD_workstation_get_name(workstation),
(workstation->access_mode ==
static int smx_ctx_raw_factory_finalize(smx_context_factory_t *factory)
{
- VERB1("Total User Time: %lf", totaltime);
+ XBT_VERB("Total User Time: %lf", totaltime);
if(parmap)
xbt_parmap_destroy(parmap);
return smx_ctx_base_factory_finalize(factory);
unsigned int cursor;
xbt_dynar_foreach(processes, cursor, process) {
- DEBUG2("Schedule item %u of %lu",cursor,xbt_dynar_length(processes));
+ XBT_DEBUG("Schedule item %u of %lu",cursor,xbt_dynar_length(processes));
xbt_os_timer_start(timer);
smx_ctx_raw_resume(process);
xbt_os_timer_stop(timer);
static void smx_ctx_raw_runall(xbt_dynar_t processes)
{
if (xbt_dynar_length(processes) >= SIMIX_context_get_parallel_threshold()) {
- DEBUG1("Runall // %lu", xbt_dynar_length(processes));
+ XBT_DEBUG("Runall // %lu", xbt_dynar_length(processes));
raw_factory->self = smx_ctx_raw_self_parallel;
raw_factory->get_thread_id = smx_ctx_raw_get_thread_id;
smx_ctx_raw_runall_parallel(processes);
} else {
- DEBUG1("Runall serial %lu", xbt_dynar_length(processes));
+ XBT_DEBUG("Runall serial %lu", xbt_dynar_length(processes));
raw_factory->self = smx_ctx_base_self;
raw_factory->get_thread_id = smx_ctx_base_get_thread_id;
smx_ctx_raw_runall_serial(processes);
void SIMIX_ctx_raw_factory_init(smx_context_factory_t *factory)
{
- VERB0("Using raw contexts. Because the glibc is just not good enough for us.");
+ XBT_VERB("Using raw contexts. Because the glibc is just not good enough for us.");
smx_ctx_base_factory_init(factory);
(*factory)->finalize = smx_ctx_raw_factory_finalize;
if (code) {
context->process = (VALUE) code;
- DEBUG1("smx_ctx_ruby_create_context(%s)...Done", argv[0]);
+ XBT_DEBUG("smx_ctx_ruby_create_context(%s)...Done", argv[0]);
}
return (smx_context_t) context;
static void smx_ctx_ruby_stop(smx_context_t context)
{
- DEBUG0("smx_ctx_ruby_stop()");
+ XBT_DEBUG("smx_ctx_ruby_stop()");
VALUE process = Qnil;
smx_ctx_ruby_t ctx_ruby, current;
static void smx_ctx_ruby_suspend(smx_context_t context)
{
- DEBUG1("smx_ctx_ruby_suspend(%s)", context->argv[0]);
+ XBT_DEBUG("smx_ctx_ruby_suspend(%s)", context->argv[0]);
smx_ctx_ruby_t ctx_ruby = (smx_ctx_ruby_t) context;
if (ctx_ruby->process)
rb_process_unschedule(ctx_ruby->process);
static void smx_ctx_ruby_resume(smx_context_t new_context)
{
- DEBUG1("smx_ctx_ruby_resume(%s)",
+ XBT_DEBUG("smx_ctx_ruby_resume(%s)",
(new_context->argc ? new_context->argv[0] : "maestro"));
smx_ctx_ruby_t ctx_ruby = (smx_ctx_ruby_t) new_context;
void SIMIX_ctx_sysv_factory_init(smx_context_factory_t *factory)
{
smx_ctx_base_factory_init(factory);
- VERB0("Activating SYSV context factory");
+ XBT_VERB("Activating SYSV context factory");
(*factory)->finalize = smx_ctx_sysv_factory_finalize;
(*factory)->create_context = smx_ctx_sysv_create_context;
unsigned int cursor;
xbt_dynar_foreach(processes, cursor, process) {
- DEBUG2("Schedule item %u of %lu",cursor,xbt_dynar_length(processes));
+ XBT_DEBUG("Schedule item %u of %lu",cursor,xbt_dynar_length(processes));
smx_ctx_sysv_resume(process->context);
}
xbt_dynar_reset(processes);
void SIMIX_ctx_thread_factory_init(smx_context_factory_t * factory)
{
smx_ctx_base_factory_init(factory);
- VERB0("Activating thread context factory");
+ XBT_VERB("Activating thread context factory");
(*factory)->create_context = smx_ctx_thread_factory_create_context;
/* Do not overload that method (*factory)->finalize */
arg->kill_time = kill_time;
arg->properties = current_property_set;
- DEBUG3("Process %s(%s) will be started at time %f", arg->name,
+ XBT_DEBUG("Process %s(%s) will be started at time %f", arg->name,
arg->hostname, start_time);
SIMIX_timer_set(start_time, &SIMIX_process_create_from_wrapper, arg);
} else { // start_time <= SIMIX_get_clock()
- DEBUG2("Starting Process %s(%s) right now", parse_argv[0], parse_host);
+ XBT_DEBUG("Starting Process %s(%s) right now", parse_argv[0], parse_host);
if (simix_global->create_process_function)
(*simix_global->create_process_function) (&process,
start = xbt_os_time();
/* FIXME: what time are we measuring ??? */
end = xbt_os_time();
- DEBUG1("PARSE TIME: %lg", (end - start));
+ XBT_DEBUG("PARSE TIME: %lg", (end - start));
xbt_dict_foreach(surf_model_resource_set(surf_workstation_model), cursor,
name, workstation) {
static void _XBT_CALL inthandler(int ignored)
{
- INFO0("CTRL-C pressed. Displaying status and bailing out");
+ XBT_INFO("CTRL-C pressed. Displaying status and bailing out");
SIMIX_display_process_status();
exit(1);
}
unsigned int iter;
do {
- DEBUG1("New Schedule Round; size(queue)=%lu",
+ XBT_DEBUG("New Schedule Round; size(queue)=%lu",
xbt_dynar_length(simix_global->process_to_run));
do {
- DEBUG1("New Sub-Schedule Round; size(queue)=%lu",
+ XBT_DEBUG("New Sub-Schedule Round; size(queue)=%lu",
xbt_dynar_length(simix_global->process_to_run));
SIMIX_context_runall(simix_global->process_to_run);
while ((req = SIMIX_request_pop())) {
- DEBUG1("Handling request %p", req);
+ XBT_DEBUG("Handling request %p", req);
SIMIX_request_pre(req, 0);
}
} while (xbt_dynar_length(simix_global->process_to_run));
if (xbt_swag_size(simix_global->process_list) != 0) {
- WARN0("Oops ! Deadlock or code not perfectly clean.");
+ XBT_WARN("Oops ! Deadlock or code not perfectly clean.");
SIMIX_display_process_status();
xbt_abort();
}
smx_process_t process = NULL;
int nbprocess = xbt_swag_size(simix_global->process_list);
- INFO1("%d processes are still running, waiting for something.", nbprocess);
+ XBT_INFO("%d processes are still running, waiting for something.", nbprocess);
/* List the process and their state */
- INFO0
+ XBT_INFO
("Legend of the following listing: \"<process> on <host>: <status>.\"");
xbt_swag_foreach(process, simix_global->process_list) {
action_description = "I/O";
break;
}
- INFO2("Waiting for %s action %p to finish", action_description, process->waiting_action);
+ XBT_INFO("Waiting for %s action %p to finish", action_description, process->waiting_action);
}
}
}
TRACE_smx_host_execute(action);
#endif
- DEBUG1("Create execute action %p", action);
+ XBT_DEBUG("Create execute action %p", action);
return action;
}
surf_workstation_model->action_data_set(action->execution.surf_exec, action);
}
- DEBUG1("Create parallel execute action %p", action);
+ XBT_DEBUG("Create parallel execute action %p", action);
return action;
}
void SIMIX_host_execution_destroy(smx_action_t action)
{
- DEBUG1("Destroy action %p", action);
+ XBT_DEBUG("Destroy action %p", action);
xbt_free(action->name);
void SIMIX_host_execution_cancel(smx_action_t action)
{
- DEBUG1("Cancel action %p", action);
+ XBT_DEBUG("Cancel action %p", action);
if (action->execution.surf_exec)
surf_workstation_model->action_cancel(action->execution.surf_exec);
{
smx_action_t action = req->host_execution_wait.execution;
- DEBUG2("Wait for execution of action %p, state %d", action, action->state);
+ XBT_DEBUG("Wait for execution of action %p, state %d", action, action->state);
/* Associate this request to the action */
xbt_fifo_push(action->request_list, req);
case SIMIX_DONE:
/* do nothing, action done*/
- DEBUG0("SIMIX_execution_finished: execution successful");
+ XBT_DEBUG("SIMIX_execution_finished: execution successful");
break;
case SIMIX_FAILED:
TRY {
- DEBUG1("SIMIX_execution_finished: host '%s' failed", req->issuer->smx_host->name);
+ XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", req->issuer->smx_host->name);
THROW0(host_error, 0, "Host failed");
}
CATCH(req->issuer->running_ctx->exception) {
case SIMIX_CANCELED:
TRY {
- DEBUG0("SIMIX_execution_finished: execution canceled");
+ XBT_DEBUG("SIMIX_execution_finished: execution canceled");
THROW0(cancel_error, 0, "Canceled");
}
CATCH(req->issuer->running_ctx->exception) {
req_data = action->comm.dst_data;
}
if (action->comm.type == type && (!match_fun || match_fun(data, req_data))) {
- DEBUG1("Found a matching communication action %p", action);
+ XBT_DEBUG("Found a matching communication action %p", action);
xbt_fifo_remove_item(rdv->comm_fifo, item);
xbt_fifo_free_item(item);
action->comm.refcount++;
action->comm.rdv = NULL;
return action;
}
- DEBUG3("Sorry, communication action %p does not match our needs:"
+ XBT_DEBUG("Sorry, communication action %p does not match our needs:"
" its type is %d but we are looking for a comm of type %d",
action, action->comm.type, type);
}
- DEBUG0("No matching communication action found");
+ XBT_DEBUG("No matching communication action found");
return NULL;
}
act->category = NULL;
#endif
- DEBUG1("Create communicate action %p", act);
+ XBT_DEBUG("Create communicate action %p", act);
++smx_total_comms;
return act;
*/
void SIMIX_comm_destroy(smx_action_t action)
{
- DEBUG2("Destroy action %p (refcount:%d)", action, action->comm.refcount);
+ XBT_DEBUG("Destroy action %p (refcount:%d)", action, action->comm.refcount);
if (action->comm.refcount <= 0)
xbt_die(bprintf("the refcount of comm %p is already 0 before decreasing it. That's a bug!",action));
action->comm.refcount--;
if (action->comm.refcount > 0)
return;
- DEBUG2("Really free communication %p; refcount is now %d", action,
+ XBT_DEBUG("Really free communication %p; refcount is now %d", action,
action->comm.refcount);
#ifdef HAVE_LATENCY_BOUND_TRACKING
smx_host_t sender = action->comm.src_proc->smx_host;
smx_host_t receiver = action->comm.dst_proc->smx_host;
- DEBUG3("Starting communication %p from '%s' to '%s'", action,
+ XBT_DEBUG("Starting communication %p from '%s' to '%s'", action,
SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver));
action->comm.surf_comm = surf_workstation_model->extension.workstation.
/* If a link is failed, detect it immediately */
if (surf_workstation_model->action_state_get(action->comm.surf_comm) == SURF_ACTION_FAILED) {
- DEBUG2("Communication from '%s' to '%s' failed to start because of a link failure",
+ XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure",
SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver));
action->state = SIMIX_LINK_FAILURE;
SIMIX_comm_destroy_internal_actions(action);
if (action->comm.rdv)
SIMIX_rdv_remove(action->comm.rdv, action);
- DEBUG1("SIMIX_comm_finish: action state = %d", action->state);
+ XBT_DEBUG("SIMIX_comm_finish: action state = %d", action->state);
/* Check out for errors */
switch (action->state) {
case SIMIX_DONE:
- DEBUG1("Communication %p complete!", action);
+ XBT_DEBUG("Communication %p complete!", action);
SIMIX_comm_copy_data(action);
break;
case SIMIX_LINK_FAILURE:
TRY {
- DEBUG5("Link failure in action %p between '%s' and '%s': posting an exception to the issuer: %s (%p)",
+ XBT_DEBUG("Link failure in action %p between '%s' and '%s': posting an exception to the issuer: %s (%p)",
action, action->comm.src_proc->smx_host->name, action->comm.dst_proc->smx_host->name,
req->issuer->name, req->issuer);
THROW0(network_error, 0, "Link failure");
else
action->state = SIMIX_DONE;
- DEBUG1("SIMIX_post_comm: action state = %d", action->state);
+ XBT_DEBUG("SIMIX_post_comm: action state = %d", action->state);
/* After this point the surf actions associated with the simix communicate
action are no longer needed, thus we delete them. */
XBT_INLINE int SIMIX_comm_is_latency_bounded(smx_action_t action)
{
if (action->comm.surf_comm){
- DEBUG1("Getting latency limited for surf_action (%p)", action->comm.surf_comm);
+ XBT_DEBUG("Getting latency limited for surf_action (%p)", action->comm.surf_comm);
action->latency_limited = surf_workstation_model->get_latency_limited(action->comm.surf_comm);
- DEBUG1("Action limited is %d", action->latency_limited);
+ XBT_DEBUG("Action limited is %d", action->latency_limited);
}
return action->latency_limited;
}
if (!comm->comm.src_buff || !comm->comm.dst_buff || comm->comm.copied == 1)
return;
- DEBUG6("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
+ XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
comm,
comm->comm.src_proc->smx_host->name, comm->comm.src_buff,
comm->comm.dst_proc->smx_host->name, comm->comm.dst_buff, buff_size);
*/
void SIMIX_process_cleanup(smx_process_t process)
{
- DEBUG1("Cleanup process %s", process->name);
+ XBT_DEBUG("Cleanup process %s", process->name);
/*xbt_swag_remove(process, simix_global->process_to_run);*/
xbt_swag_remove(process, simix_global->process_list);
xbt_swag_remove(process, process->smx_host->process_list);
*process = NULL;
smx_host_t host = SIMIX_host_get_by_name(hostname);
- DEBUG2("Start process %s on host %s", name, hostname);
+ XBT_DEBUG("Start process %s on host %s", name, hostname);
if (!SIMIX_host_get_state(host)) {
- WARN2("Cannot launch process '%s' on failed host '%s'", name,
+ XBT_WARN("Cannot launch process '%s' on failed host '%s'", name,
hostname);
}
else {
(*process)->smx_host = host;
(*process)->data = data;
- VERB1("Create context %s", (*process)->name);
+ XBT_VERB("Create context %s", (*process)->name);
(*process)->context = SIMIX_context_new(code, argc, argv,
simix_global->cleanup_process_function, *process);
/* Add the process to it's host process list */
xbt_swag_insert(*process, host->process_list);
- DEBUG1("Start context '%s'", (*process)->name);
+ XBT_DEBUG("Start context '%s'", (*process)->name);
/* Now insert it in the global process list and in the process to run list */
xbt_swag_insert(*process, simix_global->process_list);
- DEBUG2("Inserting %s(%s) in the to_run list", (*process)->name, host->name);
+ XBT_DEBUG("Inserting %s(%s) in the to_run list", (*process)->name, host->name);
xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, *process);
}
}
*/
void SIMIX_process_kill(smx_process_t process, smx_process_t killer) {
- DEBUG2("Killing process %s on %s", process->name, process->smx_host->name);
+ XBT_DEBUG("Killing process %s on %s", process->name, process->smx_host->name);
process->context->iwannadie = 1;
process->blocked = 0;
surf_workstation_model->extension.workstation.sleep(host->host, duration);
surf_workstation_model->action_data_set(action->sleep.surf_sleep, action);
- DEBUG1("Create sleep action %p", action);
+ XBT_DEBUG("Create sleep action %p", action);
return action;
}
void SIMIX_process_sleep_destroy(smx_action_t action)
{
- DEBUG1("Destroy action %p", action);
+ XBT_DEBUG("Destroy action %p", action);
if (action->sleep.surf_sleep)
action->sleep.surf_sleep->model_type->action_unref(action->sleep.surf_sleep);
#ifdef HAVE_TRACING
{
smx_process_t self = SIMIX_process_self();
- DEBUG1("Yield process '%s'", self->name);
+ XBT_DEBUG("Yield process '%s'", self->name);
/* Go into sleep and return control to maestro */
SIMIX_context_suspend(self->context);
/* Ok, maestro returned control to us */
- DEBUG1("Maestro returned control to me: '%s'", self->name);
+ XBT_DEBUG("Maestro returned control to me: '%s'", self->name);
if (self->context->iwannadie){
- DEBUG0("I wanna die!");
+ XBT_DEBUG("I wanna die!");
SIMIX_context_stop(self->context);
}
if (self->doexception) {
- DEBUG0("Wait, maestro left me an exception");
+ XBT_DEBUG("Wait, maestro left me an exception");
self->doexception = 0;
RETHROW;
}
xbt_swag_insert_at_tail(&issuer->request, req_table);
- DEBUG3("Pushed request %s (%d) of %s",
+ XBT_DEBUG("Pushed request %s (%d) of %s",
SIMIX_request_name(issuer->request.call), issuer->request.call,
issuer->name);
- DEBUG3("Yield process '%s' on request of type %s (%d)", issuer->name,
+ XBT_DEBUG("Yield process '%s' on request of type %s (%d)", issuer->name,
SIMIX_request_name(issuer->request.call), issuer->request.call);
SIMIX_process_yield();
} else {
for(i=0; i < nthreads; i++){
if((req = xbt_swag_extract(req_lists[i]))){
- DEBUG3("Popped request %s (%d) of %s",
+ XBT_DEBUG("Popped request %s (%d) of %s",
SIMIX_request_name(req->issuer->request.call),
req->issuer->request.call,
req->issuer->name);
void SIMIX_request_answer(smx_req_t req)
{
if (req->issuer != simix_global->maestro_process){
- DEBUG2("Answer request %s (%d)", SIMIX_request_name(req->call), req->call);
+ XBT_DEBUG("Answer request %s (%d)", SIMIX_request_name(req->call), req->call);
req->issuer->request.call = REQ_NO_REQ;
xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, req->issuer);
}
void SIMIX_synchro_destroy(smx_action_t action)
{
- DEBUG1("Destroying synchro %p", action);
+ XBT_DEBUG("Destroying synchro %p", action);
action->synchro.sleep->model_type->action_unref(action->synchro.sleep);
xbt_free(action->name);
xbt_mallocator_release(simix_global->action_mallocator, action);
{
smx_action_t sync_act = NULL;
- DEBUG1("Wait condition %p", cond);
+ XBT_DEBUG("Wait condition %p", cond);
/* If there is a mutex unlock it */
/* FIXME: what happens if the issuer is not the owner of the mutex? */
smx_mutex_t mutex = NULL;
smx_req_t req = NULL;
- DEBUG1("Signal condition %p", cond);
+ XBT_DEBUG("Signal condition %p", cond);
/* If there are processes waiting for the condition choose one and try
to make it acquire the mutex */
*/
void SIMIX_cond_broadcast(smx_cond_t cond)
{
- DEBUG1("Broadcast condition %p", cond);
+ XBT_DEBUG("Broadcast condition %p", cond);
/* Signal the condition until nobody is waiting on it */
while (xbt_swag_size(cond->sleeping)) {
*/
void SIMIX_cond_destroy(smx_cond_t cond)
{
- DEBUG1("Destroy condition %p", cond);
+ XBT_DEBUG("Destroy condition %p", cond);
if (cond != NULL) {
xbt_assert0(xbt_swag_size(cond->sleeping) == 0,
/** @brief Destroys a semaphore */
void SIMIX_sem_destroy(smx_sem_t sem)
{
- DEBUG1("Destroy semaphore %p", sem);
+ XBT_DEBUG("Destroy semaphore %p", sem);
if (sem != NULL) {
xbt_assert0(xbt_swag_size(sem->sleeping) == 0,
"Cannot destroy semaphore since someone is still using it");
{
smx_process_t proc;
- DEBUG1("Sem release semaphore %p", sem);
+ XBT_DEBUG("Sem release semaphore %p", sem);
if ((proc = xbt_swag_extract(sem->sleeping))) {
proc = xbt_swag_extract(sem->sleeping);
SIMIX_synchro_destroy(proc->waiting_action);
{
smx_action_t sync_act = NULL;
- DEBUG2("Wait semaphore %p (timeout:%f)", sem, timeout);
+ XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout);
if (sem->value <= 0) {
sync_act = SIMIX_synchro_wait(issuer->smx_host, timeout);
xbt_fifo_unshift(sync_act->request_list, req);
comms = xbt_dynar_new(sizeof(smx_action_t), NULL);
map = xbt_new(int, count);
size = 0;
- DEBUG0("Wait for one of");
+ XBT_DEBUG("Wait for one of");
for(i = 0; i < count; i++) {
if(requests[i] != MPI_REQUEST_NULL) {
print_request(" ", requests[i]);
smx_host_t host;
host = SIMIX_host_self();
- DEBUG1("Handle real computation time: %f flops", flops);
+ XBT_DEBUG("Handle real computation time: %f flops", flops);
action = SIMIX_req_host_execute("computation", host, flops, 1);
#ifdef HAVE_TRACING
SIMIX_req_set_category (action, TRACE_internal_smpi_get_category());
static void smpi_execute(double duration)
{
if (duration >= xbt_cfg_get_double(_surf_cfg_set, "smpi/cpu_threshold")) {
- DEBUG1("Sleep for %f to handle real computation time", duration);
+ XBT_DEBUG("Sleep for %f to handle real computation time", duration);
smpi_execute_flops(duration *
xbt_cfg_get_double(_surf_cfg_set,
"smpi/running_power"));
if (!data->started) {
if ((data->iters > 0 && data->count >= data->iters)
|| (data->count > 1 && data->threshold > 0.0 && data->relstderr <= data->threshold)) {
- DEBUG1("Perform some wait of %f", data->mean);
+ XBT_DEBUG("Perform some wait of %f", data->mean);
smpi_execute(data->mean);
} else {
data->started = 1;
n = (double)data->count;
data->mean = data->sum / n;
data->relstderr = sqrt((data->sum_pow2 / n - data->mean * data->mean) / n) / data->mean;
- DEBUG4("Average mean after %d steps is %f, relative standard error is %f (sample was %f)", data->count,
+ XBT_DEBUG("Average mean after %d steps is %f, relative standard error is %f (sample was %f)", data->count,
data->mean, data->relstderr, sample);
}
char *loc;
if (!allocs) {
- WARN0("Cannot free: nothing was allocated");
+ XBT_WARN("Cannot free: nothing was allocated");
return;
}
loc = xbt_dict_get_key(allocs, data);
if (!loc) {
- WARN1("Cannot free: %p was not shared-allocated by SMPI", ptr);
+ XBT_WARN("Cannot free: %p was not shared-allocated by SMPI", ptr);
return;
}
data->count--;
rank = smpi_comm_rank(comm);
/* wait for data from my parent in the tree */
if (!tree->isRoot) {
- DEBUG3("<%d> tree_bcast(): i am not root: recv from %d, tag=%d)",
+ XBT_DEBUG("<%d> tree_bcast(): i am not root: recv from %d, tag=%d)",
rank, tree->parent, system_tag + rank);
smpi_mpi_recv(buf, count, datatype, tree->parent, system_tag + rank,
comm, MPI_STATUS_IGNORE);
}
requests = xbt_new(MPI_Request, tree->numChildren);
- DEBUG2("<%d> creates %d requests (1 per child)", rank,
+ XBT_DEBUG("<%d> creates %d requests (1 per child)", rank,
tree->numChildren);
/* iniates sends to ranks lower in the tree */
for (i = 0; i < tree->numChildren; i++) {
if (tree->child[i] == -1) {
requests[i] = MPI_REQUEST_NULL;
} else {
- DEBUG3("<%d> send to <%d>, tag=%d", rank, tree->child[i],
+ XBT_DEBUG("<%d> send to <%d>, tag=%d", rank, tree->child[i],
system_tag + tree->child[i]);
requests[i] =
smpi_isend_init(buf, count, datatype, tree->child[i],
rank = smpi_comm_rank(comm);
// everyone sends to its parent, except root.
if (!tree->isRoot) {
- DEBUG3("<%d> tree_antibcast(): i am not root: send to %d, tag=%d)",
+ XBT_DEBUG("<%d> tree_antibcast(): i am not root: send to %d, tag=%d)",
rank, tree->parent, system_tag + rank);
smpi_mpi_send(buf, count, datatype, tree->parent, system_tag + rank,
comm);
}
//every one receives as many messages as it has children
requests = xbt_new(MPI_Request, tree->numChildren);
- DEBUG2("<%d> creates %d requests (1 per child)", rank,
+ XBT_DEBUG("<%d> creates %d requests (1 per child)", rank,
tree->numChildren);
for (i = 0; i < tree->numChildren; i++) {
if (tree->child[i] == -1) {
requests[i] = MPI_REQUEST_NULL;
} else {
- DEBUG3("<%d> recv from <%d>, tag=%d", rank, tree->child[i],
+ XBT_DEBUG("<%d> recv from <%d>, tag=%d", rank, tree->child[i],
system_tag + tree->child[i]);
requests[i] =
smpi_irecv_init(buf, count, datatype, tree->child[i],
// FIXME: check implementation
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
- DEBUG1("<%d> algorithm alltoall_bruck() called.", rank);
+ XBT_DEBUG("<%d> algorithm alltoall_bruck() called.", rank);
err = smpi_datatype_extent(sendtype, &lb, &sendextent);
err = smpi_datatype_extent(recvtype, &lb, &recvextent);
/* Local copy from self */
/* Create all receives that will be posted first */
for (i = 0; i < size; ++i) {
if (i == rank) {
- DEBUG3("<%d> skip request creation [src = %d, recvcount = %d]",
+ XBT_DEBUG("<%d> skip request creation [src = %d, recvcount = %d]",
rank, i, recvcount);
continue;
}
/* Now create all sends */
for (i = 0; i < size; ++i) {
if (i == rank) {
- DEBUG3("<%d> skip request creation [dst = %d, sendcount = %d]",
+ XBT_DEBUG("<%d> skip request creation [dst = %d, sendcount = %d]",
rank, i, sendcount);
continue;
}
}
/* Wait for them all. */
smpi_mpi_startall(count, requests);
- DEBUG2("<%d> wait for %d requests", rank, count);
+ XBT_DEBUG("<%d> wait for %d requests", rank, count);
smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
xbt_free(requests);
}
/* Initialize. */
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
- DEBUG1("<%d> algorithm alltoall_basic_linear() called.", rank);
+ XBT_DEBUG("<%d> algorithm alltoall_basic_linear() called.", rank);
err = smpi_datatype_extent(sendtype, &lb, &sendinc);
err = smpi_datatype_extent(recvtype, &lb, &recvinc);
sendinc *= sendcount;
}
/* Wait for them all. */
smpi_mpi_startall(count, requests);
- DEBUG2("<%d> wait for %d requests", rank, count);
+ XBT_DEBUG("<%d> wait for %d requests", rank, count);
smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
xbt_free(requests);
}
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
- DEBUG1("<%d> algorithm alltoall_pairwise() called.", rank);
+ XBT_DEBUG("<%d> algorithm alltoall_pairwise() called.", rank);
sendsize = smpi_datatype_size(sendtype);
recvsize = smpi_datatype_size(recvtype);
/* Perform pairwise exchange - starting from 1 so the local copy is last */
/* Initialize. */
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
- DEBUG1("<%d> algorithm basic_alltoallv() called.", rank);
+ XBT_DEBUG("<%d> algorithm basic_alltoallv() called.", rank);
err = smpi_datatype_extent(sendtype, &lb, &sendextent);
err = smpi_datatype_extent(recvtype, &lb, &recvextent);
/* Local copy from self */
/* Create all receives that will be posted first */
for (i = 0; i < size; ++i) {
if (i == rank || recvcounts[i] == 0) {
- DEBUG3
+ XBT_DEBUG
("<%d> skip request creation [src = %d, recvcounts[src] = %d]",
rank, i, recvcounts[i]);
continue;
/* Now create all sends */
for (i = 0; i < size; ++i) {
if (i == rank || sendcounts[i] == 0) {
- DEBUG3
+ XBT_DEBUG
("<%d> skip request creation [dst = %d, sendcounts[dst] = %d]",
rank, i, sendcounts[i]);
continue;
}
/* Wait for them all. */
smpi_mpi_startall(count, requests);
- DEBUG2("<%d> wait for %d requests", rank, count);
+ XBT_DEBUG("<%d> wait for %d requests", rank, count);
smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
xbt_free(requests);
}
(*argc)--;
data->argc = argc;
data->argv = argv;
- DEBUG2("<%d> New process in the game: %p", index, proc);
+ XBT_DEBUG("<%d> New process in the game: %p", index, proc);
}
}
{
int index = smpi_process_index();
- DEBUG1("<%d> Process left the game", index);
+ XBT_DEBUG("<%d> Process left the game", index);
}
int smpi_process_argc(void) {
void print_request(const char *message, MPI_Request request)
{
- DEBUG8("%s request %p [buf = %p, size = %zu, src = %d, dst = %d, tag = %d, flags = %x]",
+ XBT_DEBUG("%s request %p [buf = %p, size = %zu, src = %d, dst = %d, tag = %d, flags = %x]",
message, request, request->buf, request->size,
request->src, request->dst, request->tag, request->flags);
}
SIMIX_run();
if (xbt_cfg_get_int(_surf_cfg_set, "smpi/display_timing"))
- INFO1("simulation time %g", SIMIX_get_clock());
+ XBT_INFO("simulation time %g", SIMIX_get_clock());
smpi_global_destroy();
if (tmgr_trace_event_free(event_type))
cpu->state_event = NULL;
} else {
- CRITICAL0("Unknown event ! \n");
+ XBT_CRITICAL("Unknown event ! \n");
xbt_abort();
}
surf_action_cpu_Cas01_t action = NULL;
cpu_Cas01_t CPU = cpu;
- XBT_IN2("(%s,%g)", surf_resource_name(CPU), size);
+ XBT_IN_F("(%s,%g)", surf_resource_name(CPU), size);
action =
surf_action_new(sizeof(s_surf_action_cpu_Cas01_t), size,
surf_cpu_model,
if (duration > 0)
duration = MAX(duration, MAXMIN_PRECISION);
- XBT_IN2("(%s,%g)", surf_resource_name(cpu), duration);
+ XBT_IN_F("(%s,%g)", surf_resource_name(cpu), duration);
action = (surf_action_cpu_Cas01_t) cpu_execute(cpu, 1.0);
action->generic_action.max_duration = duration;
action->suspended = 2;
static void cpu_action_suspend(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
if (((surf_action_cpu_Cas01_t) action)->suspended != 2) {
lmm_update_variable_weight(cpu_maxmin_system,
((surf_action_cpu_Cas01_t)
static void cpu_action_resume(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
if (((surf_action_cpu_Cas01_t) action)->suspended != 2) {
lmm_update_variable_weight(cpu_maxmin_system,
((surf_action_cpu_Cas01_t)
static void cpu_action_set_max_duration(surf_action_t action,
double duration)
{
- XBT_IN2("(%p,%g)", action, duration);
+ XBT_IN_F("(%p,%g)", action, duration);
action->max_duration = duration;
XBT_OUT;
}
static void cpu_action_set_priority(surf_action_t action, double priority)
{
- XBT_IN2("(%p,%g)", action, priority);
+ XBT_IN_F("(%p,%g)", action, priority);
action->priority = priority;
lmm_update_variable_weight(cpu_maxmin_system,
((surf_action_cpu_Cas01_t) action)->variable,
#ifdef HAVE_TRACING
static void cpu_action_set_category(surf_action_t action, const char *category)
{
- XBT_IN2("(%p,%s)", action, category);
+ XBT_IN_F("(%p,%s)", action, category);
action->category = xbt_strdup (category);
XBT_OUT;
}
static double cpu_action_get_remains(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
return action->remains;
XBT_OUT;
}
cpu->last_update,
now - cpu->last_update);
#endif
- DEBUG2("Update action(%p) remains %lf", action,
+ XBT_DEBUG("Update action(%p) remains %lf", action,
GENERIC_ACTION(action).remains);
}
}
GENERIC_ACTION(action).start +
GENERIC_ACTION(action).max_duration;
- DEBUG4("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
+ XBT_DEBUG("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
GENERIC_ACTION(action).start, now + value,
GENERIC_ACTION(action).max_duration);
}
if (min != -1) {
xbt_heap_push(cpu_im_action_heap, action, min);
- DEBUG2("Insert at heap action(%p) min %lf", action, min);
+ XBT_DEBUG("Insert at heap action(%p) min %lf", action, min);
}
}
xbt_swag_remove(cpu, cpu_im_modified_cpu);
while ((xbt_heap_size(cpu_im_action_heap) > 0)
&& (double_equals(xbt_heap_maxkey(cpu_im_action_heap), now))) {
action = xbt_heap_pop(cpu_im_action_heap);
- DEBUG1("Action %p: finish", action);
+ XBT_DEBUG("Action %p: finish", action);
GENERIC_ACTION(action).finish = surf_get_clock();
/* set the remains to 0 due to precision problems when updating the remaining amount */
#ifdef HAVE_TRACING
if (tmgr_trace_event_free(event_type))
cpu->state_event = NULL;
} else {
- CRITICAL0("Unknown event ! \n");
+ XBT_CRITICAL("Unknown event ! \n");
xbt_abort();
}
surf_action_cpu_Cas01_im_t action = NULL;
cpu_Cas01_im_t CPU = cpu;
- XBT_IN2("(%s,%g)", surf_resource_name(CPU), size);
+ XBT_IN_F("(%s,%g)", surf_resource_name(CPU), size);
action =
surf_action_new(sizeof(s_surf_action_cpu_Cas01_im_t), size,
surf_cpu_model,
if (duration > 0)
duration = MAX(duration, MAXMIN_PRECISION);
- XBT_IN2("(%s,%g)", surf_resource_name(cpu), duration);
+ XBT_IN_F("(%s,%g)", surf_resource_name(cpu), duration);
action = (surf_action_cpu_Cas01_im_t) cpu_im_execute(cpu, 1.0);
GENERIC_ACTION(action).max_duration = duration;
GENERIC_LMM_ACTION(action).suspended = 2;
static void cpu_im_action_suspend(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
if (((surf_action_lmm_t) action)->suspended != 2) {
lmm_update_variable_weight(cpu_im_maxmin_system,
((surf_action_lmm_t) action)->variable,
static void cpu_im_action_resume(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
if (((surf_action_lmm_t) action)->suspended != 2) {
lmm_update_variable_weight(cpu_im_maxmin_system,
((surf_action_lmm_t) action)->variable,
static void cpu_im_action_set_max_duration(surf_action_t action,
double duration)
{
- XBT_IN2("(%p,%g)", action, duration);
+ XBT_IN_F("(%p,%g)", action, duration);
action->max_duration = duration;
/* insert cpu in modified_cpu set to notice the max duration change */
static void cpu_im_action_set_priority(surf_action_t action,
double priority)
{
- XBT_IN2("(%p,%g)", action, priority);
+ XBT_IN_F("(%p,%g)", action, priority);
action->priority = priority;
lmm_update_variable_weight(cpu_im_maxmin_system,
((surf_action_lmm_t) action)->variable,
static void cpu_im_action_set_category(surf_action_t action,
const char *category)
{
- XBT_IN2("(%p,%s)", action, category);
+ XBT_IN_F("(%p,%s)", action, category);
action->category = xbt_strdup (category);
XBT_OUT;
}
static double cpu_im_action_get_remains(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
/* update remains before return it */
cpu_im_update_remains(ACTION_GET_CPU(action), surf_get_clock());
return action->remains;
if (!power_trace) {
trace->type = TRACE_FIXED;
trace->value = value;
- DEBUG1("No availabily trace. Constant value = %lf", value);
+ XBT_DEBUG("No availabily trace. Constant value = %lf", value);
return trace;
}
trace->total =
surf_cpu_ti_integrate_trace_simple(trace->trace, 0, total_time);
- DEBUG2("Total integral %lf, last_time %lf ",
+ XBT_DEBUG("Total integral %lf, last_time %lf ",
trace->total, trace->last_time);
return trace;
cpu->generic_resource.properties = cpu_properties;
cpu->power_peak = power_peak;
xbt_assert0(cpu->power_peak > 0, "Power has to be >0");
- DEBUG1("power scale %lf", power_scale);
+ XBT_DEBUG("power scale %lf", power_scale);
cpu->power_scale = power_scale;
cpu->avail_trace = cpu_ti_parse_trace(power_trace, power_scale);
cpu->state_current = state_initial;
xbt_assert1(trace, "Trace %s undefined", trace_name);
if (cpu->state_event) {
- DEBUG1("Trace already configured for this CPU(%s), ignoring it",
+ XBT_DEBUG("Trace already configured for this CPU(%s), ignoring it",
elm);
continue;
}
- DEBUG2("Add state trace: %s to CPU(%s)", trace_name, elm);
+ XBT_DEBUG("Add state trace: %s to CPU(%s)", trace_name, elm);
cpu->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, cpu);
}
xbt_assert1(cpu, "Host %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
- DEBUG2("Add power trace: %s to CPU(%s)", trace_name, elm);
+ XBT_DEBUG("Add power trace: %s to CPU(%s)", trace_name, elm);
if (cpu->avail_trace)
surf_cpu_ti_free_tmgr(cpu->avail_trace);
area_total =
surf_cpu_ti_integrate_trace(cpu->avail_trace, cpu->last_update,
now) * cpu->power_peak;
- DEBUG2("Flops total: %lf, Last update %lf", area_total,
+ XBT_DEBUG("Flops total: %lf, Last update %lf", area_total,
cpu->last_update);
xbt_swag_foreach(action, cpu->action_set) {
double_update(&(GENERIC_ACTION(action).remains),
area_total / (cpu->sum_priority *
GENERIC_ACTION(action).priority));
- DEBUG2("Update remaining action(%p) remaining %lf", action,
+ XBT_DEBUG("Update remaining action(%p) remaining %lf", action,
GENERIC_ACTION(action).remains);
}
cpu->last_update = now;
GENERIC_ACTION(action).max_duration);
}
/* add in action heap */
- DEBUG2("action(%p) index %d", action, action->index_heap);
+ XBT_DEBUG("action(%p) index %d", action, action->index_heap);
if (action->index_heap >= 0) {
surf_action_cpu_ti_t heap_act =
xbt_heap_remove(cpu_ti_action_heap, action->index_heap);
if (min_finish != NO_MAX_DURATION)
xbt_heap_push(cpu_ti_action_heap, action, min_finish);
- DEBUG5
+ XBT_DEBUG
("Update finish time: Cpu(%s) Action: %p, Start Time: %lf Finish Time: %lf Max duration %lf",
cpu->generic_resource.name, action, GENERIC_ACTION(action).start,
GENERIC_ACTION(action).finish,
if (xbt_heap_size(cpu_ti_action_heap) > 0)
min_action_duration = xbt_heap_maxkey(cpu_ti_action_heap) - now;
- DEBUG1("Share resources, min next event date: %lf", min_action_duration);
+ XBT_DEBUG("Share resources, min next event date: %lf", min_action_duration);
return min_action_duration;
}
while ((xbt_heap_size(cpu_ti_action_heap) > 0)
&& (xbt_heap_maxkey(cpu_ti_action_heap) <= now)) {
action = xbt_heap_pop(cpu_ti_action_heap);
- DEBUG1("Action %p: finish", action);
+ XBT_DEBUG("Action %p: finish", action);
GENERIC_ACTION(action).finish = surf_get_clock();
/* set the remains to 0 due to precision problems when updating the remaining amount */
GENERIC_ACTION(action).remains = 0;
surf_cpu_ti_tgmr_t trace;
s_tmgr_event_t val;
- DEBUG3("Finish trace date: %lf value %lf date %lf", surf_get_clock(),
+ XBT_DEBUG("Finish trace date: %lf value %lf date %lf", surf_get_clock(),
value, date);
/* update remaining of actions and put in modified cpu swag */
cpu_ti_update_remaining_amount(cpu, date);
trace = xbt_new0(s_surf_cpu_ti_tgmr_t, 1);
trace->type = TRACE_FIXED;
trace->value = val.value;
- DEBUG1("value %lf", val.value);
+ XBT_DEBUG("value %lf", val.value);
cpu->avail_trace = trace;
if (tmgr_trace_event_free(event_type))
cpu->state_event = NULL;
} else {
- CRITICAL0("Unknown event ! \n");
+ XBT_CRITICAL("Unknown event ! \n");
xbt_abort();
}
surf_action_cpu_ti_t action = NULL;
cpu_ti_t CPU = cpu;
- XBT_IN2("(%s,%g)", surf_resource_name(CPU), size);
+ XBT_IN_F("(%s,%g)", surf_resource_name(CPU), size);
action =
surf_action_new(sizeof(s_surf_action_cpu_ti_t), size, surf_cpu_model,
CPU->state_current != SURF_RESOURCE_ON);
if (duration > 0)
duration = MAX(duration, MAXMIN_PRECISION);
- XBT_IN2("(%s,%g)", surf_resource_name(cpu), duration);
+ XBT_IN_F("(%s,%g)", surf_resource_name(cpu), duration);
action = (surf_action_cpu_ti_t) cpu_ti_execute(cpu, 1.0);
action->generic_action.max_duration = duration;
action->suspended = 2;
static void cpu_ti_action_suspend(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
if (((surf_action_cpu_ti_t) action)->suspended != 2) {
((surf_action_cpu_ti_t) action)->suspended = 1;
xbt_heap_remove(cpu_ti_action_heap,
static void cpu_ti_action_resume(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
if (((surf_action_cpu_ti_t) action)->suspended != 2) {
((surf_action_cpu_ti_t) action)->suspended = 0;
xbt_swag_insert(ACTION_GET_CPU(action), cpu_ti_modified_cpu);
surf_action_cpu_ti_t ACT = (surf_action_cpu_ti_t) action;
double min_finish;
- XBT_IN2("(%p,%g)", action, duration);
+ XBT_IN_F("(%p,%g)", action, duration);
action->max_duration = duration;
static void cpu_ti_action_set_priority(surf_action_t action,
double priority)
{
- XBT_IN2("(%p,%g)", action, priority);
+ XBT_IN_F("(%p,%g)", action, priority);
action->priority = priority;
xbt_swag_insert(ACTION_GET_CPU(action), cpu_ti_modified_cpu);
XBT_OUT;
static double cpu_ti_action_get_remains(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
cpu_ti_update_remaining_amount((cpu_ti_t)
((surf_action_cpu_ti_t) action)->cpu,
surf_get_clock());
int a_index, b_index;
if ((a < 0.0) || (a > b)) {
- CRITICAL2
+ XBT_CRITICAL
("Error, invalid integration interval [%.2f,%.2f]. You probably have a task executing with negative computation amount. Check your code.",
a, b);
xbt_abort();
(b_index) *
trace->last_time);
- DEBUG3("first_chunk=%.2f middle_chunk=%.2f last_chunk=%.2f\n",
+ XBT_DEBUG("first_chunk=%.2f middle_chunk=%.2f last_chunk=%.2f\n",
first_chunk, middle_chunk, last_chunk);
return (first_chunk + middle_chunk + last_chunk);
surf_cpu_ti_binary_search(trace->time_points, a, 0,
trace->nb_points - 1);
integral += trace->integral[ind];
- DEBUG7
+ XBT_DEBUG
("a %lf ind %d integral %lf ind + 1 %lf ind %lf time +1 %lf time %lf",
a, ind, integral, trace->integral[ind + 1], trace->integral[ind],
trace->time_points[ind + 1], trace->time_points[ind]);
trace->
time_points
[ind]);
- DEBUG2("Integral a %lf = %lf", a, integral);
+ XBT_DEBUG("Integral a %lf = %lf", a, integral);
return integral;
}
/* Sanity checks */
if ((a < 0.0) || (amount < 0.0)) {
- CRITICAL2
+ XBT_CRITICAL
("Error, invalid parameters [a = %.2f, amount = %.2f]. You probably have a task executing with negative computation amount. Check your code.",
a, amount);
xbt_abort();
return (a + (amount / trace->value));
}
- DEBUG2("amount %lf total %lf", amount, trace->total);
+ XBT_DEBUG("amount %lf total %lf", amount, trace->total);
/* Reduce the problem to one where amount <= trace_total */
quotient = (int) (floor(amount / trace->total));
reduced_amount = (trace->total) * ((amount / trace->total) -
floor(amount / trace->total));
reduced_a = a - (trace->last_time) * (int) (floor(a / trace->last_time));
- DEBUG3("Quotient: %d reduced_amount: %lf reduced_a: %lf", quotient,
+ XBT_DEBUG("Quotient: %d reduced_amount: %lf reduced_a: %lf", quotient,
reduced_amount, reduced_a);
/* Now solve for new_amount which is <= trace_total */
double amount_till_end;
double b;
- DEBUG2("Solve integral: [%.2f, amount=%.2f]", a, amount);
+ XBT_DEBUG("Solve integral: [%.2f, amount=%.2f]", a, amount);
amount_till_end =
surf_cpu_ti_integrate_trace(trace, a, trace->last_time);
/*
int high)
{
int mid = low + (high - low) / 2;
- DEBUG5("a %lf low %d high %d mid %d value %lf", a, low, high, mid,
+ XBT_DEBUG("a %lf low %d high %d mid %d value %lf", a, low, high, mid,
array[mid]);
/* a == array[mid] */
if (array[mid] == a)
#include <math.h>
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_maxmin);
-#define SHOW_EXPR_G(expr) DEBUG1(#expr " = %g",expr);
-#define SHOW_EXPR_D(expr) DEBUG1(#expr " = %d",expr);
-#define SHOW_EXPR_P(expr) DEBUG1(#expr " = %p",expr);
+#define SHOW_EXPR_G(expr) XBT_DEBUG(#expr " = %g",expr);
+#define SHOW_EXPR_D(expr) XBT_DEBUG(#expr " = %d",expr);
+#define SHOW_EXPR_P(expr) XBT_DEBUG(#expr " = %p",expr);
void bottleneck_solve(lmm_system_t sys)
{
xbt_swag_offset(s_cnst, saturated_constraint_set_hookup));
var_list = &(sys->variable_set);
- DEBUG1("Variable set : %d", xbt_swag_size(var_list));
+ XBT_DEBUG("Variable set : %d", xbt_swag_size(var_list));
xbt_swag_foreach(var, var_list) {
int nb = 0;
var->value = 0.0;
- DEBUG1("Handling variable %p", var);
+ XBT_DEBUG("Handling variable %p", var);
xbt_swag_insert(var, &(sys->saturated_variable_set));
for (i = 0; i < var->cnsts_number; i++) {
if (var->cnsts[i].value == 0.0)
nb++;
}
if ((nb == var->cnsts_number) && (var->weight > 0.0)) {
- DEBUG1("Err, finally, there is no need to take care of variable %p",
+ XBT_DEBUG("Err, finally, there is no need to take care of variable %p",
var);
xbt_swag_remove(var, &(sys->saturated_variable_set));
var->value = 1.0;
}
if (var->weight <= 0.0) {
- DEBUG1("Err, finally, there is no need to take care of variable %p",
+ XBT_DEBUG("Err, finally, there is no need to take care of variable %p",
var);
xbt_swag_remove(var, &(sys->saturated_variable_set));
}
var_list = &(sys->saturated_variable_set);
cnst_list = &(sys->active_constraint_set);
- DEBUG1("Active constraints : %d", xbt_swag_size(cnst_list));
+ XBT_DEBUG("Active constraints : %d", xbt_swag_size(cnst_list));
xbt_swag_foreach(cnst, cnst_list) {
xbt_swag_insert(cnst, &(sys->saturated_constraint_set));
}
cnst->usage = 0.0;
}
- DEBUG0("Fair bottleneck Initialized");
+ XBT_DEBUG("Fair bottleneck Initialized");
/*
* Compute Usage and store the variables that reach the maximum.
*/
do {
if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
- DEBUG0("Fair bottleneck done");
+ XBT_DEBUG("Fair bottleneck done");
lmm_print(sys);
}
- DEBUG1("******* Constraints to process: %d *******",
+ XBT_DEBUG("******* Constraints to process: %d *******",
xbt_swag_size(cnst_list));
min_usage = -1;
xbt_swag_foreach_safe(cnst, cnst_next, cnst_list) {
int nb = 0;
- DEBUG1("Processing cnst %p ", cnst);
+ XBT_DEBUG("Processing cnst %p ", cnst);
elem_list = &(cnst->element_set);
cnst->usage = 0.0;
xbt_swag_foreach(elem, elem_list) {
&& xbt_swag_belongs(elem->variable, var_list))
nb++;
}
- DEBUG1("\tThere are %d variables", nb);
+ XBT_DEBUG("\tThere are %d variables", nb);
if (nb > 0 && !cnst->shared)
nb = 1;
if (!nb) {
continue;
}
cnst->usage = cnst->remaining / nb;
- DEBUG3("\tConstraint Usage %p : %f with %d variables", cnst,
+ XBT_DEBUG("\tConstraint Usage %p : %f with %d variables", cnst,
cnst->usage, nb);
}
if (var->bound > 0)
min_inc = MIN(min_inc, var->bound - var->value);
var->mu = min_inc;
- DEBUG2("Updating variable %p maximum increment: %g", var, var->mu);
+ XBT_DEBUG("Updating variable %p maximum increment: %g", var, var->mu);
var->value += var->mu;
if (var->value == var->bound) {
xbt_swag_remove(var, var_list);
}
xbt_swag_foreach_safe(cnst, cnst_next, cnst_list) {
- DEBUG1("Updating cnst %p ", cnst);
+ XBT_DEBUG("Updating cnst %p ", cnst);
elem_list = &(cnst->element_set);
xbt_swag_foreach(elem, elem_list) {
if (elem->variable->weight <= 0)
break;
if (cnst->shared) {
- DEBUG4("\tUpdate constraint %p (%g) with variable %p by %g",
+ XBT_DEBUG("\tUpdate constraint %p (%g) with variable %p by %g",
cnst, cnst->remaining, elem->variable,
elem->variable->mu);
double_update(&(cnst->remaining),
elem->value * elem->variable->mu);
} else {
- DEBUG4
+ XBT_DEBUG
("\tNon-Shared variable. Update constraint usage of %p (%g) with variable %p by %g",
cnst, cnst->usage, elem->variable, elem->variable->mu);
cnst->usage = MIN(cnst->usage, elem->value * elem->variable->mu);
}
}
if (!cnst->shared) {
- DEBUG3("\tUpdate constraint %p (%g) by %g",
+ XBT_DEBUG("\tUpdate constraint %p (%g) by %g",
cnst, cnst->remaining, cnst->usage);
double_update(&(cnst->remaining), cnst->usage);
}
- DEBUG2("\tRemaining for %p : %g", cnst, cnst->remaining);
+ XBT_DEBUG("\tRemaining for %p : %g", cnst, cnst->remaining);
if (cnst->remaining == 0.0) {
- DEBUG1("\tGet rid of constraint %p", cnst);
+ XBT_DEBUG("\tGet rid of constraint %p", cnst);
xbt_swag_remove(cnst, cnst_list);
xbt_swag_foreach(elem, elem_list) {
if (elem->variable->weight <= 0)
break;
if (elem->value > 0) {
- DEBUG1("\t\tGet rid of variable %p", elem->variable);
+ XBT_DEBUG("\t\tGet rid of variable %p", elem->variable);
xbt_swag_remove(elem->variable, var_list);
}
}
}
sys->modified = 0;
if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
- DEBUG0("Fair bottleneck done");
+ XBT_DEBUG("Fair bottleneck done");
lmm_print(sys);
}
}
#include "gtnets_simulator.h"
#include "gtnets_interface.h"
-#ifdef DEBUG0
- #undef DEBUG0
+#ifdef XBT_DEBUG
+ #undef XBT_DEBUG
#endif
#include "xbt/log.h"
#include "xbt/asserts.h"
// initialize the GTNetS interface and environment
int gtnets_initialize(int wsize){
- DEBUG0("Using logging.");
+ XBT_DEBUG("Using logging.");
xbt_assert0(!gtnets_sim, "gtnets already initialized");
if(wsize > 0){
- INFO1("TCP window maximum size : %d", wsize);
+ XBT_INFO("TCP window maximum size : %d", wsize);
gtnets_sim = new GTSim(wsize);
}else{
gtnets_sim = new GTSim(wsize);
file.open ("/dev/null");
sbuf = cout.rdbuf();
cout.rdbuf(file.rdbuf());
- DEBUG0("Enable GTNetS library quite mode");
+ XBT_DEBUG("Enable GTNetS library quite mode");
}else {
- DEBUG0("Disable GTNetS library quite mode");
+ XBT_DEBUG("Disable GTNetS library quite mode");
}
value = gtnets_sim->get_time_to_next_flow_completion();
file.open ("/dev/null");
sbuf = cout.rdbuf();
cout.rdbuf(file.rdbuf());
- DEBUG0("Enable GTNetS library quite mode");
+ XBT_DEBUG("Enable GTNetS library quite mode");
}else {
- DEBUG0("Disable GTNetS library quite mode");
+ XBT_DEBUG("Disable GTNetS library quite mode");
}
value = gtnets_sim->run_until_next_flow_completion(metadata, number_of_flows);
#include "gtnets_topology.h"
#include <map>
#include <vector>
-#ifdef DEBUG0
- #undef DEBUG0
+#ifdef XBT_DEBUG
+ #undef XBT_DEBUG
#endif
#include "xbt/log.h"
#include "xbt/asserts.h"
int GTSim::add_link(int id, double bandwidth, double latency){
double bw = bandwidth * 8; //Bandwidth in bits (used in GTNETS).
xbt_assert1(!(topo_->add_link(id) < 0),"Can't add link %d. already exists", id);
- DEBUG3("Creating a new P2P, linkid %d, bandwidth %gl, latency %gl", id, bandwidth, latency);
+ XBT_DEBUG("Creating a new P2P, linkid %d, bandwidth %gl, latency %gl", id, bandwidth, latency);
gtnets_links_[id] = new Linkp2p(bw, latency);
if(jitter_ > 0){
- DEBUG2("Using jitter %f, and seed %u", jitter_, jitter_seed_);
+ XBT_DEBUG("Using jitter %f, and seed %u", jitter_, jitter_seed_);
double min = -1*jitter_*latency;
double max = jitter_*latency;
uniform_jitter_generator_[id] = new Uniform(min,max);
id = (*it)->id();
gtnets_nodes_[id] = new Node();
gtnets_nodes_[id]->SetIPAddr(address++);
- DEBUG2("In GTSim, add_node: %d, with IPAddr %s", id, helper.ToDotted(address-1));
+ XBT_DEBUG("In GTSim, add_node: %d, with IPAddr %s", id, helper.ToDotted(address-1));
}
}
gtnets_nodes_[srcid]->
AddDuplexLink(gtnets_nodes_[dstid], *(gtnets_links_[linkid]));
- DEBUG3("Setting DuplexLink, src %d, dst %d, linkid %d", srcid, dstid, linkid);
+ XBT_DEBUG("Setting DuplexLink, src %d, dst %d, linkid %d", srcid, dstid, linkid);
}
}
}
jitter_seed_ = s;
if(jitter_seed_ > 0.0){
- INFO1("Setting the jitter_seed with %d", jitter_seed_ );
+ XBT_INFO("Setting the jitter_seed with %d", jitter_seed_ );
Random::GlobalSeed(jitter_seed_ , jitter_seed_ , jitter_seed_ ,jitter_seed_ ,jitter_seed_ ,jitter_seed_);
}
}
//Temporary classes for generating GTNetS topology
#include "gtnets_topology.h"
-#ifdef DEBUG0
- #undef DEBUG0
+#ifdef XBT_DEBUG
+ #undef XBT_DEBUG
#endif
#include "xbt/log.h"
#include "xbt/asserts.h"
void GTNETS_Node::print_hosts(){
set<int>::iterator it;
for (it = hosts_.begin(); it != hosts_.end(); it++){
- DEBUG1("host id %d", *it);
+ XBT_DEBUG("host id %d", *it);
}
}
}
void GTNETS_Link::print_link_status(){
- DEBUG1("****** link id: %d", ID_);
+ XBT_DEBUG("****** link id: %d", ID_);
if (src_node_){
- DEBUG2("[src] id: %d, is it router?: %d",src_node_->id(), src_node_->is_router());
+ XBT_DEBUG("[src] id: %d, is it router?: %d",src_node_->id(), src_node_->is_router());
}
if (dst_node_){
- DEBUG2("[dst] id: %d, is it router?: %d",dst_node_->id(), dst_node_->is_router());
+ XBT_DEBUG("[dst] id: %d, is it router?: %d",dst_node_->id(), dst_node_->is_router());
}
}
if(iter == routers_.end()){
routers_.insert(id);
}else{
- DEBUG1("Router (#%d) already exists", id);
+ XBT_DEBUG("Router (#%d) already exists", id);
}
return 0;
}
xbt_assert1(!(iter == links_.end()), "Link %d not found", linkid);
link = iter->second;
- DEBUG4("Add onehop route, src (#%d), dst (#%d), linkid %d:(#%d)",src, dst, linkid, link->id());
+ XBT_DEBUG("Add onehop route, src (#%d), dst (#%d), linkid %d:(#%d)",src, dst, linkid, link->id());
GTNETS_Node *src_node, *dst_node;
src_node = link->src_node();
}
void GTNETS_Topology::print_topology(){
- DEBUG0("<<<<<================================>>>>>");
- DEBUG0("Dumping GTNETS topollogy information");
+ XBT_DEBUG("<<<<<================================>>>>>");
+ XBT_DEBUG("Dumping GTNETS topollogy information");
map<int, GTNETS_Link*>::iterator it;
for (it = links_.begin(); it != links_.end(); it++){
it->second->print_link_status();
}
- DEBUG0(">>>>>================================<<<<<");
+ XBT_DEBUG(">>>>>================================<<<<<");
fflush(NULL);
}
XBT_LOG_NEW_SUBCATEGORY(surf_lagrange_dichotomy, surf_lagrange,
"Logging specific to SURF (lagrange dichotomy)");
-#define SHOW_EXPR(expr) CDEBUG1(surf_lagrange,#expr " = %g",expr);
+#define SHOW_EXPR(expr) XBT_CDEBUG(surf_lagrange,#expr " = %g",expr);
double (*func_f_def) (lmm_variable_t, double);
double (*func_fp_def) (lmm_variable_t, double);
if (double_positive(tmp - cnst->bound)) {
if (warn)
- WARN3
+ XBT_WARN
("The link (%p) is over-used. Expected less than %f and got %f",
cnst, cnst->bound, tmp);
return 0;
}
- DEBUG3
+ XBT_DEBUG
("Checking feasability for constraint (%p): sat = %f, lambda = %f ",
cnst, tmp - cnst->bound, cnst->lambda);
}
break;
if (var->bound < 0)
continue;
- DEBUG3("Checking feasability for variable (%p): sat = %f mu = %f", var,
+ XBT_DEBUG("Checking feasability for variable (%p): sat = %f mu = %f", var,
var->value - var->bound, var->mu);
if (double_positive(var->value - var->bound)) {
if (warn)
- WARN3
+ XBT_WARN
("The variable (%p) is too large. Expected less than %f and got %f",
var, var->bound, var->value);
return 0;
}
if (var->bound > 0)
tmp += var->mu;
- DEBUG3("\t Working on var (%p). cost = %e; Weight = %e", var, tmp,
+ XBT_DEBUG("\t Working on var (%p). cost = %e; Weight = %e", var, tmp,
var->weight);
//uses the partial differential inverse function
return var->func_fpi(var, tmp);
if (var->bound > 0)
sigma_i += var->mu;
- DEBUG2("var %p : sigma_i = %1.20f", var, sigma_i);
+ XBT_DEBUG("var %p : sigma_i = %1.20f", var, sigma_i);
obj += var->func_f(var, var->func_fpi(var, sigma_i)) -
sigma_i * var->func_fpi(var, sigma_i);
int i;
double obj, new_obj;
- DEBUG0("Iterative method configuration snapshot =====>");
- DEBUG1("#### Maximum number of iterations : %d", max_iterations);
- DEBUG1("#### Minimum error tolerated : %e",
+ XBT_DEBUG("Iterative method configuration snapshot =====>");
+ XBT_DEBUG("#### Maximum number of iterations : %d", max_iterations);
+ XBT_DEBUG("#### Minimum error tolerated : %e",
epsilon_min_error);
- DEBUG1("#### Minimum error tolerated (dichotomy) : %e",
+ XBT_DEBUG("#### Minimum error tolerated (dichotomy) : %e",
dichotomy_min_error);
if (XBT_LOG_ISENABLED(surf_lagrange, xbt_log_priority_debug)) {
xbt_swag_foreach(cnst, cnst_list) {
cnst->lambda = 1.0;
cnst->new_lambda = 2.0;
- DEBUG2("#### cnst(%p)->lambda : %e", cnst, cnst->lambda);
+ XBT_DEBUG("#### cnst(%p)->lambda : %e", cnst, cnst->lambda);
}
/*
else {
int nb = 0;
if (var->bound < 0.0) {
- DEBUG1("#### NOTE var(%d) is a boundless variable", i);
+ XBT_DEBUG("#### NOTE var(%d) is a boundless variable", i);
var->mu = -1.0;
var->value = new_value(var);
} else {
var->new_mu = 2.0;
var->value = new_value(var);
}
- DEBUG2("#### var(%p) ->weight : %e", var, var->weight);
- DEBUG2("#### var(%p) ->mu : %e", var, var->mu);
- DEBUG2("#### var(%p) ->weight: %e", var, var->weight);
- DEBUG2("#### var(%p) ->bound: %e", var, var->bound);
+ XBT_DEBUG("#### var(%p) ->weight : %e", var, var->weight);
+ XBT_DEBUG("#### var(%p) ->mu : %e", var, var->mu);
+ XBT_DEBUG("#### var(%p) ->weight: %e", var, var->weight);
+ XBT_DEBUG("#### var(%p) ->bound: %e", var, var->bound);
for (i = 0; i < var->cnsts_number; i++) {
if (var->cnsts[i].value == 0.0)
nb++;
/* int dual_updated=0; */
iteration++;
- DEBUG1("************** ITERATION %d **************", iteration);
- DEBUG0("-------------- Gradient Descent ----------");
+ XBT_DEBUG("************** ITERATION %d **************", iteration);
+ XBT_DEBUG("-------------- Gradient Descent ----------");
/*
* Improve the value of mu_i
if (!var->weight)
break;
if (var->bound >= 0) {
- DEBUG1("Working on var (%p)", var);
+ XBT_DEBUG("Working on var (%p)", var);
var->new_mu = new_mu(var);
/* dual_updated += (fabs(var->new_mu-var->mu)>dichotomy_min_error); */
-/* DEBUG2("dual_updated (%d) : %1.20f",dual_updated,fabs(var->new_mu-var->mu)); */
- DEBUG3("Updating mu : var->mu (%p) : %1.20f -> %1.20f", var,
+/* XBT_DEBUG("dual_updated (%d) : %1.20f",dual_updated,fabs(var->new_mu-var->mu)); */
+ XBT_DEBUG("Updating mu : var->mu (%p) : %1.20f -> %1.20f", var,
var->mu, var->new_mu);
var->mu = var->new_mu;
new_obj = dual_objective(var_list, cnst_list);
- DEBUG3("Improvement for Objective (%g -> %g) : %g", obj, new_obj,
+ XBT_DEBUG("Improvement for Objective (%g -> %g) : %g", obj, new_obj,
obj - new_obj);
xbt_assert1(obj - new_obj >= -epsilon_min_error,
"Our gradient sucks! (%1.20f)", obj - new_obj);
* Improve the value of lambda_i
*/
xbt_swag_foreach(cnst, cnst_list) {
- DEBUG1("Working on cnst (%p)", cnst);
+ XBT_DEBUG("Working on cnst (%p)", cnst);
cnst->new_lambda =
dichotomy(cnst->lambda, partial_diff_lambda, cnst,
dichotomy_min_error);
/* dual_updated += (fabs(cnst->new_lambda-cnst->lambda)>dichotomy_min_error); */
-/* DEBUG2("dual_updated (%d) : %1.20f",dual_updated,fabs(cnst->new_lambda-cnst->lambda)); */
- DEBUG3("Updating lambda : cnst->lambda (%p) : %1.20f -> %1.20f",
+/* XBT_DEBUG("dual_updated (%d) : %1.20f",dual_updated,fabs(cnst->new_lambda-cnst->lambda)); */
+ XBT_DEBUG("Updating lambda : cnst->lambda (%p) : %1.20f -> %1.20f",
cnst, cnst->lambda, cnst->new_lambda);
cnst->lambda = cnst->new_lambda;
new_obj = dual_objective(var_list, cnst_list);
- DEBUG3("Improvement for Objective (%g -> %g) : %g", obj, new_obj,
+ XBT_DEBUG("Improvement for Objective (%g -> %g) : %g", obj, new_obj,
obj - new_obj);
xbt_assert1(obj - new_obj >= -epsilon_min_error,
"Our gradient sucks! (%1.20f)", obj - new_obj);
* Now computes the values of each variable (\rho) based on
* the values of \lambda and \mu.
*/
- DEBUG0("-------------- Check convergence ----------");
+ XBT_DEBUG("-------------- Check convergence ----------");
overall_modification = 0;
xbt_swag_foreach(var, var_list) {
if (var->weight <= 0)
MAX(overall_modification, fabs(var->value - tmp));
var->value = tmp;
- DEBUG3("New value of var (%p) = %e, overall_modification = %e",
+ XBT_DEBUG("New value of var (%p) = %e, overall_modification = %e",
var, var->value, overall_modification);
}
}
- DEBUG0("-------------- Check feasability ----------");
+ XBT_DEBUG("-------------- Check feasability ----------");
if (!__check_feasible(cnst_list, var_list, 0))
overall_modification = 1.0;
- DEBUG2("Iteration %d: overall_modification : %f", iteration,
+ XBT_DEBUG("Iteration %d: overall_modification : %f", iteration,
overall_modification);
/* if(!dual_updated) { */
-/* WARN1("Could not improve the convergence at iteration %d. Drop it!",iteration); */
+/* XBT_WARN("Could not improve the convergence at iteration %d. Drop it!",iteration); */
/* break; */
/* } */
}
__check_feasible(cnst_list, var_list, 1);
if (overall_modification <= epsilon_min_error) {
- DEBUG1("The method converges in %d iterations.", iteration);
+ XBT_DEBUG("The method converges in %d iterations.", iteration);
}
if (iteration >= max_iterations) {
- DEBUG1
+ XBT_DEBUG
("Method reach %d iterations, which is the maximum number of iterations allowed.",
iteration);
}
-/* INFO1("Method converged after %d iterations", iteration); */
+/* XBT_INFO("Method converged after %d iterations", iteration); */
if (XBT_LOG_ISENABLED(surf_lagrange, xbt_log_priority_debug)) {
lmm_print(sys);
overall_error = 1;
if ((diff_0 = diff(1e-16, var_cnst)) >= 0) {
- CDEBUG1(surf_lagrange_dichotomy, "returning 0.0 (diff = %e)", diff_0);
+ XBT_CDEBUG(surf_lagrange_dichotomy, "returning 0.0 (diff = %e)", diff_0);
XBT_OUT;
return 0.0;
}
max_diff = diff(max, var_cnst);
while (overall_error > min_error) {
- CDEBUG4(surf_lagrange_dichotomy,
+ XBT_CDEBUG(surf_lagrange_dichotomy,
"[min, max] = [%1.20f, %1.20f] || diffmin, diffmax = %1.20f, %1.20f",
min, max, min_diff, max_diff);
if (min_diff > 0 && max_diff > 0) {
if (min == max) {
- CDEBUG0(surf_lagrange_dichotomy, "Decreasing min");
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Decreasing min");
min = min / 2.0;
min_diff = diff(min, var_cnst);
} else {
- CDEBUG0(surf_lagrange_dichotomy, "Decreasing max");
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Decreasing max");
max = min;
max_diff = min_diff;
}
} else if (min_diff < 0 && max_diff < 0) {
if (min == max) {
- CDEBUG0(surf_lagrange_dichotomy, "Increasing max");
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Increasing max");
max = max * 2.0;
max_diff = diff(max, var_cnst);
} else {
- CDEBUG0(surf_lagrange_dichotomy, "Increasing min");
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Increasing min");
min = max;
min_diff = max_diff;
}
} else if (min_diff < 0 && max_diff > 0) {
middle = (max + min) / 2.0;
- CDEBUG1(surf_lagrange_dichotomy, "Trying (max+min)/2 : %1.20f",
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Trying (max+min)/2 : %1.20f",
middle);
if ((min == middle) || (max == middle)) {
- CWARN4(surf_lagrange_dichotomy,
+ XBT_CWARN(surf_lagrange_dichotomy,
"Cannot improve the convergence! min=max=middle=%1.20f, diff = %1.20f."
" Reaching the 'double' limits. Maybe scaling your function would help ([%1.20f,%1.20f]).",
min, max - min, min_diff, max_diff);
middle_diff = diff(middle, var_cnst);
if (middle_diff < 0) {
- CDEBUG0(surf_lagrange_dichotomy, "Increasing min");
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Increasing min");
min = middle;
overall_error = max_diff - middle_diff;
min_diff = middle_diff;
/* SHOW_EXPR(overall_error); */
} else if (middle_diff > 0) {
- CDEBUG0(surf_lagrange_dichotomy, "Decreasing max");
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Decreasing max");
max = middle;
overall_error = max_diff - middle_diff;
max_diff = middle_diff;
overall_error = 0;
/* SHOW_EXPR(overall_error); */
} else if (min_diff > 0 && max_diff < 0) {
- CWARN0(surf_lagrange_dichotomy,
+ XBT_CWARN(surf_lagrange_dichotomy,
"The impossible happened, partial_diff(min) > 0 && partial_diff(max) < 0");
abort();
} else {
- CWARN2(surf_lagrange_dichotomy,
+ XBT_CWARN(surf_lagrange_dichotomy,
"diffmin (%1.20f) or diffmax (%1.20f) are something I don't know, taking no action.",
min_diff, max_diff);
abort();
}
}
- CDEBUG1(surf_lagrange_dichotomy, "returning %e", (min + max) / 2.0);
+ XBT_CDEBUG(surf_lagrange_dichotomy, "returning %e", (min + max) / 2.0);
XBT_OUT;
return ((min + max) / 2.0);
}
XBT_IN;
elem_list = &(cnst->element_set);
- CDEBUG1(surf_lagrange_dichotomy, "Computing diff of cnst (%p)", cnst);
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Computing diff of cnst (%p)", cnst);
xbt_swag_foreach(elem, elem_list) {
var = elem->variable;
if (var->weight <= 0)
continue;
- CDEBUG1(surf_lagrange_dichotomy, "Computing sigma_i for var (%p)",
+ XBT_CDEBUG(surf_lagrange_dichotomy, "Computing sigma_i for var (%p)",
var);
// Initialize the summation variable
sigma_i = 0.0;
diff += cnst->bound;
- CDEBUG3(surf_lagrange_dichotomy,
+ XBT_CDEBUG(surf_lagrange_dichotomy,
"d D/d lambda for cnst (%p) at %1.20f = %1.20f", cnst, lambda,
diff);
XBT_OUT;
l->modified = 0;
l->selective_update_active = sg_maxmin_selective_update;
- DEBUG1("Setting selective_update_active flag to %d\n",
+ XBT_DEBUG("Setting selective_update_active flag to %d\n",
l->selective_update_active);
xbt_swag_init(&(l->variable_set),
lmm_constraint_t cnst = NULL;
while ((var = extract_variable(sys))) {
- WARN2
+ XBT_WARN
("Variable %p (%d) still in LMM system when freing it: this may be a bug",
var, var->id_int);
lmm_var_free(sys, var);
int i;
lmm_element_t elem = NULL;
- XBT_IN2("(sys=%p, var=%p)", sys, var);
+ XBT_IN_F("(sys=%p, var=%p)", sys, var);
sys->modified = 1;
for (i = 0; i < var->cnsts_number; i++) {
lmm_variable_t var = NULL;
int i;
- XBT_IN5("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)",
+ XBT_IN_F("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)",
sys, id, weight, bound, number_of_constraints);
var = xbt_mallocator_get(sys->variable_mallocator);
{
lmm_constraint_t useless_cnst = NULL;
- XBT_IN3("sys=%p, cnst=%p, min_usage=%f", sys, cnst, *min_usage);
+ XBT_IN_F("sys=%p, cnst=%p, min_usage=%f", sys, cnst, *min_usage);
if (cnst->usage <= 0) {
XBT_OUT;
return;
}
if ((*min_usage < 0) || (*min_usage > cnst->remaining / cnst->usage)) {
*min_usage = cnst->remaining / cnst->usage;
- LOG3(xbt_log_priority_trace,
+ XBT_LOG(xbt_log_priority_trace,
"min_usage=%f (cnst->remaining=%f, cnst->usage=%f)", *min_usage,
cnst->remaining, cnst->usage);
while ((useless_cnst =
xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
strcat(trace_buf, print_buf);
fprintf(stderr, "%s", trace_buf);
- //DEBUG1("%20s", trace_buf); FIXME
+ //XBT_DEBUG("%20s", trace_buf); FIXME
trace_buf[0] = '\000';
- DEBUG0("Constraints");
+ XBT_DEBUG("Constraints");
/* Printing Constraints */
cnst_list = &(sys->active_constraint_set);
xbt_swag_foreach(cnst, cnst_list) {
strlen(trace_buf) + strlen(print_buf) + 1);
strcat(trace_buf, print_buf);
}
- // DEBUG1("%s", trace_buf);
+ // XBT_DEBUG("%s", trace_buf);
fprintf(stderr, "%s\n", trace_buf);
trace_buf[0] = '\000';
xbt_assert3(!double_positive(sum - cnst->bound),
sum, cnst->bound, sum - cnst->bound);
}
- DEBUG0("Variables");
+ XBT_DEBUG("Variables");
/* Printing Result */
xbt_swag_foreach(var, var_list) {
if (var->bound > 0) {
- DEBUG4("'%d'(%f) : %f (<=%f)", var->id_int, var->weight, var->value,
+ XBT_DEBUG("'%d'(%f) : %f (<=%f)", var->id_int, var->weight, var->value,
var->bound);
xbt_assert2(!double_positive(var->value - var->bound),
"Incorrect value (%f is not smaller than %f",
var->value, var->bound);
} else {
- DEBUG3("'%d'(%f) : %f", var->id_int, var->weight, var->value);
+ XBT_DEBUG("'%d'(%f) : %f", var->id_int, var->weight, var->value);
}
}
if (!(sys->modified))
return;
- XBT_IN1("(sys=%p)", sys);
+ XBT_IN_F("(sys=%p)", sys);
/*
* Compute Usage and store the variables that reach the maximum.
selective_update_active ? &(sys->modified_constraint_set) :
&(sys->active_constraint_set);
- DEBUG1("Active constraints : %d", xbt_swag_size(cnst_list));
+ XBT_DEBUG("Active constraints : %d", xbt_swag_size(cnst_list));
/* Init: Only modified code portions */
xbt_swag_foreach(cnst, cnst_list) {
elem_list = &(cnst->element_set);
- //DEBUG1("Variable set : %d", xbt_swag_size(elem_list));
+ //XBT_DEBUG("Variable set : %d", xbt_swag_size(elem_list));
xbt_swag_foreach(elem, elem_list) {
var = elem->variable;
if (var->weight <= 0.0)
}
}
}
- DEBUG2("Constraint Usage '%d' : %f", cnst->id_int, cnst->usage);
+ XBT_DEBUG("Constraint Usage '%d' : %f", cnst->id_int, cnst->usage);
/* Saturated constraints update */
saturated_constraint_set_update(sys, cnst, &min_usage);
}
DIE_IMPOSSIBLE;
/* First check if some of these variables have reach their upper
bound and update min_usage accordingly. */
- DEBUG5
+ XBT_DEBUG
("var=%d, var->bound=%f, var->weight=%f, min_usage=%f, var->bound*var->weight=%f",
var->id_int, var->bound, var->weight, min_usage,
var->bound * var->weight);
min_bound = var->bound;
else
min_bound = MIN(min_bound, var->bound);
- DEBUG1("Updated min_bound=%f", min_bound);
+ XBT_DEBUG("Updated min_bound=%f", min_bound);
}
}
continue;
}
}
- DEBUG5("Min usage: %f, Var(%d)->weight: %f, Var(%d)->value: %f ",
+ XBT_DEBUG("Min usage: %f, Var(%d)->weight: %f, Var(%d)->value: %f ",
min_usage, var->id_int, var->weight, var->id_int, var->value);
if ((elem->value > 0)) {
cnst->usage =
MAX(cnst->usage, elem->value / elem->variable->weight);
- DEBUG2("Constraint Usage %d : %f", cnst->id_int,
+ XBT_DEBUG("Constraint Usage %d : %f", cnst->id_int,
cnst->usage);
make_elem_active(elem);
}
if (weight == var->weight)
return;
- XBT_IN3("(sys=%p, var=%p, weight=%f)", sys, var, weight);
+ XBT_IN_F("(sys=%p, var=%p, weight=%f)", sys, var, weight);
sys->modified = 1;
var->weight = weight;
xbt_swag_remove(var, &(sys->variable_set));
if (!sys->selective_update_active)
return;
- //DEBUG1("Updating modified constraint set with constraint %d", cnst->id_int);
+ //XBT_DEBUG("Updating modified constraint set with constraint %d", cnst->id_int);
if (xbt_swag_belongs(cnst, &(sys->modified_constraint_set)))
return;
- //DEBUG1("Inserting into modified constraint set %d", cnst->id_int);
+ //XBT_DEBUG("Inserting into modified constraint set %d", cnst->id_int);
/* add to modified set */
xbt_swag_insert(cnst, &(sys->modified_constraint_set));
var = elem->variable;
for (i = 0; i < var->cnsts_number; i++)
if (cnst != var->cnsts[i].constraint) {
- //DEBUG2("Updating modified %d calling for %d", cnst->id_int, var->cnsts[i].constraint->id_int);
+ //XBT_DEBUG("Updating modified %d calling for %d", cnst->id_int, var->cnsts[i].constraint->id_int);
lmm_update_modified_set(sys, var->cnsts[i].constraint);
}
}
e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
tmgr_trace_t state_trace;
- DEBUG0("link_CM02");
+ XBT_DEBUG("link_CM02");
name_link = xbt_strdup(A_surfxml_link_id);
surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
}
}
- DEBUG1("Min of share resources %f", min);
+ XBT_DEBUG("Min of share resources %f", min);
return min;
}
action->lat_current)));
if (action->rate < sg_tcp_gamma / (2.0 * action->lat_current)) {
- INFO0("Flow is limited BYBANDWIDTH");
+ XBT_INFO("Flow is limited BYBANDWIDTH");
} else {
- INFO1("Flow is limited BYLATENCY, latency of flow is %f",
+ XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f",
action->lat_current);
}
}
if (tmgr_trace_event_free(event_type))
nw_link->lmm_resource.state_event = NULL;
} else {
- CRITICAL0("Unknown event ! \n");
+ XBT_CRITICAL("Unknown event ! \n");
xbt_abort();
}
/* LARGE PLATFORMS HACK:
total_route_size = route_size + src->link_nb + dst->nb */
- XBT_IN4("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
+ XBT_IN_F("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
/* LARGE PLATFORMS HACK:
assert on total_route_size */
latency = global_routing->get_latency(src_name,dst_name);
if(xbt_dynar_length(route) > 0) {
link = *(link_CM02_t*)xbt_dynar_get_ptr(route, 0);
gap_append(size, link, action);
- DEBUG5("Comm %p: %s -> %s gap=%f (lat=%f)",
+ XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)",
action, src_name, dst_name, action->sender.gap, action->latency);
} else {
gap_unknown(action);
}
if (sg_network_fullduplex == 1) {
- DEBUG1("Fullduplex active adding backward flow using 5%c", '%');
+ XBT_DEBUG("Fullduplex active adding backward flow using 5%c", '%');
xbt_dynar_foreach(back_route, i, link) {
lmm_expand(network_maxmin_system, link->lmm_resource.constraint,
action->variable, .05);
{
surf_action_network_Constant_t action = NULL;
- XBT_IN4("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
+ XBT_IN_F("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
action =
surf_action_new(sizeof(s_surf_action_network_Constant_t), size,
return;
}
- DEBUG1("Scanning link name %s", name);
+ XBT_DEBUG("Scanning link name %s", name);
gtnets_link = xbt_new0(s_network_link_GTNETS_t, 1);
link_count++;
- DEBUG4("Adding new link, linkid %d, name %s, latency %g, bandwidth %g",
+ XBT_DEBUG("Adding new link, linkid %d, name %s, latency %g, bandwidth %g",
link_count, name, lat, bw);
if (gtnets_add_link(link_count, bw, lat)) {
int i = 0;
int *gtnets_links;
- XBT_IN4("(src_id=%d, dst_id=%d, links=%p, nb_link=%d)",
+ XBT_IN_F("(src_id=%d, dst_id=%d, links=%p, nb_link=%d)",
src_id, dst_id, links, nb_link);
/* Build the list of gtnets link IDs */
surf_parse_get_double(&bw, A_surfxml_link_bandwidth);
surf_parse_get_double(&lat, A_surfxml_link_latency);
state = SURF_RESOURCE_ON;
- DEBUG0("link_gtnets");
+ XBT_DEBUG("link_gtnets");
tmgr_trace_t bw_trace;
tmgr_trace_t state_trace;
tmgr_trace_t lat_trace;
state_trace = tmgr_trace_new(A_surfxml_link_state_file);
if (bw_trace)
- INFO0
+ XBT_INFO
("The GTNetS network model doesn't support bandwidth state traces");
if (lat_trace)
- INFO0("The GTNetS network model doesn't support latency state traces");
+ XBT_INFO("The GTNetS network model doesn't support latency state traces");
if (state_trace)
- INFO0("The GTNetS network model doesn't support link state traces");
+ XBT_INFO("The GTNetS network model doesn't support link state traces");
current_property_set = xbt_dict_new();
if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX)
{
int src_id,dst_id;
- DEBUG0("Starting topology generation");
+ XBT_DEBUG("Starting topology generation");
// À refaire plus tard. Il faut prendre la liste des hôtes/routeurs (dans routing)
// À partir de cette liste, on les numérote.
// Ensuite, on peut utiliser les id pour refaire les appels GTNets qui suivent.
dst_id = *((int *) xbt_dict_get_or_null(global_routing->root->to_index,dst));
if(src_id != dst_id){
- DEBUG5("Link (#%p), src (#%s), dst (#%s), src_id = %d, dst_id = %d", link,src,dst, src_id, dst_id);
- DEBUG0("Calling one link route");
+ XBT_DEBUG("Link (#%p), src (#%s), dst (#%s), src_id = %d, dst_id = %d", link,src,dst, src_id, dst_id);
+ XBT_DEBUG("Calling one link route");
if(global_routing->get_network_element_type(src) == SURF_NETWORK_ELEMENT_ROUTER){
gtnets_add_router(src_id);
}
xbt_assert0(time_to_next_flow_completion,
"Time to next flow completion not initialized!\n");
- DEBUG0("Calling gtnets_get_time_to_next_flow_completion");
+ XBT_DEBUG("Calling gtnets_get_time_to_next_flow_completion");
time_to_next_flow_completion = gtnets_get_time_to_next_flow_completion();
- DEBUG1("gtnets_get_time_to_next_flow_completion received %lg",
+ XBT_DEBUG("gtnets_get_time_to_next_flow_completion received %lg",
time_to_next_flow_completion);
return time_to_next_flow_completion;
}
xbt_swag_foreach(action, running_actions) {
- DEBUG2("Action (%p) remains old value: %f", action,
+ XBT_DEBUG("Action (%p) remains old value: %f", action,
action->generic_action.remains);
double sent = gtnets_get_flow_rx(action);
// }
#endif
- DEBUG1("Sent value returned by GTNetS : %f", sent);
+ XBT_DEBUG("Sent value returned by GTNetS : %f", sent);
//need to trust this remain value
if (sent == 0) {
action->generic_action.remains = 0;
action->generic_action.remains =
action->generic_action.cost - sent;
}
- DEBUG2("Action (%p) remains new value: %f", action,
+ XBT_DEBUG("Action (%p) remains new value: %f", action,
action->generic_action.remains);
}
TRACE_surf_gtnets_destroy(action);
#endif
action_state_set((surf_action_t) action, SURF_ACTION_DONE);
- DEBUG1("----> Action (%p) just terminated", action);
+ XBT_DEBUG("----> Action (%p) just terminated", action);
}
xbt_assert0((src >= 0
&& dst >= 0), "Either src or dst have invalid id (id<0)");
- DEBUG4("Setting flow src %d \"%s\", dst %d \"%s\"", src, src_name, dst,
+ XBT_DEBUG("Setting flow src %d \"%s\", dst %d \"%s\"", src, src_name, dst,
dst_name);
xbt_dynar_t links = global_routing->get_route(src_name, dst_name);
e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
tmgr_trace_t state_trace;
- DEBUG0("link_CM02_im");
+ XBT_DEBUG("link_CM02_im");
name_link = xbt_strdup(A_surfxml_link_id);
surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
double min=-1;
double value;
- DEBUG1("Before share resources, the size of modified actions set is %d", xbt_swag_size(im_net_modified_set));
+ XBT_DEBUG("Before share resources, the size of modified actions set is %d", xbt_swag_size(im_net_modified_set));
update_action_remaining(now);
lmm_solve(network_im_maxmin_system);
- DEBUG1("After share resources, The size of modified actions set is %d", xbt_swag_size(im_net_modified_set));
+ XBT_DEBUG("After share resources, The size of modified actions set is %d", xbt_swag_size(im_net_modified_set));
xbt_swag_foreach(action, im_net_modified_set) {
if (GENERIC_ACTION(action).state_set != surf_network_model->states.running_action_set){
GENERIC_ACTION(action).max_duration;
}
- DEBUG4("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
+ XBT_DEBUG("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
GENERIC_ACTION(action).start, now + value,
GENERIC_ACTION(action).max_duration);
if (min != -1) {
heap_insert((surf_action_network_CM02_im_t) action, min, NORMAL);
- DEBUG3("Insert at heap action(%p) min %lf now %lf", action, min, now);
+ XBT_DEBUG("Insert at heap action(%p) min %lf now %lf", action, min, now);
}
}
min = -1;
}
- DEBUG1("The minimum with the HEAP %lf", min);
+ XBT_DEBUG("The minimum with the HEAP %lf", min);
return min;
while ((xbt_heap_size(im_net_action_heap) > 0)
&& (double_equals(xbt_heap_maxkey(im_net_action_heap), now))) {
action = xbt_heap_pop(im_net_action_heap);
- DEBUG1("Action %p: finish", action);
+ XBT_DEBUG("Action %p: finish", action);
GENERIC_ACTION(action).finish = surf_get_clock();
// if I am wearing a latency heat
heap_remove(action);
action->last_update = surf_get_clock();
- DEBUG1("Action (%p) is not limited by latency anymore", action);
+ XBT_DEBUG("Action (%p) is not limited by latency anymore", action);
#ifdef HAVE_LATENCY_BOUND_TRACKING
GENERIC_ACTION(action).latency_limited = 0;
#endif
action->lat_current)));
if (action->rate < sg_tcp_gamma / (2.0 * action->lat_current)) {
- INFO0("Flow is limited BYBANDWIDTH");
+ XBT_INFO("Flow is limited BYBANDWIDTH");
} else {
- INFO1("Flow is limited BYLATENCY, latency of flow is %f",
+ XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f",
action->lat_current);
}
}
if (tmgr_trace_event_free(event_type))
nw_link->lmm_resource.state_event = NULL;
} else {
- CRITICAL0("Unknown event ! \n");
+ XBT_CRITICAL("Unknown event ! \n");
xbt_abort();
}
- DEBUG1("There were a resource state event, need to update actions related to the constraint (%p)", nw_link->lmm_resource.constraint);
+ XBT_DEBUG("There were a resource state event, need to update actions related to the constraint (%p)", nw_link->lmm_resource.constraint);
return;
}
/* LARGE PLATFORMS HACK:
total_route_size = route_size + src->link_nb + dst->nb */
- XBT_IN4("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
+ XBT_IN_F("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
/* LARGE PLATFORMS HACK:
assert on total_route_size */
xbt_assert2(xbt_dynar_length(route),
lmm_variable_new(network_im_maxmin_system, action, 0.0, -1.0,
constraints_per_variable);
// add to the heap the event when the latency is payed
- DEBUG2("Added action (%p) one latency event at date %f", action, action->latency + action->last_update);
+ XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency + action->last_update);
heap_insert(action, action->latency + action->last_update, LATENCY);
#ifdef HAVE_LATENCY_BOUND_TRACKING
(action->generic_action).latency_limited = 1;
}
if (sg_network_fullduplex == 1) {
- DEBUG1("Fullduplex active adding backward flow using 5%c", '%');
+ XBT_DEBUG("Fullduplex active adding backward flow using 5%c", '%');
xbt_dynar_foreach(back_route, i, link) {
lmm_expand(network_im_maxmin_system, link->lmm_resource.constraint,
action->variable, .05);
static void im_surf_network_model_init_internal(void)
{
s_surf_action_network_CM02_im_t comm;
- INFO0("You are using the UNSAFE lazy management optimization, I hope you know what you are doing.");
- INFO0("====> For now this optimization is only available for LV08_im network model.");
+ XBT_INFO("You are using the UNSAFE lazy management optimization, I hope you know what you are doing.");
+ XBT_INFO("====> For now this optimization is only available for LV08_im network model.");
surf_network_model = surf_model_init();
value = 0.0;
if (value < min) {
min = value;
- DEBUG2("Updating min (value) with %p: %f", action, min);
+ XBT_DEBUG("Updating min (value) with %p: %f", action, min);
}
}
if ((action->max_duration >= 0) && (action->max_duration < min)) {
min = action->max_duration;
- DEBUG2("Updating min (duration) with %p: %f", action, min);
+ XBT_DEBUG("Updating min (duration) with %p: %f", action, min);
}
}
- DEBUG1("min value : %f", min);
+ XBT_DEBUG("min value : %f", min);
#undef VARIABLE
return min;
surf_model_t model = NULL;
unsigned int iter;
- DEBUG0
+ XBT_DEBUG
("First Run! Let's \"purge\" events and put models in the right state");
while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
if (next_event_date > NOW)
min = max_date - NOW;
}
- DEBUG0("Looking for next action end");
+ XBT_DEBUG("Looking for next action end");
xbt_dynar_foreach(model_list, iter, model) {
- DEBUG1("Running for Resource [%s]", model->name);
+ XBT_DEBUG("Running for Resource [%s]", model->name);
model_next_action_end = model->model_private->share_resources(NOW);
- DEBUG2("Resource [%s] : next action end = %f",
+ XBT_DEBUG("Resource [%s] : next action end = %f",
model->name, model_next_action_end);
if (((min < 0.0) || (model_next_action_end < min))
&& (model_next_action_end >= 0.0))
min = model_next_action_end;
}
- DEBUG1("Next action end : %f", min);
+ XBT_DEBUG("Next action end : %f", min);
- DEBUG0("Looking for next event");
+ XBT_DEBUG("Looking for next event");
while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
- DEBUG1("Next TRACE event : %f", next_event_date);
+ XBT_DEBUG("Next TRACE event : %f", next_event_date);
if ((min != -1.0) && (next_event_date > NOW + min))
break;
- DEBUG0("Updating models");
+ XBT_DEBUG("Updating models");
while ((event =
tmgr_history_get_next_event_leq(history, next_event_date,
&value,
(void **) &resource))) {
if (resource->model->model_private->resource_used(resource)) {
min = next_event_date - NOW;
- DEBUG1
+ XBT_DEBUG
("This event will modify model state. Next event set to %f",
min);
}
/* update state of model_obj according to new value. Does not touch lmm.
It will be modified if needed when updating actions */
- DEBUG2("Calling update_resource_state for resource %s with min %lf",
+ XBT_DEBUG("Calling update_resource_state for resource %s with min %lf",
resource->model->name, min);
resource->model->model_private->update_resource_state(resource,
event, value,
if (min < 0.0)
return -1.0;
- DEBUG1("Duration set to %f", min);
+ XBT_DEBUG("Duration set to %f", min);
NOW = NOW + min;
e_surf_action_state_t state)
{
surf_action_state_t action_state = &(action->model_type->states);
- XBT_IN2("(%p,%s)", action, surf_action_state_names[state]);
+ XBT_IN_F("(%p,%s)", action, surf_action_state_names[state]);
xbt_swag_remove(action, action->state_set);
if (state == SURF_ACTION_READY)
opt++;
xbt_cfg_set_parse(_surf_cfg_set, opt);
- DEBUG1("Did apply '%s' as config setting", opt);
+ XBT_DEBUG("Did apply '%s' as config setting", opt);
remove_it = 1;
} else if (!strncmp(argv[i], "--cfg-help", strlen("--cfg-help") + 1) ||
!strncmp(argv[i], "--help", strlen("--help") + 1)) {
surf_config_cmd_line(argc, argv);
} else {
- WARN0("Call to surf_config_init() after initialization ignored");
+ XBT_WARN("Call to surf_config_init() after initialization ignored");
}
}
|| strcmp(cpu_model_name, "Cas01"))
&& !strcmp(workstation_model_name, "CLM03")) {
const char *val = "compound";
- INFO0
+ XBT_INFO
("Switching workstation model to compound since you changed the network and/or cpu model(s)");
xbt_cfg_set_string(_surf_cfg_set, "workstation/model", val);
workstation_model_name = (char *) "compound";
}
- DEBUG1("Workstation model: %s", workstation_model_name);
+ XBT_DEBUG("Workstation model: %s", workstation_model_name);
workstation_id =
find_model_description(surf_workstation_model_description,
workstation_model_name);
(platform_file);
}
- DEBUG0("Call workstation_model_init");
+ XBT_DEBUG("Call workstation_model_init");
surf_workstation_model_description[workstation_id].model_init_preparse
(platform_file);
}
char *elem;
xbt_dict_foreach(current_property_set, cursor, key, elem) {
- DEBUG2("property : %s = %s",key,elem);
+ XBT_DEBUG("property : %s = %s",key,elem);
}
}
parse_S_AS(A_surfxml_AS_id, A_surfxml_AS_routing);
if (strcmp(A_surfxml_AS_coordinates,"")) {
- DEBUG2("%s coordinates : %s",A_surfxml_AS_id,A_surfxml_AS_coordinates);
+ XBT_DEBUG("%s coordinates : %s",A_surfxml_AS_id,A_surfxml_AS_coordinates);
xbt_dynar_t ctn = xbt_str_split_str(A_surfxml_AS_coordinates, " ");
xbt_dynar_shrink(ctn,0);
xbt_dict_set (coordinates,A_surfxml_AS_id,ctn,NULL);
void *link;
unsigned int cpt = 0;
- DEBUG2("Solve route \"%s\" to \"%s\"", src, dst);
+ XBT_DEBUG("Solve route \"%s\" to \"%s\"", src, dst);
xbt_assert0(src && dst, "bad parameters for \"_get_route\" method");
{
double latency, latency_src, latency_dst = 0.0;
- DEBUG2("Solve route \"%s\" to \"%s\"", src, dst);
+ XBT_DEBUG("Solve route \"%s\" to \"%s\"", src, dst);
xbt_assert0(src && dst, "bad parameters for \"_get_route\" method");
route_extended_t e_route_cnt;
else
{
if(!route->dst_gateway && !route->src_gateway)
- DEBUG2("Load Route from \"%s\" to \"%s\"", src, dst);
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
else
- DEBUG4("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
route->src_gateway, dst, route->dst_gateway);
TO_ROUTE_FULL(*src_id, *dst_id) = generic_new_extended_route(rc->hierarchy,route,1);
xbt_dynar_shrink(TO_ROUTE_FULL(*src_id, *dst_id)->generic_route.link_list, 0);
else
{
if(!route->dst_gateway && !route->src_gateway)
- DEBUG2("Load Route from \"%s\" to \"%s\"", dst, src);
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
else
- DEBUG4("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
route->src_gateway, src, route->dst_gateway);
TO_ROUTE_FULL(*dst_id, *src_id) = generic_new_extended_route(rc->hierarchy,route,0);
xbt_dynar_shrink(TO_ROUTE_FULL(*dst_id, *src_id)->generic_route.link_list, 0);
if(TO_FLOYD_LINK(*src_id, *dst_id))
{
if(!route->dst_gateway && !route->src_gateway)
- DEBUG2("See Route from \"%s\" to \"%s\"", src, dst);
+ XBT_DEBUG("See Route from \"%s\" to \"%s\"", src, dst);
else
- DEBUG4("See ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+ XBT_DEBUG("See ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
route->src_gateway, dst, route->dst_gateway);
char * link_name;
unsigned int cpt;
else
{
if(!route->dst_gateway && !route->src_gateway)
- DEBUG2("Load Route from \"%s\" to \"%s\"", src, dst);
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
else
- DEBUG4("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
route->src_gateway, dst, route->dst_gateway);
TO_FLOYD_LINK(*src_id, *dst_id) =
if(TO_FLOYD_LINK(*dst_id, *src_id))
{
if(!route->dst_gateway && !route->src_gateway)
- DEBUG2("See Route from \"%s\" to \"%s\"", dst, src);
+ XBT_DEBUG("See Route from \"%s\" to \"%s\"", dst, src);
else
- DEBUG4("See ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
+ XBT_DEBUG("See ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
route->src_gateway, src, route->dst_gateway);
char * link_name;
unsigned int i;
}
if(!route->dst_gateway && !route->src_gateway)
- DEBUG2("Load Route from \"%s\" to \"%s\"", dst, src);
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
else
- DEBUG4("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
route->src_gateway, src, route->dst_gateway);
TO_FLOYD_LINK(*dst_id, *src_id) =
int dst_id, route_extended_t e_route)
{
routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
- DEBUG2("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
+ XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
xbt_node_t src = NULL;
xbt_node_t dst = NULL;
xbt_die("Route symmetrical not supported on model dijkstra");
if(!route->dst_gateway && !route->src_gateway)
- DEBUG2("Load Route from \"%s\" to \"%s\"", src, dst);
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
else
- DEBUG4("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+ XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
route->src_gateway, dst, route->dst_gateway);
route_extended_t e_route =
static void generic_set_processing_unit(routing_component_t rc,
const char *name)
{
- DEBUG1("Load process unit \"%s\"", name);
+ XBT_DEBUG("Load process unit \"%s\"", name);
int *id = xbt_new0(int, 1);
xbt_dict_t _to_index;
_to_index = current_routing->to_index;
static void generic_set_autonomous_system(routing_component_t rc,
const char *name)
{
- DEBUG1("Load Autonomous system \"%s\"", name);
+ XBT_DEBUG("Load Autonomous system \"%s\"", name);
int *id = xbt_new0(int, 1);
xbt_dict_t _to_index;
_to_index = current_routing->to_index;
const char *src, const char *dst,
route_extended_t e_route)
{
- DEBUG2("Load bypassRoute from \"%s\" to \"%s\"", src, dst);
+ XBT_DEBUG("Load bypassRoute from \"%s\" to \"%s\"", src, dst);
xbt_dict_t dict_bypassRoutes = rc->bypassRoutes;
char *route_name;
static void routing_parse_Sconfig(void)
{
- DEBUG1("START configuration name = %s",A_surfxml_config_id);
+ XBT_DEBUG("START configuration name = %s",A_surfxml_config_id);
}
static void routing_parse_Econfig(void)
if(xbt_cfg_is_default_value(_surf_cfg_set, key))
xbt_cfg_set_parse(_surf_cfg_set, cfg);
else
- INFO1("The custom configuration '%s' is already define by user!",key);
+ XBT_INFO("The custom configuration '%s' is already define by user!",key);
}
- DEBUG1("End configuration name = %s",A_surfxml_config_id);
+ XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
}
static void routing_parse_Scluster(void)
SURFXML_BUFFER_SET(AS_id, cluster_id);
#ifdef HAVE_PCRE_LIB
SURFXML_BUFFER_SET(AS_routing, "RuleBased");
- DEBUG1("<AS id=\"%s\"\trouting=\"RuleBased\">", cluster_id);
+ XBT_DEBUG("<AS id=\"%s\"\trouting=\"RuleBased\">", cluster_id);
#else
SURFXML_BUFFER_SET(AS_routing, "Full");
- DEBUG1("<AS id=\"%s\"\trouting=\"Full\">", cluster_id);
+ XBT_DEBUG("<AS id=\"%s\"\trouting=\"Full\">", cluster_id);
#endif
SURFXML_START_TAG(AS);
xbt_dict_set(patterns,"radical",bprintf("%d",start),NULL);
temp_cluster_power = bprintf("%s",cluster_power);
temp_cluster_power = bprintf("%s",replace_random_parameter(temp_cluster_power));
- DEBUG2("<host\tid=\"%s\"\tpower=\"%s\">", host_id, temp_cluster_power);
+ XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, temp_cluster_power);
A_surfxml_host_state = A_surfxml_host_state_ON;
SURFXML_BUFFER_SET(host_id, host_id);
SURFXML_BUFFER_SET(host_power, temp_cluster_power);
SURFXML_BUFFER_SET(host_availability, "1.0");
availability_file = bprintf("%s",cluster_availability_file);
state_file = bprintf("%s",cluster_state_file);
- DEBUG1("\tavailability_file=\"%s\"",xbt_str_varsubst(availability_file,patterns));
- DEBUG1("\tstate_file=\"%s\"",xbt_str_varsubst(state_file,patterns));
+ XBT_DEBUG("\tavailability_file=\"%s\"",xbt_str_varsubst(availability_file,patterns));
+ XBT_DEBUG("\tstate_file=\"%s\"",xbt_str_varsubst(state_file,patterns));
SURFXML_BUFFER_SET(host_availability_file, xbt_str_varsubst(availability_file,patterns));
SURFXML_BUFFER_SET(host_state_file, xbt_str_varsubst(state_file,patterns));
- DEBUG0("</host>");
+ XBT_DEBUG("</host>");
SURFXML_START_TAG(host);
SURFXML_END_TAG(host);
temp_cluster_bw = bprintf("%s",replace_random_parameter(temp_cluster_bw));
temp_cluster_lat = bprintf("%s",cluster_lat);
temp_cluster_lat = bprintf("%s",replace_random_parameter(temp_cluster_lat));
- DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,temp_cluster_bw, cluster_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,temp_cluster_bw, cluster_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
xbt_dict_set(patterns,"radical",bprintf("%d",i),NULL);
temp_cluster_power = bprintf("%s",cluster_power);
temp_cluster_power = bprintf("%s",replace_random_parameter(temp_cluster_power));
- DEBUG2("<host\tid=\"%s\"\tpower=\"%s\">", host_id, temp_cluster_power);
+ XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\">", host_id, temp_cluster_power);
A_surfxml_host_state = A_surfxml_host_state_ON;
SURFXML_BUFFER_SET(host_id, host_id);
SURFXML_BUFFER_SET(host_power, temp_cluster_power);
SURFXML_BUFFER_SET(host_availability, "1.0");
availability_file = bprintf("%s",cluster_availability_file);
state_file = bprintf("%s",cluster_state_file);
- DEBUG1("\tavailability_file=\"%s\"",xbt_str_varsubst(availability_file,patterns));
- DEBUG1("\tstate_file=\"%s\"",xbt_str_varsubst(state_file,patterns));
+ XBT_DEBUG("\tavailability_file=\"%s\"",xbt_str_varsubst(availability_file,patterns));
+ XBT_DEBUG("\tstate_file=\"%s\"",xbt_str_varsubst(state_file,patterns));
SURFXML_BUFFER_SET(host_availability_file, xbt_str_varsubst(availability_file,patterns));
SURFXML_BUFFER_SET(host_state_file, xbt_str_varsubst(state_file,patterns));
- DEBUG0("</host>");
+ XBT_DEBUG("</host>");
SURFXML_START_TAG(host);
SURFXML_END_TAG(host);
temp_cluster_bw = bprintf("%s",replace_random_parameter(temp_cluster_bw));
temp_cluster_lat = bprintf("%s",cluster_lat);
temp_cluster_lat = bprintf("%s",replace_random_parameter(temp_cluster_lat));
- DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,temp_cluster_bw, cluster_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id,temp_cluster_bw, cluster_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
break;
default:
- DEBUG0("Malformed radical");
+ XBT_DEBUG("Malformed radical");
}
xbt_dynar_free(&radical_ends);
}
xbt_dynar_free(&radical_elements);
- DEBUG0(" ");
+ XBT_DEBUG(" ");
router_id =
bprintf("%s%s_router%s", cluster_prefix, cluster_id,
cluster_suffix);
link_router = bprintf("%s_link_%s_router", cluster_id, cluster_id);
link_backbone = bprintf("%s_backbone", cluster_id);
- DEBUG1("<router id=\"%s\"/>", router_id);
+ XBT_DEBUG("<router id=\"%s\"/>", router_id);
SURFXML_BUFFER_SET(router_id, router_id);
SURFXML_START_TAG(router);
SURFXML_END_TAG(router);
temp_cluster_bw = bprintf("%s",replace_random_parameter(temp_cluster_bw));
temp_cluster_lat = bprintf("%s",cluster_lat);
temp_cluster_lat = bprintf("%s",replace_random_parameter(temp_cluster_lat));
- DEBUG3("<link\tid=\"%s\" bw=\"%s\" lat=\"%s\"/>", link_router,temp_cluster_bw, temp_cluster_lat);
+ XBT_DEBUG("<link\tid=\"%s\" bw=\"%s\" lat=\"%s\"/>", link_router,temp_cluster_bw, temp_cluster_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link);
SURFXML_END_TAG(link);
- DEBUG3("<link\tid=\"%s\" bw=\"%s\" lat=\"%s\"/>", link_backbone,cluster_bb_bw, cluster_bb_lat);
+ XBT_DEBUG("<link\tid=\"%s\" bw=\"%s\" lat=\"%s\"/>", link_backbone,cluster_bb_bw, cluster_bb_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(cluster_bb_sharing_policy == A_surfxml_cluster_bb_sharing_policy_FATPIPE)
SURFXML_START_TAG(link);
SURFXML_END_TAG(link);
- DEBUG0(" ");
+ XBT_DEBUG(" ");
#ifdef HAVE_PCRE_LIB
char *new_suffix = xbt_strdup("");
char *pcre_link_backbone = bprintf("%s_backbone", cluster_id);
char *pcre_link_dst = bprintf("%s_link_$1dst", cluster_id);
- DEBUG2("<route\tsrc=\"%s\"\tdst=\"%s\"", route_src_dst, route_src_dst);
- DEBUG0("symmetrical=\"NO\">");
+ XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", route_src_dst, route_src_dst);
+ XBT_DEBUG("symmetrical=\"NO\">");
SURFXML_BUFFER_SET(route_src, route_src_dst);
SURFXML_BUFFER_SET(route_dst, route_src_dst);
A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_NO;
SURFXML_START_TAG(route);
- DEBUG1("<link_ctn\tid=\"%s\"/>", pcre_link_src);
+ XBT_DEBUG("<link_ctn\tid=\"%s\"/>", pcre_link_src);
SURFXML_BUFFER_SET(link_ctn_id, pcre_link_src);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG1("<link_ctn\tid=\"%s\"/>", pcre_link_backbone);
+ XBT_DEBUG("<link_ctn\tid=\"%s\"/>", pcre_link_backbone);
SURFXML_BUFFER_SET(link_ctn_id, pcre_link_backbone);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG1("<link_ctn\tid=\"%s\"/>", pcre_link_dst);
+ XBT_DEBUG("<link_ctn\tid=\"%s\"/>", pcre_link_dst);
SURFXML_BUFFER_SET(link_ctn_id, pcre_link_dst);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG0("</route>");
+ XBT_DEBUG("</route>");
SURFXML_END_TAG(route);
free(pcre_link_dst);
cluster_suffix);
}
- DEBUG2("<route\tsrc=\"%s\"\tdst=\"%s\"", route_src, route_dst);
- DEBUG0("symmetrical=\"NO\">");
+ XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", route_src, route_dst);
+ XBT_DEBUG("symmetrical=\"NO\">");
SURFXML_BUFFER_SET(route_src, route_src);
SURFXML_BUFFER_SET(route_dst, route_dst);
A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_NO;
xbt_dynar_get_as(tab_elements_num, j, int));
}
- DEBUG1("<link_ctn\tid=\"%s\"/>", route_src);
+ XBT_DEBUG("<link_ctn\tid=\"%s\"/>", route_src);
SURFXML_BUFFER_SET(link_ctn_id, route_src);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG1("<link_ctn\tid=\"%s_backbone\"/>", cluster_id);
+ XBT_DEBUG("<link_ctn\tid=\"%s_backbone\"/>", cluster_id);
SURFXML_BUFFER_SET(link_ctn_id, bprintf("%s_backbone", cluster_id));
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG1("<link_ctn\tid=\"%s\"/>", route_dst);
+ XBT_DEBUG("<link_ctn\tid=\"%s\"/>", route_dst);
SURFXML_BUFFER_SET(link_ctn_id, route_dst);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
if(cluster_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG0("</route>");
+ XBT_DEBUG("</route>");
SURFXML_END_TAG(route);
}
}
free(availability_file);
free(state_file);
- DEBUG0("</AS>");
+ XBT_DEBUG("</AS>");
SURFXML_END_TAG(AS);
- DEBUG0(" ");
+ XBT_DEBUG(" ");
surfxml_bufferstack_pop(1);
}
SURFXML_BUFFER_SET(AS_coordinates, peer_coord);
#ifdef HAVE_PCRE_LIB
SURFXML_BUFFER_SET(AS_routing, "RuleBased");
- DEBUG1("<AS id=\"%s\"\trouting=\"RuleBased\">", peer_id);
+ XBT_DEBUG("<AS id=\"%s\"\trouting=\"RuleBased\">", peer_id);
#else
SURFXML_BUFFER_SET(AS_routing, "Full");
- DEBUG1("<AS id=\"%s\"\trouting=\"Full\">", peer_id);
+ XBT_DEBUG("<AS id=\"%s\"\trouting=\"Full\">", peer_id);
#endif
SURFXML_START_TAG(AS);
- DEBUG0(" ");
+ XBT_DEBUG(" ");
host_id = bprintf("peer_%s", peer_id);
router_id = bprintf("router_%s", peer_id);
link_id_up = bprintf("link_%s_up", peer_id);
link_router = bprintf("%s_link_router", peer_id);
link_backbone = bprintf("%s_backbone", peer_id);
- DEBUG2("<host\tid=\"%s\"\tpower=\"%s\"/>", host_id, peer_power);
+ XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%s\"/>", host_id, peer_power);
A_surfxml_host_state = A_surfxml_host_state_ON;
SURFXML_BUFFER_SET(host_id, host_id);
SURFXML_BUFFER_SET(host_power, peer_power);
SURFXML_START_TAG(host);
SURFXML_END_TAG(host);
- DEBUG2("<router id=\"%s\"\tcoordinates=\"%s\"/>", router_id, peer_coord);
+ XBT_DEBUG("<router id=\"%s\"\tcoordinates=\"%s\"/>", router_id, peer_coord);
SURFXML_BUFFER_SET(router_id, router_id);
SURFXML_BUFFER_SET(router_coordinates, peer_coord);
SURFXML_START_TAG(router);
SURFXML_END_TAG(router);
- DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_up, peer_bw_in, peer_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_up, peer_bw_in, peer_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(peer_sharing_policy == A_surfxml_peer_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link);
SURFXML_END_TAG(link);
- DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_down, peer_bw_out, peer_lat);
+ XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>", link_id_down, peer_bw_out, peer_lat);
A_surfxml_link_state = A_surfxml_link_state_ON;
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
if(peer_sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link);
SURFXML_END_TAG(link);
- DEBUG0(" ");
+ XBT_DEBUG(" ");
// begin here
- DEBUG2("<route\tsrc=\"%s\"\tdst=\"%s\"", peer_id, router_id);
- DEBUG0("symmetrical=\"NO\">");
+ XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", peer_id, router_id);
+ XBT_DEBUG("symmetrical=\"NO\">");
SURFXML_BUFFER_SET(route_src, peer_id);
SURFXML_BUFFER_SET(route_dst, router_id);
A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_NO;
SURFXML_START_TAG(route);
- DEBUG1("<link_ctn\tid=\"%s\"/>", link_id_up);
+ XBT_DEBUG("<link_ctn\tid=\"%s\"/>", link_id_up);
SURFXML_BUFFER_SET(link_ctn_id, link_id_up);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
if(peer_sharing_policy == A_surfxml_peer_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG0("</route>");
+ XBT_DEBUG("</route>");
SURFXML_END_TAG(route);
//Opposite Route
- DEBUG2("<route\tsrc=\"%s\"\tdst=\"%s\"", router_id, peer_id);
- DEBUG0("symmetrical=\"NO\">");
+ XBT_DEBUG("<route\tsrc=\"%s\"\tdst=\"%s\"", router_id, peer_id);
+ XBT_DEBUG("symmetrical=\"NO\">");
SURFXML_BUFFER_SET(route_src, router_id);
SURFXML_BUFFER_SET(route_dst, peer_id);
A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_NO;
SURFXML_START_TAG(route);
- DEBUG1("<link_ctn\tid=\"%s\"/>", link_id_down);
+ XBT_DEBUG("<link_ctn\tid=\"%s\"/>", link_id_down);
SURFXML_BUFFER_SET(link_ctn_id, link_id_down);
A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
if(peer_sharing_policy == A_surfxml_peer_sharing_policy_FULLDUPLEX)
SURFXML_START_TAG(link_ctn);
SURFXML_END_TAG(link_ctn);
- DEBUG0("</route>");
+ XBT_DEBUG("</route>");
SURFXML_END_TAG(route);
- DEBUG0("</AS>");
+ XBT_DEBUG("</AS>");
SURFXML_END_TAG(AS);
- DEBUG0(" ");
+ XBT_DEBUG(" ");
//xbt_dynar_free(&tab_elements_num);
THROW2(arg_error, 0, "Invalid mean and standard deviation (%f and %f)",
random->mean, random->std);
- DEBUG8("id = '%s' min = '%f' max = '%f' mean = '%f' std_deviatinon = '%f' generator = '%d' seed = '%ld' radical = '%s'",
+ XBT_DEBUG("id = '%s' min = '%f' max = '%f' mean = '%f' std_deviatinon = '%f' generator = '%d' seed = '%ld' radical = '%s'",
random_id,
random->min,
random->max,
}
break;
default:
- INFO0("Malformed radical");
+ XBT_INFO("Malformed radical");
}
res = random_generate(random);
xbt_dict_set(random_value, bprintf("%s_router",random_id), bprintf("%f",res), free);
char *elem;
xbt_dict_foreach(random_value, cursor, key, elem) {
- DEBUG2("%s = %s",key,elem);
+ XBT_DEBUG("%s = %s",key,elem);
}
}
static int warned = 0; /* warn only once */
if (!file) {
if (!warned) {
- WARN0
+ XBT_WARN
("Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.");
warned = 1;
}
if (trace_list) {
trace = xbt_dict_get_or_null(trace_list, id);
if (trace) {
- WARN1("Ignoring redefinition of trace %s", id);
+ XBT_WARN("Ignoring redefinition of trace %s", id);
return trace;
}
}
if (trace_list) {
trace = xbt_dict_get_or_null(trace_list, filename);
if (trace) {
- WARN1("Ignoring redefinition of trace %s", filename);
+ XBT_WARN("Ignoring redefinition of trace %s", filename);
return trace;
}
}
}
}
lat_bound = sg_tcp_gamma / (2.0 * lat_current);
- DEBUG2("action (%p) : lat_bound = %g", action, lat_bound);
+ XBT_DEBUG("action (%p) : lat_bound = %g", action, lat_bound);
if ((action->latency == 0.0) && (action->suspended == 0)) {
if (action->rate < 0)
lmm_update_variable_bound(ptask_maxmin_system, action->variable,
static void ptask_action_suspend(surf_action_t action)
{
- XBT_IN1("(%p))", action);
+ XBT_IN_F("(%p))", action);
if (((surf_action_workstation_L07_t) action)->suspended != 2) {
((surf_action_workstation_L07_t) action)->suspended = 1;
lmm_update_variable_weight(ptask_maxmin_system,
surf_action_workstation_L07_t act =
(surf_action_workstation_L07_t) action;
- XBT_IN1("(%p)", act);
+ XBT_IN_F("(%p)", act);
if (act->suspended != 2) {
lmm_update_variable_weight(ptask_maxmin_system, act->variable, 1.0);
act->suspended = 0;
static void ptask_action_set_max_duration(surf_action_t action,
double duration)
{ /* FIXME: should inherit */
- XBT_IN2("(%p,%g)", action, duration);
+ XBT_IN_F("(%p,%g)", action, duration);
action->max_duration = duration;
XBT_OUT;
}
static void ptask_action_set_priority(surf_action_t action,
double priority)
{ /* FIXME: should inherit */
- XBT_IN2("(%p,%g)", action, priority);
+ XBT_IN_F("(%p,%g)", action, priority);
action->priority = priority;
XBT_OUT;
}
static double ptask_action_get_remains(surf_action_t action)
{
- XBT_IN1("(%p)", action);
+ XBT_IN_F("(%p)", action);
return action->remains;
XBT_OUT;
}
if (action->latency > 0) {
if (min < 0) {
min = action->latency;
- DEBUG3("Updating min (value) with %p (start %f): %f", action,
+ XBT_DEBUG("Updating min (value) with %p (start %f): %f", action,
action->generic_action.start, min);
} else if (action->latency < min) {
min = action->latency;
- DEBUG3("Updating min (latency) with %p (start %f): %f", action,
+ XBT_DEBUG("Updating min (latency) with %p (start %f): %f", action,
action->generic_action.start, min);
}
}
}
- DEBUG1("min value : %f", min);
+ XBT_DEBUG("min value : %f", min);
return min;
}
1.0);
}
}
- DEBUG3("Action (%p) : remains (%g) updated by %g.",
+ XBT_DEBUG("Action (%p) : remains (%g) updated by %g.",
action, action->generic_action.remains,
lmm_variable_getvalue(action->variable) * delta);
double_update(&(action->generic_action.remains),
if (action->generic_action.max_duration != NO_MAX_DURATION)
double_update(&(action->generic_action.max_duration), delta);
- DEBUG2("Action (%p) : remains (%g).",
+ XBT_DEBUG("Action (%p) : remains (%g).",
action, action->generic_action.remains);
if ((action->generic_action.remains <= 0) &&
(lmm_get_variable_weight(action->variable) > 0)) {
/* if(((link_L07_t)constraint_id)->type== */
/* SURF_WORKSTATION_RESOURCE_LINK) { */
-/* DEBUG2("Checking for link %s (%p)", */
+/* XBT_DEBUG("Checking for link %s (%p)", */
/* ((link_L07_t)constraint_id)->name, */
/* ((link_L07_t)constraint_id)); */
/* } */
/* if(((cpu_L07_t)constraint_id)->type== */
/* SURF_WORKSTATION_RESOURCE_CPU) { */
-/* DEBUG3("Checking for cpu %s (%p) : %s", */
+/* XBT_DEBUG("Checking for cpu %s (%p) : %s", */
/* ((cpu_L07_t)constraint_id)->name, */
/* ((cpu_L07_t)constraint_id), */
/* ((cpu_L07_t)constraint_id)->state_current==SURF_CPU_OFF?"Off":"On"); */
SURF_WORKSTATION_RESOURCE_CPU) &&
(((cpu_L07_t) constraint_id)->state_current ==
SURF_RESOURCE_OFF))) {
- DEBUG1("Action (%p) Failed!!", action);
+ XBT_DEBUG("Action (%p) Failed!!", action);
action->generic_action.finish = surf_get_clock();
surf_action_state_set((surf_action_t) action,
SURF_ACTION_FAILED);
link_L07_t nw_link = id;
if (nw_link->type == SURF_WORKSTATION_RESOURCE_LINK) {
- DEBUG2("Updating link %s (%p)", surf_resource_name(nw_link), nw_link);
+ XBT_DEBUG("Updating link %s (%p)", surf_resource_name(nw_link), nw_link);
if (event_type == nw_link->bw_event) {
nw_link->bw_current = value;
lmm_update_constraint_bound(ptask_maxmin_system, nw_link->constraint,
if (tmgr_trace_event_free(event_type))
nw_link->state_event = NULL;
} else {
- CRITICAL0("Unknown event ! \n");
+ XBT_CRITICAL("Unknown event ! \n");
xbt_abort();
}
return;
} else if (cpu->type == SURF_WORKSTATION_RESOURCE_CPU) {
- DEBUG3("Updating cpu %s (%p) with value %g", surf_resource_name(cpu),
+ XBT_DEBUG("Updating cpu %s (%p) with value %g", surf_resource_name(cpu),
cpu, value);
if (event_type == cpu->power_event) {
cpu->power_current = value;
if (tmgr_trace_event_free(event_type))
cpu->state_event = NULL;
} else {
- CRITICAL0("Unknown event ! \n");
+ XBT_CRITICAL("Unknown event ! \n");
xbt_abort();
}
return;
action =
surf_action_new(sizeof(s_surf_action_workstation_L07_t), amount,
surf_workstation_model, 0);
- DEBUG3("Creating a parallel task (%p) with %d cpus and %d links.",
+ XBT_DEBUG("Creating a parallel task (%p) with %d cpus and %d links.",
action, workstation_nb, nb_link);
action->suspended = 0; /* Should be useless because of the
calloc but it seems to help valgrind... */
{
surf_action_workstation_L07_t action = NULL;
- XBT_IN2("(%s,%g)", surf_resource_name(cpu), duration);
+ XBT_IN_F("(%s,%g)", surf_resource_name(cpu), duration);
action = (surf_action_workstation_L07_t) ptask_execute(cpu, 1.0);
action->generic_action.max_duration = duration;
/**************************************/
void surf_workstation_model_init_ptask_L07(const char *filename)
{
- INFO0("surf_workstation_model_init_ptask_L07");
+ XBT_INFO("surf_workstation_model_init_ptask_L07");
xbt_assert0(!surf_cpu_model, "CPU model type already defined");
xbt_assert0(!surf_network_model, "network model type already defined");
surf_network_model = surf_model_init();
*/
void xbt_die(const char *msg)
{
- CRITICAL1("%s", msg);
+ XBT_CRITICAL("%s", msg);
xbt_abort();
}
binary_name = bprintf("%s/%s", data, xbt_binary_name);
if (!stat(binary_name, &stat_buf)) {
/* Found. */
- DEBUG1("Looked in the PATH for the binary. Found %s",
+ XBT_DEBUG("Looked in the PATH for the binary. Found %s",
binary_name);
break;
}
addrs = xbt_new(char *, e->used);
for (i = 0; i < e->used; i++) {
/* retrieve this address */
- DEBUG2("Retrieving address number %d from '%s'", i, backtrace_syms[i]);
+ XBT_DEBUG("Retrieving address number %d from '%s'", i, backtrace_syms[i]);
snprintf(buff, 256, "%s", strchr(backtrace_syms[i], '[') + 1);
p = strchr(buff, ']');
*p = '\0';
addrs[i] = bprintf("%s", buff);
else
addrs[i] = bprintf("0x0");
- DEBUG3("Set up a new address: %d, '%s'(%p)", i, addrs[i], addrs[i]);
+ XBT_DEBUG("Set up a new address: %d, '%s'(%p)", i, addrs[i], addrs[i]);
/* Add it to the command line args */
curr += sprintf(curr, "%s ", addrs[i]);
/* parse the output and build a new backtrace */
e->bt_strings = xbt_new(char *, e->used);
- VERB1("Fire a first command: '%s'", cmd);
+ XBT_VERB("Fire a first command: '%s'", cmd);
pipe = popen(cmd, "r");
if (!pipe) {
- CRITICAL0("Cannot fork addr2line to display the backtrace");
+ XBT_CRITICAL("Cannot fork addr2line to display the backtrace");
abort();
}
for (i = 0; i < e->used; i++) {
char *fgets_res;
- DEBUG2("Looking for symbol %d, addr = '%s'", i, addrs[i]);
+ XBT_DEBUG("Looking for symbol %d, addr = '%s'", i, addrs[i]);
fgets_res = fgets(line_func, 1024, pipe);
if (fgets_res == NULL)
THROW2(system_error, 0,
line_pos[strlen(line_pos) - 1] = '\0';
if (strcmp("??", line_func)) {
- DEBUG2("Found static symbol %s() at %s", line_func, line_pos);
+ XBT_DEBUG("Found static symbol %s() at %s", line_func, line_pos);
e->bt_strings[i] =
bprintf("** In %s() at %s", line_func, line_pos);
} else {
sprintf(maps_buff, "%#lx", addr);
if (strcmp(addrs[i], maps_buff)) {
- CRITICAL2("Cannot parse backtrace address '%s' (addr=%#lx)",
+ XBT_CRITICAL("Cannot parse backtrace address '%s' (addr=%#lx)",
addrs[i], addr);
}
- DEBUG2("addr=%s (as string) =%#lx (as number)", addrs[i], addr);
+ XBT_DEBUG("addr=%s (as string) =%#lx (as number)", addrs[i], addr);
while (!found) {
long int first, last;
break;
if (i == 0) {
maps_buff[strlen(maps_buff) - 1] = '\0';
- DEBUG1("map line: %s", maps_buff);
+ XBT_DEBUG("map line: %s", maps_buff);
}
sscanf(maps_buff, "%lx", &first);
p = strchr(maps_buff, '-') + 1;
found = 1;
}
if (found) {
- DEBUG3("%#lx in [%#lx-%#lx]", addr, first, last);
- DEBUG0
+ XBT_DEBUG("%#lx in [%#lx-%#lx]", addr, first, last);
+ XBT_DEBUG
("Symbol found, map lines not further displayed (even if looking for next ones)");
}
}
free(addrs[i]);
if (!found) {
- VERB0
+ XBT_VERB
("Problem while reading the maps file. Following backtrace will be mangled.");
- DEBUG1("No dynamic. Static symbol: %s", backtrace_syms[i]);
+ XBT_DEBUG("No dynamic. Static symbol: %s", backtrace_syms[i]);
e->bt_strings[i] = bprintf("** In ?? (%s)", backtrace_syms[i]);
continue;
}
*/
addrs[i] = bprintf("0x%0*lx", addr_len - 2, addr - offset);
- DEBUG2("offset=%#lx new addr=%s", offset, addrs[i]);
+ XBT_DEBUG("offset=%#lx new addr=%s", offset, addrs[i]);
/* Got it. We have our new address. Let's get the library path and we
are set */
/* Here we go, fire an addr2line up */
subcmd = bprintf("%s -f -e %s %s", ADDR2LINE, p, addrs[i]);
free(p);
- VERB1("Fire a new command: '%s'", subcmd);
+ XBT_VERB("Fire a new command: '%s'", subcmd);
subpipe = popen(subcmd, "r");
if (!subpipe) {
- CRITICAL0("Cannot fork addr2line to display the backtrace");
+ XBT_CRITICAL("Cannot fork addr2line to display the backtrace");
abort();
}
fgets_res = fgets(line_func, 1024, subpipe);
/* check whether the trick worked */
if (strcmp("??", line_func)) {
- DEBUG2("Found dynamic symbol %s() at %s", line_func, line_pos);
+ XBT_DEBUG("Found dynamic symbol %s() at %s", line_func, line_pos);
e->bt_strings[i] =
bprintf("** In %s() at %s", line_func, line_pos);
} else {
/* damn, nothing to do here. Let's print the raw address */
- DEBUG1("Dynamic symbol not found. Raw address = %s",
+ XBT_DEBUG("Dynamic symbol not found. Raw address = %s",
backtrace_syms[i]);
e->bt_strings[i] = bprintf("** In ?? at %s", backtrace_syms[i]);
}
xbt_cfgelm_t variable = NULL;
char *name = NULL;
- DEBUG1("Copy cfg set %p", tocopy);
+ XBT_DEBUG("Copy cfg set %p", tocopy);
*whereto = NULL;
xbt_assert0(tocopy, "cannot copy NULL config");
/** @brief Destructor */
void xbt_cfg_free(xbt_cfg_t * cfg)
{
- DEBUG1("Frees cfg set %p", cfg);
+ XBT_DEBUG("Frees cfg set %p", cfg);
xbt_dict_free((xbt_dict_t *) cfg);
}
{
xbt_cfgelm_t c = (xbt_cfgelm_t) data;
- DEBUG1("Frees cfgelm %p", c);
+ XBT_DEBUG("Frees cfgelm %p", c);
if (!c)
return;
xbt_free(c->desc);
res = xbt_dict_get_or_null((xbt_dict_t) * cfg, name);
if (res) {
- WARN1("Config elem %s registered twice.", name);
+ XBT_WARN("Config elem %s registered twice.", name);
/* Will be removed by the insertion of the new one */
}
res = xbt_new(s_xbt_cfgelm_t, 1);
- DEBUG8("Register cfg elm %s (%s) (%d to %d %s (=%d) @%p in set %p)",
+ XBT_DEBUG("Register cfg elm %s (%s) (%d to %d %s (=%d) @%p in set %p)",
name, desc, min, max, xbt_cfgelm_type_name[type], type, res,
*cfg);
break;
default:
- ERROR1("%d is an invalide type code", type);
+ XBT_ERROR("%d is an invalide type code", type);
}
xbt_dict_set((xbt_dict_t) * cfg, name, res, &xbt_cfgelm_free);
void xbt_cfg_unregister(xbt_cfg_t cfg, const char *name)
{
- DEBUG2("Unregister elm '%s' from set %p", name, cfg);
+ XBT_DEBUG("Unregister elm '%s' from set %p", name, cfg);
xbt_dict_remove((xbt_dict_t) cfg, name);
}
int min, max;
e_xbt_cfgelm_type_t type;
- DEBUG1("Register string '%s'", entry);
+ XBT_DEBUG("Register string '%s'", entry);
tok = strchr(entrycpy, ':');
xbt_assert2(tok, "Invalid config element descriptor: %s%s",
int size;
xbt_assert0(cfg, "NULL config set.");
- DEBUG1("Check cfg set %p", cfg);
+ XBT_DEBUG("Check cfg set %p", cfg);
xbt_dict_foreach((xbt_dict_t) cfg, cursor, name, variable) {
size = xbt_dynar_length(variable->content);
"Can't get the type of '%s' since this variable does not exist",
name);
- INFO1("type in variable = %d", variable->type);
+ XBT_INFO("type in variable = %d", variable->type);
return variable->type;
}
}
optionlist_cpy = xbt_strdup(options);
- DEBUG1("List to parse and set:'%s'", options);
+ XBT_DEBUG("List to parse and set:'%s'", options);
option = optionlist_cpy;
while (1) { /* breaks in the code */
break;
name = option;
len = strlen(name);
- DEBUG3("Still to parse and set: '%s'. len=%d; option-name=%ld",
+ XBT_DEBUG("Still to parse and set: '%s'. len=%d; option-name=%ld",
name, len, (long) (option - name));
/* Pass the value */
while (option - name <= (len - 1) && *option != ' ' && *option != '\n'
&& *option != '\t' && *option != ',') {
- DEBUG1("Take %c.", *option);
+ XBT_DEBUG("Take %c.", *option);
option++;
}
if (option - name == len) {
- DEBUG0("Boundary=EOL");
+ XBT_DEBUG("Boundary=EOL");
option = NULL; /* don't do next iteration */
} else {
- DEBUG3("Boundary on '%c'. len=%d;option-name=%ld",
+ XBT_DEBUG("Boundary on '%c'. len=%d;option-name=%ld",
*option, len, (long) (option - name));
/* Pass the following blank chars */
if (option - name == len - 1)
option = NULL; /* don't do next iteration */
}
- DEBUG2("parse now:'%s'; parse later:'%s'", name, option);
+ XBT_DEBUG("parse now:'%s'; parse later:'%s'", name, option);
if (name[0] == ' ' || name[0] == '\n' || name[0] == '\t')
continue;
*(val++) = '\0';
if (strcmp(name,"contexts/factory"))
- INFO2("Configuration change: Set '%s' to '%s'", name, val);
+ XBT_INFO("Configuration change: Set '%s' to '%s'", name, val);
TRY {
variable = xbt_dict_get((xbt_dict_t) cfg, name);
variable->isdefault = 1;
}
else
- DEBUG2
+ XBT_DEBUG
("Do not override configuration variable '%s' with value '%d' because it was already set.",
name, val);
}
variable->isdefault = 1;
}
else
- DEBUG2
+ XBT_DEBUG
("Do not override configuration variable '%s' with value '%lf' because it was already set.",
name, val);
}
variable->isdefault = 1;
}
else
- DEBUG2
+ XBT_DEBUG
("Do not override configuration variable '%s' with value '%s' because it was already set.",
name, val);
}
variable->isdefault = 1;
}
else
- DEBUG3
+ XBT_DEBUG
("Do not override configuration variable '%s' with value '%s:%d' because it was already set.",
name, host, port);
}
{
xbt_cfgelm_t variable;
- VERB2("Configuration setting: %s=%d", name, val);
+ XBT_VERB("Configuration setting: %s=%d", name, val);
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
if (variable->max == 1) {
{
xbt_cfgelm_t variable;
- VERB2("Configuration setting: %s=%f", name, val);
+ XBT_VERB("Configuration setting: %s=%f", name, val);
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
if (variable->max == 1) {
xbt_cfgelm_t variable;
char *newval = xbt_strdup(val);
- VERB2("Configuration setting: %s=%s", name, val);
+ XBT_VERB("Configuration setting: %s=%s", name, val);
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
- DEBUG5("Variable: %d to %d %s (=%d) @%p",
+ XBT_DEBUG("Variable: %d to %d %s (=%d) @%p",
variable->min, variable->max,
xbt_cfgelm_type_name[variable->type], variable->type, variable);
xbt_cfgelm_t variable;
xbt_peer_t val = xbt_peer_new(peer, port);
- VERB3("Configuration setting: %s=%s:%d", name, peer, port);
+ XBT_VERB("Configuration setting: %s=%s:%d", name, peer, port);
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer);
xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
if (xbt_dynar_length(variable->content) > 1) {
- WARN2
+ XBT_WARN
("You asked for the first value of the config element '%s', but there is %lu values",
name, xbt_dynar_length(variable->content));
}
xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
if (xbt_dynar_length(variable->content) > 1) {
- WARN2
+ XBT_WARN
("You asked for the first value of the config element '%s', but there is %lu values\n",
name, xbt_dynar_length(variable->content));
}
xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
if (xbt_dynar_length(variable->content) > 1) {
- WARN2
+ XBT_WARN
("You asked for the first value of the config element '%s', but there is %lu values\n",
name, xbt_dynar_length(variable->content));
} else if (xbt_dynar_length(variable->content) == 0) {
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer);
if (xbt_dynar_length(variable->content) > 1) {
- WARN2
+ XBT_WARN
("You asked for the first value of the config element '%s', but there is %lu values\n",
name, xbt_dynar_length(variable->content));
}
memset(&currcell[oldsize], 0, oldsize * sizeof(xbt_dictelm_t)); /* zero second half */
dict->table_size = --newsize;
dict->table = currcell;
- DEBUG2("REHASH (%d->%d)", oldsize, newsize);
+ XBT_DEBUG("REHASH (%d->%d)", oldsize, newsize);
for (i = 0; i < oldsize; i++, currcell++) {
if (!*currcell) /* empty cell */
xbt_dictelm_t current, previous = NULL;
xbt_assert(dict);
- DEBUG5("ADD %.*s hash = %d, size = %d, & = %d", key_len, key, hash_code,
+ XBT_DEBUG("ADD %.*s hash = %d, size = %d, & = %d", key_len, key, hash_code,
dict->table_size, hash_code & dict->table_size);
current = dict->table[hash_code & dict->table_size];
while (current != NULL &&
}
} else {
- DEBUG6("Replace %.*s by %.*s under key %.*s",
+ XBT_DEBUG("Replace %.*s by %.*s under key %.*s",
key_len, (char *) current->content,
key_len, (char *) data, key_len, (char *) key);
/* there is already an element with the same key: overwrite it */
xbt_dictelm_t current, previous = NULL;
xbt_assert(dict);
- DEBUG5("ADD %zu->%zu; hash = %d, size = %d, & = %d", key, data,
+ XBT_DEBUG("ADD %zu->%zu; hash = %d, size = %d, & = %d", key, data,
hash_code, dict->table_size, hash_code & dict->table_size);
current = dict->table[hash_code & dict->table_size];
while (current != NULL &&
for (i = 0; i < NB_TEST; i++) {
mdict = xbt_dict_new();
- VERB1("mdict=%p", mdict);
+ XBT_VERB("mdict=%p", mdict);
if (verbose > 0)
printf("Test %d\n", i);
/* else if (i%10) printf("."); else printf("%d",i/10); */
/** @brief Reinitialize the cursor. Mandatory after removal or add in dict. */
XBT_INLINE void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor)
{
- CDEBUG0(xbt_dict_cursor, "xbt_dict_cursor_rewind");
+ XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_rewind");
xbt_assert(cursor);
cursor->line = 0;
XBT_INLINE void xbt_dict_cursor_first(const xbt_dict_t dict,
xbt_dict_cursor_t * cursor)
{
- DEBUG0("xbt_dict_cursor_first");
+ XBT_DEBUG("xbt_dict_cursor_first");
if (!*cursor) {
- DEBUG0("Create the cursor on first use");
+ XBT_DEBUG("Create the cursor on first use");
*cursor = xbt_dict_cursor_new(dict);
} else {
xbt_dict_cursor_rewind(*cursor);
xbt_dictelm_t current;
int line;
- DEBUG0("xbt_dict_cursor_step");
+ XBT_DEBUG("xbt_dict_cursor_step");
xbt_assert(cursor);
current = cursor->current;
if (cursor->dict != NULL) {
if (current != NULL) {
- DEBUG0("current is not null, take the next element");
+ XBT_DEBUG("current is not null, take the next element");
current = current->next;
- DEBUG1("next element: %p", current);
+ XBT_DEBUG("next element: %p", current);
}
while (current == NULL && ++line <= cursor->dict->table_size) {
- DEBUG0("current is NULL, take the next line");
+ XBT_DEBUG("current is NULL, take the next line");
current = cursor->dict->table[line];
- DEBUG1("element in the next line: %p", current);
+ XBT_DEBUG("element in the next line: %p", current);
}
- DEBUG2("search finished, current = %p, line = %d", current, line);
+ XBT_DEBUG("search finished, current = %p, line = %d", current, line);
cursor->current = current;
cursor->line = line;
xbt_dictelm_t current;
- DEBUG0("xbt_dict_get_or_free");
+ XBT_DEBUG("xbt_dict_get_or_free");
if (!cursor || !(*cursor))
static void _free_dict(void *d)
{
- VERB1("free dict %p", d);
+ XBT_VERB("free dict %p", d);
xbt_dict_free((xbt_dict_t *) & d);
}
xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens));
xbt_assert0(keys_len, "Can't set a zero-long key set in a multidict");
- DEBUG2("xbt_multidict_set(%p,%d)", mdict, keys_len);
+ XBT_DEBUG("xbt_multidict_set(%p,%d)", mdict, keys_len);
for (i = 0, thislevel = mdict; i < keys_len - 1;
i++, thislevel = nextlevel) {
xbt_dynar_get_cpy(keys, i, &thiskey);
xbt_dynar_get_cpy(lens, i, &thislen);
- DEBUG5("multi_set: at level %d, len=%ld, key=%p |%*s|", i, thislen,
+ XBT_DEBUG("multi_set: at level %d, len=%ld, key=%p |%*s|", i, thislen,
thiskey, (int) thislen, thiskey);
/* search the dict of next level */
if (nextlevel == NULL) {
/* make sure the dict of next level exists */
nextlevel = xbt_dict_new();
- VERB1("Create a dict (%p)", nextlevel);
+ XBT_VERB("Create a dict (%p)", nextlevel);
xbt_dict_set_ext(thislevel, thiskey, thislen, nextlevel,
&_free_dict);
}
for (i = 0; i < xbt_dynar_length(keys); i++) {
char *thiskey = xbt_dynar_get_as(keys, i, char *);
unsigned long int thislen = (unsigned long int) strlen(thiskey);
- DEBUG2("Push %ld as level %lu length", thislen, i);
+ XBT_DEBUG("Push %ld as level %lu length", thislen, i);
xbt_dynar_push(lens, &thislen);
}
xbt_assert0(xbt_dynar_length(keys) >= 1,
"Can't get a zero-long key set in a multidict");
- DEBUG2("xbt_multidict_get(%p, %ld)", mdict, xbt_dynar_length(keys));
+ XBT_DEBUG("xbt_multidict_get(%p, %ld)", mdict, xbt_dynar_length(keys));
for (i = 0, thislevel = mdict; i < keys_len - 1;
i++, thislevel = nextlevel) {
xbt_dynar_get_cpy(keys, i, &thiskey);
xbt_dynar_get_cpy(lens, i, &thislen);
- DEBUG6("multi_get: at level %d (%p), len=%ld, key=%p |%*s|",
+ XBT_DEBUG("multi_get: at level %d (%p), len=%ld, key=%p |%*s|",
i, thislevel, thislen, thiskey, (int) thislen, thiskey);
/* search the dict of next level: let mismatch raise if not found */
const unsigned long new_length = new_size * elmsize;
char *const new_data = (char *) xbt_malloc0(elmsize * new_size);
- DEBUG3("expand %p from %lu to %lu elements", (void *) dynar,
+ XBT_DEBUG("expand %p from %lu to %lu elements", (void *) dynar,
(unsigned long) old_size, nb);
if (old_data) {
void xbt_dynar_dump(xbt_dynar_t dynar)
{
- INFO5("Dynar dump: size=%lu; used=%lu; elmsize=%lu; data=%p; free_f=%p",
+ XBT_INFO("Dynar dump: size=%lu; used=%lu; elmsize=%lu; data=%p; free_f=%p",
dynar->size, dynar->used, dynar->elmsize, dynar->data,
dynar->free_f);
}
_sanity_check_dynar(dynar);
- DEBUG1("Reset the dynar %p", (void *) dynar);
+ XBT_DEBUG("Reset the dynar %p", (void *) dynar);
if (dynar->free_f) {
_dynar_map(dynar, dynar->free_f);
}
_dynar_lock(dynar);
_check_populated_dynar(dynar);
- DEBUG1("Pop %p", (void *) dynar);
+ XBT_DEBUG("Pop %p", (void *) dynar);
dynar->used--;
res = _xbt_dynar_elm(dynar, dynar->used);
_dynar_unlock(dynar);
{
/* sanity checks done by remove_at */
- DEBUG1("Pop %p", (void *) dynar);
+ XBT_DEBUG("Pop %p", (void *) dynar);
_dynar_lock(dynar);
_xbt_dynar_remove_at(dynar, dynar->used - 1, dst);
_dynar_unlock(dynar);
if((!d1) && (!d2)) return 0;
if((!d1) || (!d2))
{
- DEBUG2("NULL dynar d1=%p d2=%p",d1,d2);
+ XBT_DEBUG("NULL dynar d1=%p d2=%p",d1,d2);
return 1;
}
if((d1->elmsize)!=(d2->elmsize))
{
- DEBUG2("Size of elmsize d1=%ld d2=%ld",d1->elmsize,d2->elmsize);
+ XBT_DEBUG("Size of elmsize d1=%ld d2=%ld",d1->elmsize,d2->elmsize);
return 1; // xbt_die
}
if(xbt_dynar_length(d1) != xbt_dynar_length(d2))
{
- DEBUG2("Size of dynar d1=%ld d2=%ld",xbt_dynar_length(d1),xbt_dynar_length(d2));
+ XBT_DEBUG("Size of dynar d1=%ld d2=%ld",xbt_dynar_length(d1),xbt_dynar_length(d2));
return 1;
}
{
void *data1 = xbt_dynar_get_as(d1, i, void *);
void *data2 = xbt_dynar_get_as(d2, i, void *);
- DEBUG3("link[%d] d1=%p d2=%p",i,data1,data2);
+ XBT_DEBUG("link[%d] d1=%p d2=%p",i,data1,data2);
if(compar(data1,data2)) return 1;
}
return 0;
d = xbt_dynar_new(sizeof(int), NULL);
for (cpt = 0; cpt < NB_ELEM; cpt++) {
xbt_dynar_unshift(d, &cpt);
- DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
+ XBT_DEBUG("Push %d, length=%lu", cpt, xbt_dynar_length(d));
}
for (cpt = 0; cpt < NB_ELEM; cpt++) {
i = xbt_dynar_pop_as(d, int);
d = xbt_dynar_new(sizeof(int), NULL);
for (cpt = 0; cpt < NB_ELEM; cpt++) {
xbt_dynar_push_as(d, int, cpt);
- DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
+ XBT_DEBUG("Push %d, length=%lu", cpt, xbt_dynar_length(d));
}
for (cpt = 0; cpt < NB_ELEM/5; cpt++) {
xbt_dynar_insert_at_as(d, NB_ELEM/2, int, cpt);
- DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
+ XBT_DEBUG("Push %d, length=%lu", cpt, xbt_dynar_length(d));
}
for (cpt = 0; cpt < NB_ELEM/2; cpt++) {
xbt_test_assert2(i == cpt,
"The retrieved value is not the same than the injected one at the begining (%d!=%d)",
i, cpt);
- DEBUG2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
+ XBT_DEBUG("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
}
for (cpt = 999; cpt >= 0; cpt--) {
xbt_dynar_shift(d, &i);
xbt_dynar_remove_at(d, 2000, &i);
xbt_test_assert2(i == cpt,
"Remove a bad value. Got %d, expected %d", i, cpt);
- DEBUG2("remove %d, length=%lu", cpt, xbt_dynar_length(d));
+ XBT_DEBUG("remove %d, length=%lu", cpt, xbt_dynar_length(d));
}
xbt_dynar_free(&d); /* This code is used both as example and as regression test, so we try to */
xbt_dynar_free(&d); /* free the struct twice here to check that it's ok, but freeing it only once */
xbt_test_assert2(d1 == d2,
"The retrieved value is not the same than the injected one at the begining (%f!=%f)",
d1, d2);
- DEBUG2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
+ XBT_DEBUG("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
}
for (cpt = 999; cpt >= 0; cpt--) {
d1 = (double) cpt;
xbt_ex_free(*e);
#else
- ERROR0("No backtrace on this arch");
+ XBT_ERROR("No backtrace on this arch");
#endif
}
gras_os_myname(), (*xbt_getpid) (),
xbt_ex_catname(e->category), e->value, e->msg,
e->procname, thrower ? thrower : " in this process");
- CRITICAL1("%s", e->msg);
+ XBT_CRITICAL("%s", e->msg);
if (!e->remote && !e->bt_strings)
xbt_ex_setup_backtrace(e);
*/
XBT_INLINE xbt_fifo_item_t xbt_fifo_newitem(void)
{
- WARN0("This function is deprecated. Use xbt_fifo_new_item.");
+ XBT_WARN("This function is deprecated. Use xbt_fifo_new_item.");
return xbt_fifo_new_item();
}
*/
XBT_INLINE void xbt_fifo_freeitem(xbt_fifo_item_t b)
{
- WARN0("This function is deprecated. Use xbt_fifo_free_item.");
+ XBT_WARN("This function is deprecated. Use xbt_fifo_free_item.");
xbt_fifo_free_item(b);
return;
}
*/
XBT_INLINE xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l)
{
- WARN0("This function is deprecated. Use xbt_fifo_get_first_item.");
+ XBT_WARN("This function is deprecated. Use xbt_fifo_get_first_item.");
return xbt_fifo_get_first_item(l);
}
*/
xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i)
{
- WARN0("This function is deprecated. Use xbt_fifo_get_next_item.");
+ XBT_WARN("This function is deprecated. Use xbt_fifo_get_next_item.");
return xbt_fifo_get_next_item(i);
}
*/
xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i)
{
- WARN0("This function is deprecated. Use xbt_fifo_get_prev_item.");
+ XBT_WARN("This function is deprecated. Use xbt_fifo_get_prev_item.");
return xbt_fifo_get_prev_item(i);
}
unsigned int cursor;
xbt_dynar_foreach(src->out, cursor, edge) {
- DEBUG3("%p = %p--%p", edge, edge->src, edge->dst);
+ XBT_DEBUG("%p = %p--%p", edge, edge->src, edge->dst);
if ((edge->src == src) && (edge->dst == dst))
return edge;
}
if (!g->directed) {
xbt_dynar_foreach(src->out, cursor, edge) {
- DEBUG3("%p = %p--%p", edge, edge->src, edge->dst);
+ XBT_DEBUG("%p = %p--%p", edge, edge->src, edge->dst);
if ((edge->dst == src) && (edge->src == dst))
return edge;
}
static void __parse_graph_begin(void)
{
- DEBUG0("<graph>");
+ XBT_DEBUG("<graph>");
if (A_graphxml_graph_isDirected == A_graphxml_graph_isDirected_true)
parsed_graph = xbt_graph_new_graph(1, NULL);
else
static void __parse_graph_end(void)
{
xbt_dict_free(&parsed_nodes);
- DEBUG0("</graph>");
+ XBT_DEBUG("</graph>");
}
static void __parse_node(void)
{
xbt_node_t node = xbt_graph_new_node(parsed_graph, NULL);
- DEBUG1("<node name=\"%s\"/>", A_graphxml_node_name);
+ XBT_DEBUG("<node name=\"%s\"/>", A_graphxml_node_name);
if (__parse_node_label_and_data)
node->data = __parse_node_label_and_data(node, A_graphxml_node_label,
A_graphxml_node_data);
xbt_graph_parse_get_double(&(edge->length), A_graphxml_edge_length);
- DEBUG3("<edge source=\"%s\" target=\"%s\" length=\"%f\"/>",
+ XBT_DEBUG("<edge source=\"%s\" target=\"%s\" length=\"%f\"/>",
(char *) (edge->src)->data,
(char *) (edge->dst)->data, xbt_graph_edge_get_length(edge));
}
void xbt_graph_parse_open(const char *file)
{
if (!file) {
- WARN0
+ XBT_WARN
("I hope you know what you're doing... you just gave me a NULL pointer!");
return;
}
!strncmp(argv[i], "--xbt-log=", strlen("--xbt-log="))) {
if (strncmp(argv[i], "--log=", strlen("--log=")))
- WARN2
+ XBT_WARN
("Option %.*s is deprecated and will disapear in the future. Use --log instead.",
(int) (strchr(argv[i], '=') - argv[i]), argv[i]);
opt = strchr(argv[i], '=');
opt++;
xbt_log_control_set(opt);
- DEBUG1("Did apply '%s' as log setting", opt);
+ XBT_DEBUG("Did apply '%s' as log setting", opt);
/*remove this from argv */
for (j = i + 1; j < *argc; j++) {
void xbt_log_postexit(void)
{
- VERB0("Exiting log");
+ XBT_VERB("Exiting log");
xbt_dynar_free(&xbt_log_settings);
log_cat_exit(&_XBT_LOGV(XBT_LOG_ROOT_CAT));
}
if (setting->thresh != xbt_log_priority_uninitialized) {
xbt_log_threshold_set(category, setting->thresh);
- DEBUG3("Apply settings for category '%s': set threshold to %s (=%d)",
+ XBT_DEBUG("Apply settings for category '%s': set threshold to %s (=%d)",
category->name, xbt_log_priority_names[category->threshold],
category->threshold);
}
if (setting->fmt) {
xbt_log_layout_set(category, xbt_log_layout_format_new(setting->fmt));
- DEBUG2("Apply settings for category '%s': set format to %s",
+ XBT_DEBUG("Apply settings for category '%s': set format to %s",
category->name, setting->fmt);
}
if (setting->additivity != -1) {
xbt_log_additivity_set(category, setting->additivity);
- DEBUG2("Apply settings for category '%s': set additivity to %s",
+ XBT_DEBUG("Apply settings for category '%s': set additivity to %s",
category->name, (setting->additivity ? "on" : "off"));
}
if (setting->appender) {
if (!category->layout)
xbt_log_layout_set(category, xbt_log_layout_simple_new(NULL));
category->additivity = 0;
- DEBUG2("Set %p as appender of category '%s'",
+ XBT_DEBUG("Set %p as appender of category '%s'",
setting->appender, category->name);
}
#undef _xbt_log_cat_init
xbt_log_setting_t setting = NULL;
int found = 0;
- DEBUG3("Initializing category '%s' (firstChild=%s, nextSibling=%s)",
+ XBT_DEBUG("Initializing category '%s' (firstChild=%s, nextSibling=%s)",
category->name,
(category->firstChild ? category->firstChild->name : "none"),
(category->nextSibling ? category->nextSibling->name : "none"));
if (!category->parent)
category->parent = &_XBT_LOGV(XBT_LOG_ROOT_CAT);
- DEBUG3("Set %s (%s) as father of %s ",
+ XBT_DEBUG("Set %s (%s) as father of %s ",
category->parent->name,
(category->parent->threshold == xbt_log_priority_uninitialized ?
"uninited" : xbt_log_priority_names[category->
cpp = cpp->nextSibling;
}
- DEBUG3("Childs of %s: %s; nextSibling: %s",
+ XBT_DEBUG("Childs of %s: %s; nextSibling: %s",
category->parent->name, res,
(category->parent->nextSibling ?
category->parent->nextSibling->name : "none"));
}
if (!found)
- DEBUG3("Category '%s': inherited threshold = %s (=%d)",
+ XBT_DEBUG("Category '%s': inherited threshold = %s (=%d)",
category->name, xbt_log_priority_names[category->threshold],
category->threshold);
for (; child != NULL; child = child->nextSibling) {
if (child->isThreshInherited) {
if (cat != &_XBT_LOGV(log))
- VERB3("Set category threshold of %s to %s (=%d)",
+ XBT_VERB("Set category threshold of %s to %s (=%d)",
child->name, xbt_log_priority_names[cat->threshold],
cat->threshold);
child->threshold = cat->threshold;
if (!*control_string)
return set;
- DEBUG1("Parse log setting '%s'", control_string);
+ XBT_DEBUG("Parse log setting '%s'", control_string);
control_string += strspn(control_string, " ");
name = control_string;
}
}
- DEBUG1("New priority name = %s", neweq);
+ XBT_DEBUG("New priority name = %s", neweq);
for (i = 0; i < xbt_log_priority_infinite; i++) {
if (!strncmp(xbt_log_priority_names[i], neweq, p - eq)) {
- DEBUG1("This is priority %d", i);
+ XBT_DEBUG("This is priority %d", i);
break;
}
}
memcpy(set->catname, name, dot - name);
set->catname[dot - name] = '\0'; /* Just in case */
- DEBUG1("This is for cat '%s'", set->catname);
+ XBT_DEBUG("This is for cat '%s'", set->catname);
return set;
}
{
xbt_log_category_t child, res;
- DEBUG4("Search '%s' into '%s' (firstChild='%s'; nextSibling='%s')", name,
+ XBT_DEBUG("Search '%s' into '%s' (firstChild='%s'; nextSibling='%s')", name,
cat->name, (cat->firstChild ? cat->firstChild->name : "none"),
(cat->nextSibling ? cat->nextSibling->name : "none"));
if (!strcmp(cat->name, name))
return cat;
for (child = cat->firstChild; child != NULL; child = child->nextSibling) {
- DEBUG1("Dig into %s", child->name);
+ XBT_DEBUG("Dig into %s", child->name);
res = _xbt_log_cat_searchsub(child, name);
if (res)
return res;
if (!control_string)
return;
- DEBUG1("Parse log settings '%s'", control_string);
+ XBT_DEBUG("Parse log settings '%s'", control_string);
/* Special handling of no_loc request, which asks for any file localization to be omitted (for tesh runs) */
if (!strcmp(control_string, "no_loc")) {
_xbt_log_cat_searchsub(&_XBT_LOGV(XBT_LOG_ROOT_CAT), set->catname);
if (cat) {
- DEBUG0("Apply directly");
+ XBT_DEBUG("Apply directly");
_xbt_log_cat_apply_set(cat, set);
_free_setting((void *) &set);
} else {
- DEBUG0("Store for further application");
- DEBUG1("push %p to the settings", (void *) set);
+ XBT_DEBUG("Store for further application");
+ XBT_DEBUG("push %p to the settings", (void *) set);
xbt_dynar_push(xbt_log_settings, &set);
}
}
void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay)
{
if (!cat->appender) {
- VERB1
+ XBT_VERB
("No appender to category %s. Setting the file appender as default",
cat->name);
xbt_log_appender_set(cat, xbt_log_appender_file_new(NULL));
size = 0;
m = xbt_new0(s_xbt_mallocator_t, 1);
- VERB1("Create mallocator %p", m);
+ XBT_VERB("Create mallocator %p", m);
if (XBT_LOG_ISENABLED(xbt_mallocator, xbt_log_priority_verbose))
xbt_backtrace_display_current();
int i;
xbt_assert0(m != NULL, "Invalid parameter");
- VERB3("Frees mallocator %p (size:%d/%d)", m, m->current_size,
+ XBT_VERB("Frees mallocator %p (size:%d/%d)", m, m->current_size,
m->max_size);
for (i = 0; i < m->current_size; i++) {
(*(m->free_f)) (m->objects[i]);
if (m->current_size > 0) {
/* there is at least an available object */
- /* DEBUG3("Reuse an old object for mallocator %p (size:%d/%d)", m,
+ /* XBT_DEBUG("Reuse an old object for mallocator %p (size:%d/%d)", m,
m->current_size, m->max_size); */
object = m->objects[--m->current_size];
} else {
/* otherwise we must allocate a new object */
- /* DEBUG3("Create a new object for mallocator %p (size:%d/%d)", m,
+ /* XBT_DEBUG("Create a new object for mallocator %p (size:%d/%d)", m,
m->current_size, m->max_size); */
object = (*(m->new_f)) ();
}
{
if (m->current_size < m->max_size) {
/* there is enough place to push the object */
- /* DEBUG3
+ /* XBT_DEBUG
("Store deleted object in mallocator %p for further use (size:%d/%d)",
m, m->current_size, m->max_size); */
m->objects[m->current_size++] = object;
} else {
/* otherwise we don't have a choice, we must free the object */
- /* DEBUG3("Free deleted object: mallocator %p is full (size:%d/%d)", m,
+ /* XBT_DEBUG("Free deleted object: mallocator %p is full (size:%d/%d)", m,
m->current_size, m->max_size); */
(*(m->free_f)) (object);
}
unsigned int i;
xbt_os_thread_t worker = NULL;
- DEBUG1("Create new parmap (%u workers)", num_workers);
+ XBT_DEBUG("Create new parmap (%u workers)", num_workers);
/* Initialize the thread pool data structure */
xbt_parmap_t parmap = xbt_new0(s_xbt_parmap_t, 1);
void xbt_parmap_destroy(xbt_parmap_t parmap)
{
- DEBUG1("Destroy parmap %p", parmap);
+ XBT_DEBUG("Destroy parmap %p", parmap);
parmap->status = PARMAP_DESTROY;
xbt_barrier_wait(parmap->workers_ready);
- DEBUG0("Kill job sent");
+ XBT_DEBUG("Kill job sent");
xbt_barrier_wait(parmap->workers_done);
#ifndef HAVE_FUTEX_H
xbt_os_mutex_destroy(parmap->workers_ready->mutex);
/* Notify workers that there is a job */
xbt_barrier_wait(parmap->workers_ready);
- DEBUG0("Job dispatched, lets wait...");
+ XBT_DEBUG("Job dispatched, lets wait...");
xbt_barrier_wait(parmap->workers_done);
- DEBUG0("Job done");
+ XBT_DEBUG("Job done");
parmap->fun = NULL;
parmap->data = NULL;
}
worker_id = __sync_fetch_and_add(&parmap->workers_max_id, 1);
xbt_os_thread_set_extra_data((void *)(unsigned long)worker_id);
- DEBUG1("New worker thread created (%u)", worker_id);
+ XBT_DEBUG("New worker thread created (%u)", worker_id);
/* Worker's main loop */
while(1){
xbt_barrier_wait(parmap->workers_ready);
if(parmap->status == PARMAP_WORK){
- DEBUG1("Worker %u got a job", worker_id);
+ XBT_DEBUG("Worker %u got a job", worker_id);
/* Compute how much data does every worker gets */
data_size = (xbt_dynar_length(parmap->data) / parmap->num_workers)
/* The end of the worker data segment must be bounded by the end of the data vector */
data_end = MIN(data_start + data_size, xbt_dynar_length(parmap->data));
- DEBUG4("Worker %u: data_start=%u data_end=%u (data_size=%u)",
+ XBT_DEBUG("Worker %u: data_start=%u data_end=%u (data_size=%u)",
worker_id, data_start, data_end, data_size);
/* While the worker don't pass the end of it data segment apply the function */
/* We are destroying the parmap */
}else{
xbt_barrier_wait(parmap->workers_done);
- DEBUG1("Shutting down worker %u", worker_id);
+ XBT_DEBUG("Shutting down worker %u", worker_id);
return NULL;
}
}
#ifdef HAVE_FUTEX_H
static void futex_wait(int *uaddr, int val)
{
- DEBUG1("Waiting on futex %d", *uaddr);
+ XBT_DEBUG("Waiting on futex %d", *uaddr);
syscall(SYS_futex, uaddr, FUTEX_WAIT_PRIVATE, val, NULL, NULL, 0);
}
static void futex_wake(int *uaddr, int val)
{
- DEBUG1("Waking futex %d", *uaddr);
+ XBT_DEBUG("Waking futex %d", *uaddr);
syscall(SYS_futex, uaddr, FUTEX_WAKE_PRIVATE, val, NULL, NULL, 0);
}
#endif
void fun(void *arg)
{
- //INFO1("I'm job %lu", (unsigned long)arg);
+ //XBT_INFO("I'm job %lu", (unsigned long)arg);
}
XBT_TEST_UNIT("basic", test_parmap_basic, "Basic usage")
xbt_set_elm_t found_in_dict = NULL;
xbt_ex_t e;
- VERB1("add %s to the set", elm->name);
+ XBT_VERB("add %s to the set", elm->name);
if (elm->name_len <= 0) {
elm->name_len = strlen(elm->name);
elm->ID = _xbt_set_get_id(set);
xbt_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func);
xbt_dynar_set(set->dynar, elm->ID, &elm);
- DEBUG2("Insertion of key '%s' (id %d)", elm->name, elm->ID);
+ XBT_DEBUG("Insertion of key '%s' (id %d)", elm->name, elm->ID);
xbt_ex_free(e);
}
if (found) {
if (elm == found_in_dict) {
- DEBUG2
+ XBT_DEBUG
("Ignoring request to insert the same element twice (key %s ; id %d)",
elm->name, elm->ID);
return;
} else {
elm->ID = found_in_dict->ID;
- DEBUG2("Reinsertion of key %s (id %d)", elm->name, elm->ID);
+ XBT_DEBUG("Reinsertion of key %s (id %d)", elm->name, elm->ID);
xbt_dict_set_ext(set->dict, elm->name, elm->name_len, elm,
free_func);
xbt_dynar_set(set->dynar, elm->ID, &elm);
*/
xbt_set_elm_t xbt_set_get_by_name(xbt_set_t set, const char *name)
{
- DEBUG1("Lookup key %s", name);
+ XBT_DEBUG("Lookup key %s", name);
return xbt_dict_get(set->dict, name);
}
*/
xbt_set_elm_t xbt_set_get_by_name_or_null(xbt_set_t set, const char *name)
{
- DEBUG1("Lookup key %s", name);
+ XBT_DEBUG("Lookup key %s", name);
return xbt_dict_get_or_null(set->dict, name);
}
if (res == NULL) {
THROW1(not_found_error, 0, "Invalid id: %d", id);
}
- DEBUG3("Lookup type of id %d (of %lu): %s",
+ XBT_DEBUG("Lookup type of id %d (of %lu): %s",
id, xbt_dynar_length(set->dynar), res->name);
return res;
if (set != NULL) {
if (!*cursor) {
- DEBUG0("Create the cursor on first use");
+ XBT_DEBUG("Create the cursor on first use");
*cursor = xbt_new(s_xbt_set_cursor_t, 1);
xbt_assert0(*cursor,
"Malloc error during the creation of the cursor");
xbt_binary_name = xbt_strdup(argv[0]);
srand((unsigned int) time(NULL));
- VERB0("Initialize XBT");
+ XBT_VERB("Initialize XBT");
xbt_log_init(argc, argv);
}
/** @brief Finalize the xbt mechanisms. */
void xbt_exit()
{
- WARN0("This function is deprecated, you shouldn't use it");
+ XBT_WARN("This function is deprecated, you shouldn't use it");
}
{
unsigned int i, j;
- DEBUG10
+ XBT_DEBUG
("Copy a %dx%d submatrix from %dx%d(of %dx%d) to %dx%d (of %dx%d)",
lsize, rsize, lpos_src, rpos_src, src->lines, src->rows, lpos_dst,
rpos_dst, dst->lines, dst->rows);
ts_end.tv_sec = (time_t) floor(end);
ts_end.tv_nsec = (long) ((end - ts_end.tv_sec) * 1000000000);
- DEBUG2("pthread_mutex_timedlock(%p,%p)", &(mutex->m), &ts_end);
+ XBT_DEBUG("pthread_mutex_timedlock(%p,%p)", &(mutex->m), &ts_end);
errcode = pthread_mutex_timedlock(&(mutex->m), &ts_end);
} else {
ts_end.tv_sec = (time_t) floor(end);
ts_end.tv_nsec = (long) ((end - ts_end.tv_sec) * 1000000000);
- DEBUG3("pthread_cond_timedwait(%p,%p,%p)", &(cond->c), &(mutex->m),
+ XBT_DEBUG("pthread_cond_timedwait(%p,%p,%p)", &(cond->c), &(mutex->m),
&ts_end);
switch ((errcode =
pthread_cond_timedwait(&(cond->c), &(mutex->m), &ts_end))) {
ts_end.tv_sec = (time_t) floor(end);
ts_end.tv_nsec = (long) ((end - ts_end.tv_sec) * 1000000000);
- DEBUG2("sem_timedwait(%p,%p)", sem->ps, &ts_end);
+ XBT_DEBUG("sem_timedwait(%p,%p)", sem->ps, &ts_end);
errcode = sem_timedwait(sem->s, &ts_end);
#else /* Okay, reimplement this function then */
if (delay < 0) {
xbt_os_cond_wait(cond, mutex);
} else {
- DEBUG3("xbt_cond_timedwait(%p,%p,%lu)", &(cond->events),
+ XBT_DEBUG("xbt_cond_timedwait(%p,%p,%lu)", &(cond->events),
&(mutex->lock), end);
/* lock the threads counter and increment it */
xbt_mutex_acquire(queue->mutex);
while (queue->capacity != 0
&& queue->capacity == xbt_dynar_length(queue->data)) {
- DEBUG2("Capacity of %p exceded (=%d). Waiting", queue,
+ XBT_DEBUG("Capacity of %p exceded (=%d). Waiting", queue,
queue->capacity);
xbt_cond_wait(queue->not_full, queue->mutex);
}
{
xbt_mutex_acquire(queue->mutex);
while (xbt_dynar_length(queue->data) == 0) {
- DEBUG1("Queue %p empty. Waiting", queue);
+ XBT_DEBUG("Queue %p empty. Waiting", queue);
xbt_cond_wait(queue->not_empty, queue->mutex);
}
xbt_dynar_pop(queue->data, dst);
xbt_mutex_acquire(queue->mutex);
while (queue->capacity != 0
&& queue->capacity == xbt_dynar_length(queue->data)) {
- DEBUG2("Capacity of %p exceded (=%d). Waiting", queue,
+ XBT_DEBUG("Capacity of %p exceded (=%d). Waiting", queue,
queue->capacity);
xbt_cond_wait(queue->not_full, queue->mutex);
}
{
xbt_mutex_acquire(queue->mutex);
while (xbt_dynar_length(queue->data) == 0) {
- DEBUG1("Queue %p empty. Waiting", queue);
+ XBT_DEBUG("Queue %p empty. Waiting", queue);
xbt_cond_wait(queue->not_empty, queue->mutex);
}
xbt_dynar_shift(queue->data, dst);
queue->capacity == xbt_dynar_length(queue->data) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
- DEBUG2("Capacity of %p exceded (=%d). Waiting", queue,
+ XBT_DEBUG("Capacity of %p exceded (=%d). Waiting", queue,
queue->capacity);
TRY {
xbt_cond_timedwait(queue->not_full, queue->mutex,
} else {
while ((xbt_dynar_length(queue->data) == 0) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
- DEBUG1("Queue %p empty. Waiting", queue);
+ XBT_DEBUG("Queue %p empty. Waiting", queue);
TRY {
xbt_cond_timedwait(queue->not_empty, queue->mutex,
delay < 0 ? -1 : delay - (xbt_time() - begin));
queue->capacity == xbt_dynar_length(queue->data) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
- DEBUG2("Capacity of %p exceded (=%d). Waiting", queue,
+ XBT_DEBUG("Capacity of %p exceded (=%d). Waiting", queue,
queue->capacity);
TRY {
xbt_cond_timedwait(queue->not_full, queue->mutex,
} else {
while ((xbt_dynar_length(queue->data) == 0) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
- DEBUG1("Queue %p empty. Waiting", queue);
+ XBT_DEBUG("Queue %p empty. Waiting", queue);
TRY {
xbt_cond_timedwait(queue->not_empty, queue->mutex,
delay < 0 ? -1 : delay - (xbt_time() - begin));
ssize_t read;
xbt_dynar_t d;
read = getline(&reader->line, &reader->line_len, reader->fp);
- //INFO1("got from trace: %s",reader->line);
+ //XBT_INFO("got from trace: %s",reader->line);
reader->linenum++;
if (read==-1)
return NULL; /* end of file */
static void *xbt_thread_create_wrapper(void *p)
{
xbt_thread_t t = (xbt_thread_t) p;
- DEBUG1("I'm thread %p", p);
+ XBT_DEBUG("I'm thread %p", p);
(*t->code) (t->userparam);
return NULL;
}
xbt_thread_t res = xbt_new0(s_xbt_thread_t, 1);
res->userparam = param;
res->code = code;
- DEBUG1("Create thread %p", res);
+ XBT_DEBUG("Create thread %p", res);
res->os_thread =
xbt_os_thread_create(name, xbt_thread_create_wrapper, res, NULL);
return res;
void xbt_thread_join(xbt_thread_t thread)
{
- DEBUG1("Join thread %p", thread);
+ XBT_DEBUG("Join thread %p", thread);
xbt_os_thread_join(thread->os_thread, NULL);
xbt_free(thread);
}
void xbt_thread_exit()
{
- DEBUG0("Thread exits");
+ XBT_DEBUG("Thread exits");
xbt_os_thread_exit(NULL);
}
void xbt_thread_yield(void)
{
- DEBUG0("Thread yields");
+ XBT_DEBUG("Thread yields");
xbt_os_thread_yield();
}
void xbt_thread_cancel(xbt_thread_t t)
{
- DEBUG1("Cancel thread %p", t);
+ XBT_DEBUG("Cancel thread %p", t);
xbt_os_thread_cancel(t->os_thread);
}
xbt_mutex_t xbt_mutex_init(void)
{
xbt_mutex_t res = (xbt_mutex_t) xbt_os_mutex_init();
- DEBUG1("Create mutex %p", res);
+ XBT_DEBUG("Create mutex %p", res);
return res;
}
void xbt_mutex_acquire(xbt_mutex_t mutex)
{
- DEBUG1("Acquire mutex %p", mutex);
+ XBT_DEBUG("Acquire mutex %p", mutex);
xbt_os_mutex_acquire((xbt_os_mutex_t) mutex);
}
void xbt_mutex_timedacquire(xbt_mutex_t mutex, double delay)
{
- DEBUG2("Acquire mutex %p with delay %lf", mutex, delay);
+ XBT_DEBUG("Acquire mutex %p with delay %lf", mutex, delay);
xbt_os_mutex_timedacquire((xbt_os_mutex_t) mutex, delay);
}
void xbt_mutex_release(xbt_mutex_t mutex)
{
- DEBUG1("Unlock mutex %p", mutex);
+ XBT_DEBUG("Unlock mutex %p", mutex);
xbt_os_mutex_release((xbt_os_mutex_t) mutex);
}
void xbt_mutex_destroy(xbt_mutex_t mutex)
{
- DEBUG1("Destroy mutex %p", mutex);
+ XBT_DEBUG("Destroy mutex %p", mutex);
xbt_os_mutex_destroy((xbt_os_mutex_t) mutex);
}
xbt_cond_t xbt_cond_init(void)
{
xbt_cond_t res = (xbt_cond_t) xbt_os_cond_init();
- DEBUG1("Create cond %p", res);
+ XBT_DEBUG("Create cond %p", res);
return res;
}
void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex)
{
- DEBUG2("Wait cond %p, mutex %p", cond, mutex);
+ XBT_DEBUG("Wait cond %p, mutex %p", cond, mutex);
xbt_os_cond_wait((xbt_os_cond_t) cond, (xbt_os_mutex_t) mutex);
}
void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay)
{
- DEBUG3("Wait cond %p, mutex %p for %f sec", cond, mutex, delay);
+ XBT_DEBUG("Wait cond %p, mutex %p for %f sec", cond, mutex, delay);
xbt_os_cond_timedwait((xbt_os_cond_t) cond, (xbt_os_mutex_t) mutex,
delay);
- DEBUG3("Done waiting cond %p, mutex %p for %f sec", cond, mutex, delay);
+ XBT_DEBUG("Done waiting cond %p, mutex %p for %f sec", cond, mutex, delay);
}
void xbt_cond_signal(xbt_cond_t cond)
{
- DEBUG1("Signal cond %p", cond);
+ XBT_DEBUG("Signal cond %p", cond);
xbt_os_cond_signal((xbt_os_cond_t) cond);
}
void xbt_cond_broadcast(xbt_cond_t cond)
{
- DEBUG1("Broadcast cond %p", cond);
+ XBT_DEBUG("Broadcast cond %p", cond);
xbt_os_cond_broadcast((xbt_os_cond_t) cond);
}
void xbt_cond_destroy(xbt_cond_t cond)
{
- DEBUG1("Destroy cond %p", cond);
+ XBT_DEBUG("Destroy cond %p", cond);
xbt_os_cond_destroy((xbt_os_cond_t) cond);
}
if (end_var == beg_var)
THROW0(arg_error, 0, "Variable name empty ($ is not valid)");
}
-/* DEBUG5("var='%.*s'; subst='%.*s'; End_var = '%s'",
+/* XBT_DEBUG("var='%.*s'; subst='%.*s'; End_var = '%s'",
end_var-beg_var,beg_var,
end_subst-beg_subst,beg_subst,
end_var);*/
/* ok, we now have the variable name. Search the dictionary for the substituted value */
value =
xbt_dict_get_or_null_ext(patterns, beg_var, end_var - beg_var);
-/* DEBUG1("Deal with '%s'",b->data);
- DEBUG4("Search for %.*s, found %s (default value = %s)\n",
+/* XBT_DEBUG("Deal with '%s'",b->data);
+ XBT_DEBUG("Search for %.*s, found %s (default value = %s)\n",
end_var-beg_var,beg_var,
(value?value:"(no value)"),
(default_value?default_value:"(no value)"));*/
/* En route for the actual substitution */
val_len = strlen(value);
-// DEBUG2("val_len = %d, key_len=%d",val_len,end_subst-beg_subst);
+// XBT_DEBUG("val_len = %d, key_len=%d",val_len,end_subst-beg_subst);
if (val_len <= end_subst - beg_subst) {
/* enough room to do the substitute in place */
-// DEBUG4("Substitute key name by its value: ie '%.*s' by '%.*s'",end_subst-beg_subst,beg_subst,val_len,value);
+// XBT_DEBUG("Substitute key name by its value: ie '%.*s' by '%.*s'",end_subst-beg_subst,beg_subst,val_len,value);
memmove(beg_subst, value, val_len); /* substitute */
-// DEBUG1("String is now: '%s'",b->data);
-/* DEBUG8("Move end of string closer (%d chars moved) :\n-'%.*s%.*s'\n+'%.*s%s'",
+// XBT_DEBUG("String is now: '%s'",b->data);
+/* XBT_DEBUG("Move end of string closer (%d chars moved) :\n-'%.*s%.*s'\n+'%.*s%s'",
b->used - (end_subst - b->data) + 1,
beg_subst-b->data,b->data,
b->used-(end_subst-b->data)+1,beg_subst+val_len,
beg_subst-b->data,b->data,
end_subst);*/
memmove(beg_subst + val_len, end_subst, b->used - (end_subst - b->data) + 1); /* move the end of the string closer */
-// DEBUG1("String is now: '%s'",b->data);
+// XBT_DEBUG("String is now: '%s'",b->data);
end = beg_subst + val_len; /* update the currently explored char in the overall loop */
-// DEBUG1("end of substituted section is now '%s'",end);
+// XBT_DEBUG("end of substituted section is now '%s'",end);
b->used -= end_subst - beg_subst - val_len; /* update string buffer used size */
-// DEBUG3("Used:%d end:%d ending char:%d",b->used,end-b->data,*end);
+// XBT_DEBUG("Used:%d end:%d ending char:%d",b->used,end-b->data,*end);
} else {
/* we have to extend the data area */
int tooshort =
val_len - (end_subst - beg_subst) + 1 /*don't forget \0 */ ;
int newused = b->used + tooshort;
end += tooshort; /* update the pointer of the overall loop */
-// DEBUG2("Too short (by %d chars; %d chars left in area)",val_len- (end_subst-beg_subst), b->size - b->used);
+// XBT_DEBUG("Too short (by %d chars; %d chars left in area)",val_len- (end_subst-beg_subst), b->size - b->used);
if (newused > b->size) {
/* We have to realloc the data area before (because b->size is too small). We have to update our pointers, too */
char *newdata = realloc(b->data,
memmove(beg_subst + val_len, end_subst, b->used - (end_subst - b->data) + 1); /* move the end of the string a bit further */
memmove(beg_subst, value, val_len); /* substitute */
b->used = newused;
-// DEBUG1("String is now: %s",b->data);
+// XBT_DEBUG("String is now: %s",b->data);
}
free(value);
return;
}
/* Start all workers */
- INFO1("Dopar for %ld elements", xbt_dynar_length(datas));
+ XBT_INFO("Dopar for %ld elements", xbt_dynar_length(datas));
xbt_dynar_foreach(datas, cursor, data) {
worker_data_t w = xbt_new0(s_worker_data_t, 1);
w->data = datas;
static void add100(int rank, void *data)
{
- //INFO2("Thread%d: Add 100 to %d",rank,*(int*)data);
+ //XBT_INFO("Thread%d: Add 100 to %d",rank,*(int*)data);
*(int *) data += 100;
}
struct dcdc my_dcdc =
{ 1424420.11331 + (double) 1, 'w' + (char) 2,
1424420.11331 + (double) 3, 'w' + (char) 4 }, my_dcdc2;
- INFO0
+ XBT_INFO
("---- Test on all possible struct having 3 fields (49 structs) ----");
write_read("cccc", &my_cccc, &my_cccc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_cccc.c == my_cccc2.c);
test(my_cccc.d == my_cccc2.d);
if (!failed)
- VERB0("Passed cccc");
+ XBT_VERB("Passed cccc");
}
write_read("ccsc", &my_ccsc, &my_ccsc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_ccsc.c == my_ccsc2.c);
test(my_ccsc.d == my_ccsc2.d);
if (!failed)
- VERB0("Passed ccsc");
+ XBT_VERB("Passed ccsc");
}
write_read("ccic", &my_ccic, &my_ccic2, sock, direction);
if (direction == READ || direction == RW) {
test(my_ccic.c == my_ccic2.c);
test(my_ccic.d == my_ccic2.d);
if (!failed)
- VERB0("Passed ccic");
+ XBT_VERB("Passed ccic");
}
write_read("cclc", &my_cclc, &my_cclc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_cclc.c == my_cclc2.c);
test(my_cclc.d == my_cclc2.d);
if (!failed)
- VERB0("Passed cclc");
+ XBT_VERB("Passed cclc");
}
write_read("ccLc", &my_ccLc, &my_ccLc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_ccLc.c == my_ccLc2.c);
test(my_ccLc.d == my_ccLc2.d);
if (!failed)
- VERB0("Passed ccLc");
+ XBT_VERB("Passed ccLc");
}
write_read("ccfc", &my_ccfc, &my_ccfc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_ccfc.c == my_ccfc2.c);
test(my_ccfc.d == my_ccfc2.d);
if (!failed)
- VERB0("Passed ccfc");
+ XBT_VERB("Passed ccfc");
}
write_read("ccdc", &my_ccdc, &my_ccdc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_ccdc.c == my_ccdc2.c);
test(my_ccdc.d == my_ccdc2.d);
if (!failed)
- VERB0("Passed ccdc");
+ XBT_VERB("Passed ccdc");
}
write_read("sccc", &my_sccc, &my_sccc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_sccc.c == my_sccc2.c);
test(my_sccc.d == my_sccc2.d);
if (!failed)
- VERB0("Passed sccc");
+ XBT_VERB("Passed sccc");
}
write_read("scsc", &my_scsc, &my_scsc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_scsc.c == my_scsc2.c);
test(my_scsc.d == my_scsc2.d);
if (!failed)
- VERB0("Passed scsc");
+ XBT_VERB("Passed scsc");
}
write_read("scic", &my_scic, &my_scic2, sock, direction);
if (direction == READ || direction == RW) {
test(my_scic.c == my_scic2.c);
test(my_scic.d == my_scic2.d);
if (!failed)
- VERB0("Passed scic");
+ XBT_VERB("Passed scic");
}
write_read("sclc", &my_sclc, &my_sclc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_sclc.c == my_sclc2.c);
test(my_sclc.d == my_sclc2.d);
if (!failed)
- VERB0("Passed sclc");
+ XBT_VERB("Passed sclc");
}
write_read("scLc", &my_scLc, &my_scLc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_scLc.c == my_scLc2.c);
test(my_scLc.d == my_scLc2.d);
if (!failed)
- VERB0("Passed scLc");
+ XBT_VERB("Passed scLc");
}
write_read("scfc", &my_scfc, &my_scfc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_scfc.c == my_scfc2.c);
test(my_scfc.d == my_scfc2.d);
if (!failed)
- VERB0("Passed scfc");
+ XBT_VERB("Passed scfc");
}
write_read("scdc", &my_scdc, &my_scdc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_scdc.c == my_scdc2.c);
test(my_scdc.d == my_scdc2.d);
if (!failed)
- VERB0("Passed scdc");
+ XBT_VERB("Passed scdc");
}
write_read("iccc", &my_iccc, &my_iccc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_iccc.c == my_iccc2.c);
test(my_iccc.d == my_iccc2.d);
if (!failed)
- VERB0("Passed iccc");
+ XBT_VERB("Passed iccc");
}
write_read("icsc", &my_icsc, &my_icsc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_icsc.c == my_icsc2.c);
test(my_icsc.d == my_icsc2.d);
if (!failed)
- VERB0("Passed icsc");
+ XBT_VERB("Passed icsc");
}
write_read("icic", &my_icic, &my_icic2, sock, direction);
if (direction == READ || direction == RW) {
test(my_icic.c == my_icic2.c);
test(my_icic.d == my_icic2.d);
if (!failed)
- VERB0("Passed icic");
+ XBT_VERB("Passed icic");
}
write_read("iclc", &my_iclc, &my_iclc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_iclc.c == my_iclc2.c);
test(my_iclc.d == my_iclc2.d);
if (!failed)
- VERB0("Passed iclc");
+ XBT_VERB("Passed iclc");
}
write_read("icLc", &my_icLc, &my_icLc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_icLc.c == my_icLc2.c);
test(my_icLc.d == my_icLc2.d);
if (!failed)
- VERB0("Passed icLc");
+ XBT_VERB("Passed icLc");
}
write_read("icfc", &my_icfc, &my_icfc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_icfc.c == my_icfc2.c);
test(my_icfc.d == my_icfc2.d);
if (!failed)
- VERB0("Passed icfc");
+ XBT_VERB("Passed icfc");
}
write_read("icdc", &my_icdc, &my_icdc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_icdc.c == my_icdc2.c);
test(my_icdc.d == my_icdc2.d);
if (!failed)
- VERB0("Passed icdc");
+ XBT_VERB("Passed icdc");
}
write_read("lccc", &my_lccc, &my_lccc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_lccc.c == my_lccc2.c);
test(my_lccc.d == my_lccc2.d);
if (!failed)
- VERB0("Passed lccc");
+ XBT_VERB("Passed lccc");
}
write_read("lcsc", &my_lcsc, &my_lcsc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_lcsc.c == my_lcsc2.c);
test(my_lcsc.d == my_lcsc2.d);
if (!failed)
- VERB0("Passed lcsc");
+ XBT_VERB("Passed lcsc");
}
write_read("lcic", &my_lcic, &my_lcic2, sock, direction);
if (direction == READ || direction == RW) {
test(my_lcic.c == my_lcic2.c);
test(my_lcic.d == my_lcic2.d);
if (!failed)
- VERB0("Passed lcic");
+ XBT_VERB("Passed lcic");
}
write_read("lclc", &my_lclc, &my_lclc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_lclc.c == my_lclc2.c);
test(my_lclc.d == my_lclc2.d);
if (!failed)
- VERB0("Passed lclc");
+ XBT_VERB("Passed lclc");
}
write_read("lcLc", &my_lcLc, &my_lcLc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_lcLc.c == my_lcLc2.c);
test(my_lcLc.d == my_lcLc2.d);
if (!failed)
- VERB0("Passed lcLc");
+ XBT_VERB("Passed lcLc");
}
write_read("lcfc", &my_lcfc, &my_lcfc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_lcfc.c == my_lcfc2.c);
test(my_lcfc.d == my_lcfc2.d);
if (!failed)
- VERB0("Passed lcfc");
+ XBT_VERB("Passed lcfc");
}
write_read("lcdc", &my_lcdc, &my_lcdc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_lcdc.c == my_lcdc2.c);
test(my_lcdc.d == my_lcdc2.d);
if (!failed)
- VERB0("Passed lcdc");
+ XBT_VERB("Passed lcdc");
}
write_read("Lccc", &my_Lccc, &my_Lccc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_Lccc.c == my_Lccc2.c);
test(my_Lccc.d == my_Lccc2.d);
if (!failed)
- VERB0("Passed Lccc");
+ XBT_VERB("Passed Lccc");
}
write_read("Lcsc", &my_Lcsc, &my_Lcsc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_Lcsc.c == my_Lcsc2.c);
test(my_Lcsc.d == my_Lcsc2.d);
if (!failed)
- VERB0("Passed Lcsc");
+ XBT_VERB("Passed Lcsc");
}
write_read("Lcic", &my_Lcic, &my_Lcic2, sock, direction);
if (direction == READ || direction == RW) {
test(my_Lcic.c == my_Lcic2.c);
test(my_Lcic.d == my_Lcic2.d);
if (!failed)
- VERB0("Passed Lcic");
+ XBT_VERB("Passed Lcic");
}
write_read("Lclc", &my_Lclc, &my_Lclc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_Lclc.c == my_Lclc2.c);
test(my_Lclc.d == my_Lclc2.d);
if (!failed)
- VERB0("Passed Lclc");
+ XBT_VERB("Passed Lclc");
}
write_read("LcLc", &my_LcLc, &my_LcLc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_LcLc.c == my_LcLc2.c);
test(my_LcLc.d == my_LcLc2.d);
if (!failed)
- VERB0("Passed LcLc");
+ XBT_VERB("Passed LcLc");
}
write_read("Lcfc", &my_Lcfc, &my_Lcfc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_Lcfc.c == my_Lcfc2.c);
test(my_Lcfc.d == my_Lcfc2.d);
if (!failed)
- VERB0("Passed Lcfc");
+ XBT_VERB("Passed Lcfc");
}
write_read("Lcdc", &my_Lcdc, &my_Lcdc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_Lcdc.c == my_Lcdc2.c);
test(my_Lcdc.d == my_Lcdc2.d);
if (!failed)
- VERB0("Passed Lcdc");
+ XBT_VERB("Passed Lcdc");
}
write_read("fccc", &my_fccc, &my_fccc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_fccc.c == my_fccc2.c);
test(my_fccc.d == my_fccc2.d);
if (!failed)
- VERB0("Passed fccc");
+ XBT_VERB("Passed fccc");
}
write_read("fcsc", &my_fcsc, &my_fcsc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_fcsc.c == my_fcsc2.c);
test(my_fcsc.d == my_fcsc2.d);
if (!failed)
- VERB0("Passed fcsc");
+ XBT_VERB("Passed fcsc");
}
write_read("fcic", &my_fcic, &my_fcic2, sock, direction);
if (direction == READ || direction == RW) {
test(my_fcic.c == my_fcic2.c);
test(my_fcic.d == my_fcic2.d);
if (!failed)
- VERB0("Passed fcic");
+ XBT_VERB("Passed fcic");
}
write_read("fclc", &my_fclc, &my_fclc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_fclc.c == my_fclc2.c);
test(my_fclc.d == my_fclc2.d);
if (!failed)
- VERB0("Passed fclc");
+ XBT_VERB("Passed fclc");
}
write_read("fcLc", &my_fcLc, &my_fcLc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_fcLc.c == my_fcLc2.c);
test(my_fcLc.d == my_fcLc2.d);
if (!failed)
- VERB0("Passed fcLc");
+ XBT_VERB("Passed fcLc");
}
write_read("fcfc", &my_fcfc, &my_fcfc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_fcfc.c == my_fcfc2.c);
test(my_fcfc.d == my_fcfc2.d);
if (!failed)
- VERB0("Passed fcfc");
+ XBT_VERB("Passed fcfc");
}
write_read("fcdc", &my_fcdc, &my_fcdc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_fcdc.c == my_fcdc2.c);
test(my_fcdc.d == my_fcdc2.d);
if (!failed)
- VERB0("Passed fcdc");
+ XBT_VERB("Passed fcdc");
}
write_read("dccc", &my_dccc, &my_dccc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_dccc.c == my_dccc2.c);
test(my_dccc.d == my_dccc2.d);
if (!failed)
- VERB0("Passed dccc");
+ XBT_VERB("Passed dccc");
}
write_read("dcsc", &my_dcsc, &my_dcsc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_dcsc.c == my_dcsc2.c);
test(my_dcsc.d == my_dcsc2.d);
if (!failed)
- VERB0("Passed dcsc");
+ XBT_VERB("Passed dcsc");
}
write_read("dcic", &my_dcic, &my_dcic2, sock, direction);
if (direction == READ || direction == RW) {
test(my_dcic.c == my_dcic2.c);
test(my_dcic.d == my_dcic2.d);
if (!failed)
- VERB0("Passed dcic");
+ XBT_VERB("Passed dcic");
}
write_read("dclc", &my_dclc, &my_dclc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_dclc.c == my_dclc2.c);
test(my_dclc.d == my_dclc2.d);
if (!failed)
- VERB0("Passed dclc");
+ XBT_VERB("Passed dclc");
}
write_read("dcLc", &my_dcLc, &my_dcLc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_dcLc.c == my_dcLc2.c);
test(my_dcLc.d == my_dcLc2.d);
if (!failed)
- VERB0("Passed dcLc");
+ XBT_VERB("Passed dcLc");
}
write_read("dcfc", &my_dcfc, &my_dcfc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_dcfc.c == my_dcfc2.c);
test(my_dcfc.d == my_dcfc2.d);
if (!failed)
- VERB0("Passed dcfc");
+ XBT_VERB("Passed dcfc");
}
write_read("dcdc", &my_dcdc, &my_dcdc2, sock, direction);
if (direction == READ || direction == RW) {
test(my_dcdc.c == my_dcdc2.c);
test(my_dcdc.d == my_dcdc2.d);
if (!failed)
- VERB0("Passed dcdc");
+ XBT_VERB("Passed dcdc");
}
}
{
int i = 5, j;
- INFO0("---- Test on integer ----");
+ XBT_INFO("---- Test on integer ----");
write_read("int", &i, &j, sock, direction);
if (direction == READ || direction == COPY)
xbt_assert(i == j);
{
float i = 5.0, j;
- INFO0("---- Test on float ----");
+ XBT_INFO("---- Test on float ----");
write_read("float", &i, &j, sock, direction);
if (direction == READ || direction == COPY)
xbt_assert2(i == j, "%f != %f", i, j);
{
double i = -3252355.1234, j;
- INFO0("---- Test on double ----");
+ XBT_INFO("---- Test on double ----");
write_read("double", &i, &j, sock, direction);
if (direction == READ || direction == COPY)
xbt_assert2(i == j, "%f != %f", i, j);
array j;
int cpt;
- INFO0("---- Test on fixed array ----");
+ XBT_INFO("---- Test on fixed array ----");
write_read("fixed int array", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
for (cpt = 0; cpt < FIXED_ARRAY_SIZE; cpt++) {
- DEBUG1("Test spot %d", cpt);
+ XBT_DEBUG("Test spot %d", cpt);
xbt_assert4(i[cpt] == j[cpt], "i[%d]=%d != j[%d]=%d",
cpt, i[cpt], cpt, j[cpt]);
}
xbt_dynar_t i, j;
int cpt;
- INFO0("---- Test on dynar containing integers ----");
+ XBT_INFO("---- Test on dynar containing integers ----");
i = xbt_dynar_new(sizeof(int), NULL);
for (cpt = 0; cpt < 64; cpt++) {
xbt_dynar_push_as(i, int, cpt);
- DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(i));
+ XBT_DEBUG("Push %d, length=%lu", cpt, xbt_dynar_length(i));
}
/* xbt_dynar_dump(i); */
write_read("xbt_dynar_of_int", &i, &j, sock, direction);
for (cpt = 0; cpt < 64; cpt++) {
int ret = xbt_dynar_get_as(j, cpt, int);
if (cpt != ret) {
- CRITICAL3
+ XBT_CRITICAL
("The retrieved value for cpt=%d is not the same than the injected one (%d!=%d)",
cpt, ret, cpt);
xbt_abort();
{
xbt_dynar_t i, j;
- INFO0("---- Test on empty dynar of integers ----");
+ XBT_INFO("---- Test on empty dynar of integers ----");
i = xbt_dynar_new(sizeof(int), NULL);
write_read("xbt_dynar_of_int", &i, &j, sock, direction);
/* xbt_dynar_dump(j); */
i = xbt_new(int, 1);
*i = 12345;
- INFO0("---- Test on a reference to an integer ----");
+ XBT_INFO("---- Test on a reference to an integer ----");
write_read("int*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
char *i = xbt_strdup("Some data"), *j = NULL;
int cpt;
- INFO0("---- Test on string (ref to dynamic array) ----");
+ XBT_INFO("---- Test on string (ref to dynamic array) ----");
write_read("string", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
for (cpt = 0; cpt < strlen(i); cpt++) {
{
homostruct *i, *j;
- INFO0("---- Test on homogeneous structure ----");
+ XBT_INFO("---- Test on homogeneous structure ----");
/* init a value, exchange it and check its validity */
i = xbt_new(homostruct, 1);
i->a = 2235;
{
hetestruct *i, *j;
- INFO0("---- Test on heterogeneous structure ----");
+ XBT_INFO("---- Test on heterogeneous structure ----");
/* init a value, exchange it and check its validity */
i = xbt_new(hetestruct, 1);
i->c1 = 's';
hetestruct *i, *j, *p, *q;
int cpt;
- INFO0("---- Test on heterogeneous structure arrays ----");
+ XBT_INFO("---- Test on heterogeneous structure arrays ----");
/* init a value, exchange it and check its validity */
i = xbt_malloc(sizeof(hetestruct) * 10);
for (cpt = 0, p = i; cpt < 10; cpt++, p++) {
{
nestedstruct *i, *j;
- INFO0("---- Test on nested structures ----");
+ XBT_INFO("---- Test on nested structures ----");
/* init a value, exchange it and check its validity */
i = xbt_new(nestedstruct, 1);
i->homo.a = 235231;
{
chained_list_t *i, *j;
- INFO0("---- Test on chained list ----");
+ XBT_INFO("---- Test on chained list ----");
/* init a value, exchange it and check its validity */
i = cons(12355, cons(246264, cons(23263, NULL)));
{
chained_list_t *i, *j;
- INFO0("---- Test on graph (cyclique chained list of 3 items) ----");
+ XBT_INFO("---- Test on graph (cyclique chained list of 3 items) ----");
/* init a value, exchange it and check its validity */
i = cons(1151515, cons(-232362, cons(222552, NULL)));
i->l->l->l = i;
write_read("chained_list_t*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
- DEBUG1("i=%p", i);
- DEBUG1("i->l=%p", i->l);
- DEBUG1("i->l->l=%p", i->l->l);
- DEBUG1("i->l->l->l=%p", i->l->l->l);
- DEBUG1("j=%p", j);
- DEBUG1("j->l=%p", j->l);
- DEBUG1("j->l->l=%p", j->l->l);
- DEBUG1("j->l->l->l=%p", j->l->l->l);
+ XBT_DEBUG("i=%p", i);
+ XBT_DEBUG("i->l=%p", i->l);
+ XBT_DEBUG("i->l->l=%p", i->l->l);
+ XBT_DEBUG("i->l->l->l=%p", i->l->l->l);
+ XBT_DEBUG("j=%p", j);
+ XBT_DEBUG("j->l=%p", j->l);
+ XBT_DEBUG("j->l->l=%p", j->l->l);
+ XBT_DEBUG("j->l->l->l=%p", j->l->l->l);
xbt_assert4(j->l->l->l == j,
"Received list is not cyclic. j=%p != j->l->l->l=%p\n"
"j=%p; &j=%p", j, j->l->l->l, j, &j);
char *s1, *s2;
int cpt;
- INFO0("---- Test on dynar containing integers ----");
+ XBT_INFO("---- Test on dynar containing integers ----");
i = xbt_dynar_new(sizeof(char *), &free_string);
for (cpt = 0; cpt < 64; cpt++) {
gras_datadesc_type_t pbio_type;
pbio_t i, j;
- INFO0
+ XBT_INFO
("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
pbio_type = gras_datadesc_by_symbol(s_pbio);
Clause *i, *j;
int cpt;
- INFO0
+ XBT_INFO
("---- Test on struct containing dynamic array and its size (cbps test) ----");
/* create and fill the struct */
i->literals = xbt_new(int, i->num_lits);
for (cpt = 0; cpt < i->num_lits; cpt++)
i->literals[cpt] = cpt * cpt - ((cpt * cpt) / 2);
- DEBUG3("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
- DEBUG1("created count=%d", i->num_lits);
+ XBT_DEBUG("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
+ XBT_DEBUG("created count=%d", i->num_lits);
write_read("Clause*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
{
Clause *i, *j;
- INFO0
+ XBT_INFO
("---- Test on struct containing dynamic array and its size when size=0 (cbps test) ----");
/* create and fill the struct */
i->num_lits = 0;
i->literals = NULL;
- DEBUG3("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
- DEBUG1("created count=%d", i->num_lits);
+ XBT_DEBUG("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
+ XBT_DEBUG("created count=%d", i->num_lits);
write_read("Clause*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
for (cpt = 1; cpt < argc; cpt++) {
if (!strcmp(argv[cpt], "--arch")) {
- INFO2("We are on %s (#%d)",
+ XBT_INFO("We are on %s (#%d)",
gras_datadesc_arch_name(gras_arch_selfid()),
(int) gras_arch_selfid());
exit(0);
}
if (direction == WRITE) {
- INFO1("Write to file %s",
+ XBT_INFO("Write to file %s",
strrchr(filename, '/') ? strrchr(filename, '/') + 1 : filename);
sock = gras_socket_client_from_file(filename);
}
if (direction == READ) {
- INFO1("Read from file %s",
+ XBT_INFO("Read from file %s",
strrchr(filename, '/') ? strrchr(filename, '/') + 1 : filename);
sock = gras_socket_server_from_file(filename);
}
if (direction == COPY) {
- INFO0("Memory copy");
+ XBT_INFO("Memory copy");
}
local_arch = gras_arch_selfid();
write_read("char", &local_arch, &remote_arch, sock, direction);
if (direction == READ)
- VERB2("This file was generated on %s (%d)",
+ XBT_VERB("This file was generated on %s (%d)",
gras_datadesc_arch_name(remote_arch), (int) remote_arch);
"};)\n";
}}}}
-# print "\n#define test(a) do {if (!(a)) { failed = 1; ERROR1(\"%s failed\",#a);}} while (0)\n";
+# print "\n#define test(a) do {if (!(a)) { failed = 1; XBT_ERROR(\"%s failed\",#a);}} while (0)\n";
print "\n#define test(a) xbt_assert(a)\n";
print "void register_structures(void);\n";
.$val[$l]."+(".$types[$l].")4}, my_${struct}2;\n";
}}}}
-print " INFO0(\"---- Test on all possible struct having 3 fields (".(($max_i+1)*($max_j+1)*($max_k+1)*($max_l+1))." structs) ----\");\n";
+print " XBT_INFO(\"---- Test on all possible struct having 3 fields (".(($max_i+1)*($max_j+1)*($max_k+1)*($max_l+1))." structs) ----\");\n";
for $i (0..$max_i) { for $j (0..$max_j) { for $k (0..$max_k) { for $l (0..$max_l) {
my $struct=$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l];
print " write_read(\"$struct\", &my_$struct, &my_${struct}2, sock,direction);\n";
print " test(my_$struct.b == my_${struct}2.b);\n";
print " test(my_$struct.c == my_${struct}2.c);\n";
print " test(my_$struct.d == my_${struct}2.d);\n";
- print " if (!failed) VERB0(\"Passed $struct\");\n";
+ print " if (!failed) XBT_VERB(\"Passed $struct\");\n";
print " }\n";
}}}}
print "}\n";
static int server_cb_hello_handler(gras_msg_cb_ctx_t ctx,
void *payload_data)
{
- INFO0("Got the message");
+ XBT_INFO("Got the message");
return 0;
}
gras_msgtype_declare("hello", NULL);
gras_cb_register("hello", &server_cb_hello_handler);
- INFO1("Launch server (port=%d)", myport);
+ XBT_INFO("Launch server (port=%d)", myport);
TRY {
me = gras_socket_server(myport);
} CATCH(e) {
} CATCH(e) {
RETHROW1("Unable to establish a socket to %s: %s", palstr);
}
- INFO0("Initialization done.");
+ XBT_INFO("Initialization done.");
now = gras_os_time();
/* Launch handle(0) when there is no message. Timeout expected */
xbt_assert1(gras_os_time() - now < 0.01,
"gras_msg_handle(0) do not anwser immediately (%.4fsec)",
gras_os_time() - now);
- INFO0("gras_msg_handle(0) works as expected (immediate timeout)");
+ XBT_INFO("gras_msg_handle(0) works as expected (immediate timeout)");
/* Launch handle(0) when there is no message. Timeout expected */
got_expected = 0;
TRY {
xbt_assert1(gras_os_time() - now >= 1.0,
"gras_msg_handle(1) answers in less than one second (%.4fsec)",
gras_os_time() - now);
- INFO0("gras_msg_handle(1) works as expected (delayed timeout)");
+ XBT_INFO("gras_msg_handle(1) works as expected (delayed timeout)");
gras_os_sleep(3);
/* Send an hello to the client to unlock it */
- INFO0("Unlock pal");
+ XBT_INFO("Unlock pal");
gras_msg_send(pal, "hello", NULL);
/* Frees the allocated resources, and shut GRAS down */
gras_msgtype_declare("hello", NULL);
gras_cb_register("hello", &server_cb_hello_handler);
- INFO1("Launch client (port=%d)", myport);
+ XBT_INFO("Launch client (port=%d)", myport);
TRY {
me = gras_socket_server(myport);
} CATCH(e) {
} CATCH(e) {
RETHROW1("Unable to establish a socket to %s: %s", palstr);
}
- INFO0("Initialization done.");
+ XBT_INFO("Initialization done.");
/* Launch handle(-1). Lock until message from server expected */
got_expected = 0;
} CATCH(e) {
RETHROW0("No exception expected during handle(-1), but got %s");
}
- INFO0("gras_msg_handle(-1) works as expected (locked)");
+ XBT_INFO("gras_msg_handle(-1) works as expected (locked)");
/* Frees the allocated resources, and shut GRAS down */
gras_socket_close(me);
{
gras_init(&argc, argv);
gras_msg_handleall(100);
- INFO0("Let's go 1E-5");
+ XBT_INFO("Let's go 1E-5");
gras_msg_handleall(1E-5);
- INFO0("Let's go 1E-10");
+ XBT_INFO("Let's go 1E-10");
gras_msg_handleall(1E-10);
- INFO0("Let's go 1E-15");
+ XBT_INFO("Let's go 1E-15");
gras_msg_handleall(1E-15);
- INFO0("Let's go 1E-20");
+ XBT_INFO("Let's go 1E-20");
gras_msg_handleall(1E-20);
- INFO0("done");
+ XBT_INFO("done");
gras_exit();
return 0;
}
static int send(int argc, char *argv[])
{
- INFO0("Sending");
+ XBT_INFO("Sending");
MSG_task_put(MSG_task_create("Blah", 0.0, 0.0, NULL), MSG_host_self(),
0);
MSG_process_sleep(1.); /* FIXME: if the sender exits before the receiver calls get_sender(), bad thing happens */
- INFO0("Exiting");
+ XBT_INFO("Exiting");
return 0;
}
static int receive(int argc, char *argv[])
{
- INFO0("Receiving");
+ XBT_INFO("Receiving");
m_task_t task = NULL;
MSG_task_get_with_timeout(&task, 0, DBL_MAX);
xbt_assert0(MSG_task_get_sender(task), "No sender received");
- INFO1("Got a message sent by '%s'",
+ XBT_INFO("Got a message sent by '%s'",
MSG_process_get_name(MSG_task_get_sender(task)));
return 0;
}
SD_simulate(-1.0);
- INFO1("Simulation time: %f", SD_get_clock());
+ XBT_INFO("Simulation time: %f", SD_get_clock());
SD_exit();
return 0;
SD_task_dependency_add(NULL, NULL, taskInit, taskB);
SD_simulate(-1.0);
- INFO1("Simulation time: %f", SD_get_clock());
+ XBT_INFO("Simulation time: %f", SD_get_clock());
SD_exit();
return 0;
SD_simulate(-1.0);
- INFO1("Simulation time: %f", SD_get_clock());
+ XBT_INFO("Simulation time: %f", SD_get_clock());
SD_exit();
return 0;
SD_simulate(-1.0);
- INFO1("Simulation time: %f", SD_get_clock());
+ XBT_INFO("Simulation time: %f", SD_get_clock());
SD_exit();
return 0;
SD_simulate(-1.0);
- INFO1("Simulation time: %f", SD_get_clock());
+ XBT_INFO("Simulation time: %f", SD_get_clock());
SD_exit();
return 0;
SD_simulate(-1.0);
- INFO1("Simulation time: %f", SD_get_clock());
+ XBT_INFO("Simulation time: %f", SD_get_clock());
SD_exit();
return 0;
SD_simulate(-1.0);
- INFO1("Simulation time: %f", SD_get_clock());
+ XBT_INFO("Simulation time: %f", SD_get_clock());
SD_exit();
return 0;
SD_init(&argc, argv);
platformFile = argv[1];
- DEBUG1("%s", platformFile);
+ XBT_DEBUG("%s", platformFile);
TRY {
SD_create_environment(platformFile);
} CATCH(e) {
xbt_init(&argc, argv);
- INFO10("This is a very large message:\n0%s1%s2%s3%s4%s5%s6%s7%s8%s9%s",
+ XBT_INFO("This is a very large message:\n0%s1%s2%s3%s4%s5%s6%s7%s8%s9%s",
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp);
- INFO1("Done (strlen>%d)", (int) (10 * strlen(tmp)));
+ XBT_INFO("Done (strlen>%d)", (int) (10 * strlen(tmp)));
free(tmp);
return 0;
for (i = 0; i < test_amount; i++) {
if (more_info)
- INFO10("%03d (%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d)",
+ XBT_INFO("%03d (%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d)",
test_amount - i, id, id, id, id, id, id, id, id, id);
else
- INFO0("XXX (XX|XX|XX|XX|XX|XX|XX|XX|XX)");
+ XBT_INFO("XXX (XX|XX|XX|XX|XX|XX|XX|XX|XX)");
}
}
XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
"Messages specific for surf example");
-#define PRINT_VAR(var) DEBUG1(#var " = %g",lmm_variable_getvalue(var));
-#define SHOW_EXPR(expr) DEBUG1(#expr " = %g",expr);
+#define PRINT_VAR(var) XBT_DEBUG(#var " = %g",lmm_variable_getvalue(var));
+#define SHOW_EXPR(expr) XBT_DEBUG(#expr " = %g",expr);
/* */
/* ______ */
MAX(max_deviation, fabs(lmm_variable_getvalue(R_1_2_3) - (a - x)));
if (max_deviation > MAXMIN_PRECISION) {
- WARN1("Max Deviation from optimal solution : %g", max_deviation);
- WARN1("Found x = %1.20f", x);
- WARN2("Deviation from optimal solution (R_1 = %g): %1.20f", x,
+ XBT_WARN("Max Deviation from optimal solution : %g", max_deviation);
+ XBT_WARN("Found x = %1.20f", x);
+ XBT_WARN("Deviation from optimal solution (R_1 = %g): %1.20f", x,
lmm_variable_getvalue(R_1) - x);
- WARN2("Deviation from optimal solution (R_2 = %g): %1.20f",
+ XBT_WARN("Deviation from optimal solution (R_2 = %g): %1.20f",
b - a + x, lmm_variable_getvalue(R_2) - (b - a + x));
- WARN2("Deviation from optimal solution (R_3 = %g): %1.20f", x,
+ XBT_WARN("Deviation from optimal solution (R_3 = %g): %1.20f", x,
lmm_variable_getvalue(R_3) - x);
- WARN2("Deviation from optimal solution (R_1_2_3 = %g): %1.20f",
+ XBT_WARN("Deviation from optimal solution (R_1_2_3 = %g): %1.20f",
a - x, lmm_variable_getvalue(R_1_2_3) - (a - x));
}
} else if (method == LAGRANGE_RENO) {
MAX(max_deviation, fabs(lmm_variable_getvalue(R_1_2_3) - (a - x)));
if (max_deviation > MAXMIN_PRECISION) {
- WARN1("Max Deviation from optimal solution : %g", max_deviation);
- WARN1("Found x = %1.20f", x);
- WARN2("Deviation from optimal solution (R_1 = %g): %1.20f", x,
+ XBT_WARN("Max Deviation from optimal solution : %g", max_deviation);
+ XBT_WARN("Found x = %1.20f", x);
+ XBT_WARN("Deviation from optimal solution (R_1 = %g): %1.20f", x,
lmm_variable_getvalue(R_1) - x);
- WARN2("Deviation from optimal solution (R_2 = %g): %1.20f",
+ XBT_WARN("Deviation from optimal solution (R_2 = %g): %1.20f",
b - a + x, lmm_variable_getvalue(R_2) - (b - a + x));
- WARN2("Deviation from optimal solution (R_3 = %g): %1.20f", x,
+ XBT_WARN("Deviation from optimal solution (R_3 = %g): %1.20f", x,
lmm_variable_getvalue(R_3) - x);
- WARN2("Deviation from optimal solution (R_1_2_3 = %g): %1.20f",
+ XBT_WARN("Deviation from optimal solution (R_1_2_3 = %g): %1.20f",
a - x, lmm_variable_getvalue(R_1_2_3) - (a - x));
}
} else {
{
xbt_init(&argc, argv);
- INFO0("***** Test 1 (Max-Min)");
+ XBT_INFO("***** Test 1 (Max-Min)");
test1(MAXMIN);
- INFO0("***** Test 1 (Lagrange - Vegas)");
+ XBT_INFO("***** Test 1 (Lagrange - Vegas)");
test1(LAGRANGE_VEGAS);
- INFO0("***** Test 1 (Lagrange - Reno)");
+ XBT_INFO("***** Test 1 (Lagrange - Reno)");
test1(LAGRANGE_RENO);
- INFO0("***** Test 2 (Max-Min)");
+ XBT_INFO("***** Test 2 (Max-Min)");
test2(MAXMIN);
- INFO0("***** Test 2 (Lagrange - Vegas)");
+ XBT_INFO("***** Test 2 (Lagrange - Vegas)");
test2(LAGRANGE_VEGAS);
- INFO0("***** Test 2 (Lagrange - Reno)");
+ XBT_INFO("***** Test 2 (Lagrange - Reno)");
test2(LAGRANGE_RENO);
- INFO0("***** Test 3 (Max-Min)");
+ XBT_INFO("***** Test 3 (Max-Min)");
test3(MAXMIN);
- INFO0("***** Test 3 (Lagrange - Vegas)");
+ XBT_INFO("***** Test 3 (Lagrange - Vegas)");
test3(LAGRANGE_VEGAS);
- INFO0("***** Test 3 (Lagrange - Reno)");
+ XBT_INFO("***** Test 3 (Lagrange - Reno)");
test3(LAGRANGE_RENO);
return 0;
parse_platform_file(platform);
/*********************** CPU ***********************************/
- DEBUG1("%p", surf_cpu_model);
+ XBT_DEBUG("%p", surf_cpu_model);
cpuA = surf_model_resource_by_name(surf_cpu_model, "Cpu A");
cpuB = surf_model_resource_by_name(surf_cpu_model, "Cpu B");
/* Let's check that those two processors exist */
- DEBUG2("%s : %p", surf_resource_name(cpuA), cpuA);
- DEBUG2("%s : %p", surf_resource_name(cpuB), cpuB);
+ XBT_DEBUG("%s : %p", surf_resource_name(cpuA), cpuA);
+ XBT_DEBUG("%s : %p", surf_resource_name(cpuB), cpuB);
/* Let's do something on it */
actionA = surf_cpu_model->extension.cpu.execute(cpuA, 1000.0);
stateActionC = surf_cpu_model->action_state_get(actionC); /* When you know actionA model type */
/* And just look at the state of these tasks */
- DEBUG2("actionA : %p (%s)", actionA, string_action(stateActionA));
- DEBUG2("actionB : %p (%s)", actionB, string_action(stateActionB));
- DEBUG2("actionC : %p (%s)", actionB, string_action(stateActionC));
+ XBT_DEBUG("actionA : %p (%s)", actionA, string_action(stateActionA));
+ XBT_DEBUG("actionB : %p (%s)", actionB, string_action(stateActionB));
+ XBT_DEBUG("actionC : %p (%s)", actionB, string_action(stateActionC));
/*********************** Network *******************************/
- DEBUG1("%p", surf_network_model);
+ XBT_DEBUG("%p", surf_network_model);
cardA = surf_model_resource_by_name(surf_network_model, "Cpu A");
cardB = surf_model_resource_by_name(surf_network_model, "Cpu B");
/* Let's check that those two processors exist */
- DEBUG2("%s : %p", surf_resource_name(cardA), cardA);
- DEBUG2("%s : %p", surf_resource_name(cardB), cardB);
+ XBT_DEBUG("%s : %p", surf_resource_name(cardA), cardA);
+ XBT_DEBUG("%s : %p", surf_resource_name(cardB), cardB);
/* Let's do something on it */
commAB =
do {
surf_action_t action = NULL;
now = surf_get_clock();
- DEBUG1("Next Event : %g", now);
- DEBUG0("\t CPU actions");
+ XBT_DEBUG("Next Event : %g", now);
+ XBT_DEBUG("\t CPU actions");
while ((action =
xbt_swag_extract(surf_cpu_model->states.failed_action_set))) {
- DEBUG1("\t * Failed : %p", action);
+ XBT_DEBUG("\t * Failed : %p", action);
action->model_type->action_unref(action);
}
while ((action =
xbt_swag_extract(surf_cpu_model->states.done_action_set))) {
- DEBUG1("\t * Done : %p", action);
+ XBT_DEBUG("\t * Done : %p", action);
action->model_type->action_unref(action);
}
- DEBUG0("\t Network actions");
+ XBT_DEBUG("\t Network actions");
while ((action =
xbt_swag_extract(surf_network_model->states.
failed_action_set))) {
- DEBUG1("\t * Failed : %p", action);
+ XBT_DEBUG("\t * Failed : %p", action);
action->model_type->action_unref(action);
}
while ((action =
xbt_swag_extract(surf_network_model->states.
done_action_set))) {
- DEBUG1("\t * Done : %p", action);
+ XBT_DEBUG("\t * Done : %p", action);
action->model_type->action_unref(action);
}
xbt_swag_size(surf_cpu_model->states.running_action_set)) &&
surf_solve(-1.0) >= 0.0);
- DEBUG0("Simulation Terminated");
+ XBT_DEBUG("Simulation Terminated");
}
#ifdef __BORLANDC__
surf_model_resource_by_name(surf_workstation_model, "Cpu B");
/* Let's check that those two processors exist */
- DEBUG2("%s : %p", surf_resource_name(workstationA), workstationA);
- DEBUG2("%s : %p", surf_resource_name(workstationB), workstationB);
+ XBT_DEBUG("%s : %p", surf_resource_name(workstationA), workstationA);
+ XBT_DEBUG("%s : %p", surf_resource_name(workstationB), workstationB);
/* Let's do something on it */
actionA =
running = 0;
now = surf_get_clock();
- DEBUG1("Next Event : %g", now);
+ XBT_DEBUG("Next Event : %g", now);
xbt_dynar_foreach(model_list, iter, model) {
- DEBUG1("\t %s actions", model->name);
+ XBT_DEBUG("\t %s actions", model->name);
while ((action = xbt_swag_extract(model->states.failed_action_set))) {
- DEBUG1("\t * Failed : %p", action);
+ XBT_DEBUG("\t * Failed : %p", action);
model->action_unref(action);
}
while ((action = xbt_swag_extract(model->states.done_action_set))) {
- DEBUG1("\t * Done : %p", action);
+ XBT_DEBUG("\t * Done : %p", action);
model->action_unref(action);
}
if (xbt_swag_size(model->states.running_action_set)) {
- DEBUG1("running %s", model->name);
+ XBT_DEBUG("running %s", model->name);
running = 1;
}
}
} while (running && surf_solve(-1.0) >= 0.0);
- DEBUG0("Simulation Terminated");
+ XBT_DEBUG("Simulation Terminated");
}
tmgr_history_add_trace(history, trace_B, 0.0, 0, host_B);
while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
- DEBUG1("%g" " : \n", next_event_date);
+ XBT_DEBUG("%g" " : \n", next_event_date);
while (tmgr_history_get_next_event_leq(history, next_event_date,
&value, (void **) &resource)) {
- DEBUG2("\t %s : " "%g" "\n", resource, value);
+ XBT_DEBUG("\t %s : " "%g" "\n", resource, value);
}
if (next_event_date > 1000)
break;
n = xbt_dynar_length(xbt_graph_get_nodes(graph));
if (test_export_xml) {
- INFO0("---- Testing XML export. Exporting to testgraph.xml ----");
+ XBT_INFO("---- Testing XML export. Exporting to testgraph.xml ----");
xbt_graph_export_graphxml(graph, "testgraph.xml", NULL, NULL, NULL,
NULL);
}
if (test_export_dot) {
- INFO0("---- Testing GraphViz export. Exporting to testgraph.dot ----");
+ XBT_INFO("---- Testing GraphViz export. Exporting to testgraph.dot ----");
xbt_graph_export_graphviz(graph, "testgraph.dot", node_name, NULL);
}
char *buf = NULL;
double *adj = NULL;
- INFO0("---- Dumping Edge lengths ----");
+ XBT_INFO("---- Dumping Edge lengths ----");
adj = xbt_graph_get_length_matrix(graph);
buf = xbt_new0(char, n * 20);
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
sprintf(buf + strlen(buf), "%le\t", adj[i * n + j]);
}
- INFO1("%s", buf);
+ XBT_INFO("%s", buf);
buf[0] = '\000';
}
free(buf);
char *buf = NULL;
xbt_node_t *route = NULL;
- INFO0("---- Testing Shortest Paths ----");
+ XBT_INFO("---- Testing Shortest Paths ----");
route = xbt_graph_shortest_paths(graph);
buf = xbt_new0(char, n * 40);
for (i = 0; i < n; i++) {
snprintf(buf + strlen(buf), 40, "%s\t",
node_name(route[i * n + j]));
}
- INFO1("%s", buf);
+ XBT_INFO("%s", buf);
buf[0] = '\000';
}
free(buf);
if (test_topo_sort) {
xbt_node_t *sorted = NULL;
- INFO0("---- Testing Topological Sort ----");
+ XBT_INFO("---- Testing Topological Sort ----");
sorted = xbt_graph_topo_sort(graph);
for (i = 0; i < n; i++) {
if (sorted[i]) {
- INFO3("sorted[%lu] = %s (%p)", i, node_name(sorted[i]), sorted[i]);
+ XBT_INFO("sorted[%lu] = %s (%p)", i, node_name(sorted[i]), sorted[i]);
}
}
free(sorted);
if (test_node_deletion) {
- INFO0("---- Testing Node Deletion ----");
+ XBT_INFO("---- Testing Node Deletion ----");
nodes = xbt_graph_get_nodes(graph);
edges = xbt_graph_get_edges(graph);
- INFO2("Before Node deletion: %lu nodes, %lu edges",
+ XBT_INFO("Before Node deletion: %lu nodes, %lu edges",
xbt_dynar_length(nodes), xbt_dynar_length(edges));
while (xbt_dynar_length(nodes))
xbt_graph_free_node(graph,
*((xbt_node_t *) xbt_dynar_get_ptr(nodes, 0)),
free_label, NULL);
- INFO2("After Node deletion: %lu nodes, %lu edges",
+ XBT_INFO("After Node deletion: %lu nodes, %lu edges",
xbt_dynar_length(nodes), xbt_dynar_length(edges));
}
if (test_edge_deletion) {
- INFO0("---- Testing Edge Deletion ----");
+ XBT_INFO("---- Testing Edge Deletion ----");
nodes = xbt_graph_get_nodes(graph);
edges = xbt_graph_get_edges(graph);
- INFO2("Before Edge deletion: %lu nodes, %lu edges",
+ XBT_INFO("Before Edge deletion: %lu nodes, %lu edges",
xbt_dynar_length(nodes), xbt_dynar_length(edges));
while (xbt_dynar_length(edges))
*((xbt_edge_t *) xbt_dynar_get_ptr(edges, 0)),
NULL);
- INFO2("After Edge deletion: %lu nodes, %lu edges",
+ XBT_INFO("After Edge deletion: %lu nodes, %lu edges",
xbt_dynar_length(nodes), xbt_dynar_length(edges));
}
static void dolog(const char *settings)
{
- INFO1("Test with the settings '%s'", settings);
+ XBT_INFO("Test with the settings '%s'", settings);
xbt_log_control_set(settings);
- DEBUG1("val=%d", 1);
- WARN1("val=%d", 2);
- CDEBUG2(top, "val=%d%s", 3, "!");
- CRITICAL6("false alarm%s%s%s%s%s%s", "", "", "", "", "", "!");
+ XBT_DEBUG("val=%d", 1);
+ XBT_WARN("val=%d", 2);
+ XBT_CDEBUG(top, "val=%d%s", 3, "!");
+ XBT_CRITICAL("false alarm%s%s%s%s%s%s", "", "", "", "", "", "!");
}
SD_init(&argc, argv);
if (argc < 3){
- INFO1("Usage: %s <platform_file.xml> <graphviz_file.dot>", argv[0]);
+ XBT_INFO("Usage: %s <platform_file.xml> <graphviz_file.dot>", argv[0]);
return 1;
}
platformFile = argv[1];
}
xbt_edge_t edge = xbt_graph_search_edge (graph, previous, link_node);
if (!edge){
- DEBUG2("\%s %s", (char*)xbt_graph_node_get_data(previous), (char*)xbt_graph_node_get_data(link_node));
+ XBT_DEBUG("\%s %s", (char*)xbt_graph_node_get_data(previous), (char*)xbt_graph_node_get_data(link_node));
xbt_graph_new_edge (graph, previous, link_node, NULL);
}
previous = link_node;
}
xbt_edge_t edge = xbt_graph_search_edge (graph, previous, dst_node);
if (!edge){
- DEBUG2("\%s %s", (char*)xbt_graph_node_get_data(previous), (char*)xbt_graph_node_get_data(dst_node));
+ XBT_DEBUG("\%s %s", (char*)xbt_graph_node_get_data(previous), (char*)xbt_graph_node_get_data(dst_node));
xbt_graph_new_edge (graph, previous, dst_node, NULL);
}
} CATCH(e) {}
process.argv = xbt_new(char *, 1);
process.argv[0] = xbt_strdup(A_surfxml_process_function);
process.host = strdup(A_surfxml_process_host);
- /*VERB1("Function: %s",A_surfxml_process_function); */
+ /*XBT_VERB("Function: %s",A_surfxml_process_function); */
}
static void parse_argument(void)
static void parse_process_finalize(void)
{
xbt_dynar_push(process_list, &process);
- /*VERB1("Function: %s",process.argv[0]); */
+ /*XBT_VERB("Function: %s",process.argv[0]); */
}
/*FIXME Defined in surfxml_parse.c*/
project_name = argv[1];
surf_parse_reset_callbacks();
- DEBUG2("%p %p", parse_process_init, &parse_process_init);
+ XBT_DEBUG("%p %p", parse_process_init, &parse_process_init);
surfxml_add_callback(STag_surfxml_process_cb_list, &parse_process_init);
surfxml_add_callback(ETag_surfxml_argument_cb_list, &parse_argument);
surfxml_add_callback(ETag_surfxml_process_cb_list,
for (cursor=NULL, xbt_dict_cursor_first((process_function_set),&(cursor)) ;
xbt_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));
xbt_dict_cursor_step(cursor) ) {
- DEBUG1("Function %s", key);
+ XBT_DEBUG("Function %s", key);
}
xbt_dict_dump(process_function_set,print);
/* Wait for ending signal... */
xbt_os_cond_wait(sigwaiter_cond, sigwaiter_mutex);
if (armageddon_requested) {
- ERROR2("Test suite `%s': caught signal %d", testsuite_name, caught_signum);
+ XBT_ERROR("Test suite `%s': caught signal %d", testsuite_name, caught_signum);
rctx_armageddon(rctx, 3);
}
xbt_os_mutex_release(sigwaiter_mutex);
static void wait_it(rctx_t rctx)
{
- VERB2("Join thread %p which were running background cmd <%s>",
+ XBT_VERB("Join thread %p which were running background cmd <%s>",
rctx->runner, rctx->filepos);
xbt_os_thread_join(rctx->runner, NULL);
}
rctx_t rctx)
{
if (rctx != initiator) {
- INFO2("Kill <%s> because <%s> failed", rctx->filepos, filepos);
+ XBT_INFO("Kill <%s> because <%s> failed", rctx->filepos, filepos);
xbt_os_mutex_acquire(rctx->interruption);
if (!rctx->reader_done) {
rctx->interrupted = 1;
const char *filepos = initiator && initiator->filepos ?
initiator->filepos : "(master)";
- DEBUG2("Armageddon request by <%s> (exit=%d)", filepos, exitcode);
+ XBT_DEBUG("Armageddon request by <%s> (exit=%d)", filepos, exitcode);
xbt_os_mutex_acquire(armageddon_mutex);
if (armageddon_initiator != NULL) {
- VERB0("Armageddon already started. Let it go");
+ XBT_VERB("Armageddon already started. Let it go");
xbt_os_mutex_release(armageddon_mutex);
return;
}
- DEBUG1("Armageddon request by <%s> got the lock. Let's go amok",
+ XBT_DEBUG("Armageddon request by <%s> got the lock. Let's go amok",
filepos);
armageddon_initiator = initiator;
xbt_os_mutex_release(armageddon_mutex);
xbt_os_mutex_acquire(rctx->interruption);
xbt_dynar_foreach(bg_jobs, cursor, job)
xbt_os_mutex_acquire(job->interruption);
- VERB0("Shut everything down!");
+ XBT_VERB("Shut everything down!");
exit(exitcode);
}
void rctx_free(rctx_t rctx)
{
- DEBUG1("RCTX: Free %p", rctx);
+ XBT_DEBUG("RCTX: Free %p", rctx);
rctx_dump(rctx, "free");
if (!rctx)
return;
void rctx_dump(rctx_t rctx, const char *str)
{
- DEBUG9("%s RCTX %p={in%p={%d,%10s}, want={%d,%10s}, out={%d,%10s}}",
+ XBT_DEBUG("%s RCTX %p={in%p={%d,%10s}, want={%d,%10s}, out={%d,%10s}}",
str, rctx,
rctx->input, rctx->input->used, rctx->input->data,
rctx->output_wanted->used, rctx->output_wanted->data,
rctx->output_got->used, rctx->output_got->data);
- DEBUG5("%s RCTX %p=[cmd%p=%10s, pid=%d]",
+ XBT_DEBUG("%s RCTX %p=[cmd%p=%10s, pid=%d]",
str, rctx, rctx->cmd, rctx->cmd, rctx->pid);
}
case '&':
if (rctx->cmd) {
if (!rctx->is_empty) {
- ERROR2
+ XBT_ERROR
("[%s] More than one command in this chunk of lines (previous: %s).\n"
" Cannot guess which input/output belongs to which command.",
filepos, rctx->cmd);
- ERROR1("Test suite `%s': NOK (syntax error)", testsuite_name);
+ XBT_ERROR("Test suite `%s': NOK (syntax error)", testsuite_name);
rctx_armageddon(rctx, 1);
return;
}
rctx_start();
- VERB1("[%s] More than one command in this chunk of lines", filepos);
+ XBT_VERB("[%s] More than one command in this chunk of lines", filepos);
}
if (kind == '&')
rctx->is_background = 1;
if(option){
rctx->cmd = bprintf("%s %s",rctx->cmd,option);
}
- INFO3("[%s] %s%s", filepos, rctx->cmd,
+ XBT_INFO("[%s] %s%s", filepos, rctx->cmd,
((rctx->is_background) ? " (background command)" : ""));
break;
rctx_start();
if (!strncmp(line, "timeout no", strlen("timeout no"))) {
- VERB1("[%s] (disable timeout)", filepos);
+ XBT_VERB("[%s] (disable timeout)", filepos);
timeout_value = -1;
} else if (!strncmp(line, "timeout ", strlen("timeout "))) {
timeout_value = atoi(line + strlen("timeout"));
- VERB2("[%s] (new timeout value: %d)", filepos, timeout_value);
+ XBT_VERB("[%s] (new timeout value: %d)", filepos, timeout_value);
} else if (!strncmp(line, "expect signal ", strlen("expect signal "))) {
rctx->expected_signal = strdup(line + strlen("expect signal "));
xbt_str_trim(rctx->expected_signal, " \n");
- VERB2("[%s] (next command must raise signal %s)",
+ XBT_VERB("[%s] (next command must raise signal %s)",
filepos, rctx->expected_signal);
} else if (!strncmp(line, "expect return ", strlen("expect return "))) {
rctx->expected_return = atoi(line + strlen("expect return "));
- VERB2("[%s] (next command must return code %d)",
+ XBT_VERB("[%s] (next command must return code %d)",
filepos, rctx->expected_return);
} else if (!strncmp(line, "output sort", strlen("output sort"))) {
if (sort_len==0)
sort_len=SORT_LEN_DEFAULT;
rctx->output_sort = 1;
- VERB1("[%s] (sort output of next command)", filepos);
+ XBT_VERB("[%s] (sort output of next command)", filepos);
} else if (!strncmp(line, "output ignore", strlen("output ignore"))) {
rctx->output = e_output_ignore;
- VERB1("[%s] (ignore output of next command)", filepos);
+ XBT_VERB("[%s] (ignore output of next command)", filepos);
} else if (!strncmp(line, "output display", strlen("output display"))) {
rctx->output = e_output_display;
- VERB1("[%s] (ignore output of next command)", filepos);
+ XBT_VERB("[%s] (ignore output of next command)", filepos);
} else if (!strncmp(line, "setenv ", strlen("setenv "))) {
int len = strlen("setenv ");
rctx->env = realloc(rctx->env, ++(rctx->env_size) * sizeof(char *));
rctx->env[rctx->env_size - 2] = xbt_strdup(line + len);
rctx->env[rctx->env_size - 1] = NULL;
- VERB2("[%s] setenv %s", filepos, line + len);
+ XBT_VERB("[%s] setenv %s", filepos, line + len);
} else {
- ERROR2("%s: Malformed metacommand: %s", filepos, line);
- ERROR1("Test suite `%s': NOK (syntax error)", testsuite_name);
+ XBT_ERROR("%s: Malformed metacommand: %s", filepos, line);
+ XBT_ERROR("Test suite `%s': NOK (syntax error)", testsuite_name);
rctx_armageddon(rctx, 1);
return;
}
rctx_t rctx = (rctx_t) r;
for (posw = 0; posw < rctx->input->used && !rctx->brokenpipe;) {
int got;
- DEBUG1("Still %d chars to write", rctx->input->used - posw);
+ XBT_DEBUG("Still %d chars to write", rctx->input->used - posw);
got =
write(rctx->child_to, rctx->input->data + posw,
rctx->input->used - posw);
rctx->brokenpipe = 1;
} else if (errno != EINTR && errno != EAGAIN && errno != EPIPE) {
perror("Error while writing input to child");
- ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+ XBT_ERROR("Test suite `%s': NOK (system error)", testsuite_name);
rctx_armageddon(rctx, 4);
return NULL;
}
}
- DEBUG1("written %d chars so far", posw);
+ XBT_DEBUG("written %d chars so far", posw);
if (got <= 0)
usleep(100);
posr = read(rctx->child_from, buffout, 4095);
if (posr < 0 && errno != EINTR && errno != EAGAIN) {
perror("Error while reading output of child");
- ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+ XBT_ERROR("Test suite `%s': NOK (system error)", testsuite_name);
rctx_armageddon(rctx, 4);
return NULL;
}
("(%s) Cannot wait for the child %s (got pid %d where pid %d were expected;status=%d)",
xbt_thread_self_name(), rctx->cmd, (int) got_pid,
(int) rctx->pid, rctx->status));
- ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+ XBT_ERROR("Test suite `%s': NOK (system error)", testsuite_name);
rctx_armageddon(rctx, 4);
return NULL;
}
binary_name = bprintf("%s/%s", str, args[0]);
if (!stat(binary_name, &stat_buf)) {
/* Found. */
- DEBUG1("Looked in the PATH for the binary. Found %s",
+ XBT_DEBUG("Looked in the PATH for the binary. Found %s",
binary_name);
xbt_dynar_free(&path);
break;
int child_in[2];
int child_out[2];
- DEBUG1("Cmd before rewriting %s", rctx->cmd);
+ XBT_DEBUG("Cmd before rewriting %s", rctx->cmd);
rctx->cmd = xbt_str_varsubst(rctx->cmd, env);
- VERB2("Start %s %s", rctx->cmd,
+ XBT_VERB("Start %s %s", rctx->cmd,
(rctx->is_background ? "(background job)" : ""));
xbt_os_mutex_acquire(armageddon_mutex);
if (armageddon_initiator) {
- VERB0("Armageddon in progress. Do not start job.");
+ XBT_VERB("Armageddon in progress. Do not start job.");
xbt_os_mutex_release(armageddon_mutex);
return;
}
if (pipe(child_in) || pipe(child_out)) {
perror("Cannot open the pipes");
- ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+ XBT_ERROR("Test suite `%s': NOK (system error)", testsuite_name);
xbt_os_mutex_release(armageddon_mutex);
rctx_armageddon(rctx, 4);
}
rctx->pid = fork();
if (rctx->pid < 0) {
perror("Cannot fork the command");
- ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+ XBT_ERROR("Test suite `%s': NOK (system error)", testsuite_name);
xbt_os_mutex_release(armageddon_mutex);
rctx_armageddon(rctx, 4);
return;
xbt_os_thread_t runner;
rctx = rctx_new();
- DEBUG2("RCTX: new bg=%p, new fg=%p", old, rctx);
+ XBT_DEBUG("RCTX: new bg=%p, new fg=%p", old, rctx);
- DEBUG2("Launch a thread to wait for %s %d", old->cmd, old->pid);
+ XBT_DEBUG("Launch a thread to wait for %s %d", old->cmd, old->pid);
runner = xbt_os_thread_create(old->cmd, rctx_wait, (void *) old, NULL);
old->runner = runner;
- VERB3("Launched thread %p to wait for %s %d", runner, old->cmd,
+ XBT_VERB("Launched thread %p to wait for %s %d", runner, old->cmd,
old->pid);
xbt_dynar_push(bg_jobs, &old);
xbt_os_mutex_release(armageddon_mutex);
const char *s1 = *((const char**) p1);
const char *s2 = *((const char**) p2);
- DEBUG2("Compare strings '%s' and '%s'", s1, s2);
+ XBT_DEBUG("Compare strings '%s' and '%s'", s1, s2);
int res = strncmp(s1, s2, sort_len);
if (res == 0)
xbt_os_mutex_acquire(rctx->interruption);
if (!rctx->interrupted && rctx->end_time > 0 && rctx->end_time < now) {
- INFO1("<%s> timeouted. Kill the process.", rctx->filepos);
+ XBT_INFO("<%s> timeouted. Kill the process.", rctx->filepos);
rctx->timeout = 1;
kill(rctx->pid, SIGTERM);
usleep(100);
/* Check for broken pipe */
if (rctx->brokenpipe)
- VERB0
+ XBT_VERB
("Warning: Child did not consume all its input (I got broken pipe)");
/* Check for timeouts */
if (rctx->timeout) {
if (rctx->output_got->data[0])
- INFO2("<%s> Output on timeout:\n%s",
+ XBT_INFO("<%s> Output on timeout:\n%s",
rctx->filepos, rctx->output_got->data);
else
- INFO1("<%s> No output before timeout", rctx->filepos);
- ERROR3("Test suite `%s': NOK (<%s> timeout after %d sec)",
+ XBT_INFO("<%s> No output before timeout", rctx->filepos);
+ XBT_ERROR("Test suite `%s': NOK (<%s> timeout after %d sec)",
testsuite_name, rctx->filepos, timeout_value);
- DEBUG2("<%s> Interrupted = %d", rctx->filepos, rctx->interrupted);
+ XBT_DEBUG("<%s> Interrupted = %d", rctx->filepos, rctx->interrupted);
if (!rctx->interrupted) {
xbt_os_mutex_release(rctx->interruption);
rctx_armageddon(rctx, 3);
}
}
- DEBUG2("RCTX=%p (pid=%d)", rctx, rctx->pid);
- DEBUG3("Status(%s|%d)=%d", rctx->cmd, rctx->pid, rctx->status);
+ XBT_DEBUG("RCTX=%p (pid=%d)", rctx, rctx->pid);
+ XBT_DEBUG("Status(%s|%d)=%d", rctx->cmd, rctx->pid, rctx->status);
if (!rctx->interrupted) {
if (WIFSIGNALED(rctx->status) && !rctx->expected_signal) {
- ERROR3("Test suite `%s': NOK (<%s> got signal %s)",
+ XBT_ERROR("Test suite `%s': NOK (<%s> got signal %s)",
testsuite_name, rctx->filepos,
signal_name(WTERMSIG(rctx->status), NULL));
errcode = WTERMSIG(rctx->status) + 4;
if (WIFSIGNALED(rctx->status) && rctx->expected_signal &&
strcmp(signal_name(WTERMSIG(rctx->status), rctx->expected_signal),
rctx->expected_signal)) {
- ERROR4("Test suite `%s': NOK (%s got signal %s instead of %s)",
+ XBT_ERROR("Test suite `%s': NOK (%s got signal %s instead of %s)",
testsuite_name, rctx->filepos,
signal_name(WTERMSIG(rctx->status), rctx->expected_signal),
rctx->expected_signal);
}
if (!WIFSIGNALED(rctx->status) && rctx->expected_signal) {
- ERROR3("Test suite `%s': NOK (child %s expected signal %s)",
+ XBT_ERROR("Test suite `%s': NOK (child %s expected signal %s)",
testsuite_name, rctx->filepos, rctx->expected_signal);
errcode = 5;
}
if (WIFEXITED(rctx->status)
&& WEXITSTATUS(rctx->status) != rctx->expected_return) {
if (rctx->expected_return)
- ERROR4
+ XBT_ERROR
("Test suite `%s': NOK (<%s> returned code %d instead of %d)",
testsuite_name, rctx->filepos, WEXITSTATUS(rctx->status),
rctx->expected_return);
else
- ERROR3("Test suite `%s': NOK (<%s> returned code %d)",
+ XBT_ERROR("Test suite `%s': NOK (<%s> returned code %d)",
testsuite_name, rctx->filepos, WEXITSTATUS(rctx->status));
errcode = 40 + WEXITSTATUS(rctx->status);
int marklen = strlen("TESH_ERROR ");
char *endline = strchr(rctx->output_got->data, '\n');
- CRITICAL2("%.*s", (int) (endline - rctx->output_got->data - marklen),
+ XBT_CRITICAL("%.*s", (int) (endline - rctx->output_got->data - marklen),
rctx->output_got->data + marklen);
memmove(rctx->output_got->data, rctx->output_got->data + marklen,
rctx->output_got->used - marklen);
xbt_dynar_t a = xbt_str_split(rctx->output_got->data, "\n");
char *out = xbt_str_join(a, "\n||");
xbt_dynar_free(&a);
- INFO2("Output of <%s> so far: \n||%s", rctx->filepos, out);
+ XBT_INFO("Output of <%s> so far: \n||%s", rctx->filepos, out);
free(out);
} else if (rctx->output == e_output_check
&& (rctx->output_got->used != rctx->output_wanted->used
if (XBT_LOG_ISENABLED(tesh, xbt_log_priority_info)) {
char *diff =
xbt_str_diff(rctx->output_wanted->data, rctx->output_got->data);
- ERROR2("Output of <%s> mismatch:\n%s", rctx->filepos, diff);
+ XBT_ERROR("Output of <%s> mismatch:\n%s", rctx->filepos, diff);
free(diff);
}
- ERROR2("Test suite `%s': NOK (<%s> output mismatch)",
+ XBT_ERROR("Test suite `%s': NOK (<%s> output mismatch)",
testsuite_name, rctx->filepos);
errcode = 2;
} else if (rctx->output == e_output_ignore) {
- INFO1("(ignoring the output of <%s> as requested)", rctx->filepos);
+ XBT_INFO("(ignoring the output of <%s> as requested)", rctx->filepos);
} else if (rctx->output == e_output_display) {
xbt_dynar_t a = xbt_str_split(rctx->output_got->data, "\n");
char *out = xbt_str_join(a, "\n||");
xbt_dynar_free(&a);
- INFO1("Here is the (ignored) command output: \n||%s", out);
+ XBT_INFO("Here is the (ignored) command output: \n||%s", out);
free(out);
}
xbt_str_rtrim(line + 2, "\n");
/*
- DEBUG7("rctx={%s,in={%d,>>%10s<<},exp={%d,>>%10s<<},got={%d,>>%10s<<}}",
+ XBT_DEBUG("rctx={%s,in={%d,>>%10s<<},exp={%d,>>%10s<<},got={%d,>>%10s<<}}",
rctx->cmd,
rctx->input->used, rctx->input->data,
rctx->output_wanted->used,rctx->output_wanted->data,
rctx->output_got->used, rctx->output_got->data);
*/
- DEBUG2("[%s] %s", filepos, line);
+ XBT_DEBUG("[%s] %s", filepos, line);
switch (line[0]) {
case '#':
/* search beginning */
while (*(dir++) == ' ');
dir--;
- VERB1("Saw cd '%s'", dir);
+ XBT_VERB("Saw cd '%s'", dir);
if (chdir(dir)) {
- ERROR2("Chdir to %s failed: %s", dir, strerror(errno));
- ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+ XBT_ERROR("Chdir to %s failed: %s", dir, strerror(errno));
+ XBT_ERROR("Test suite `%s': NOK (system error)", testsuite_name);
rctx_armageddon(rctx, 4);
}
break;
break;
case 'p':
- INFO2("[%s] %s", filepos, line + 2);
+ XBT_INFO("[%s] %s", filepos, line + 2);
break;
case 'P':
- CRITICAL2("[%s] %s", filepos, line + 2);
+ XBT_CRITICAL("[%s] %s", filepos, line + 2);
break;
default:
- ERROR2("[%s] Syntax error: %s", filepos, line);
- ERROR1("Test suite `%s': NOK (syntax error)", testsuite_name);
+ XBT_ERROR("[%s] Syntax error: %s", filepos, line);
+ XBT_ERROR("Test suite `%s': NOK (syntax error)", testsuite_name);
rctx_armageddon(rctx, 1);
break;
}
if (blankline) {
if (!rctx->cmd && !rctx->is_empty) {
- ERROR1("[%d] Error: no command found in this chunk of lines.",
+ XBT_ERROR("[%d] Error: no command found in this chunk of lines.",
buffbegin);
- ERROR1("Test suite `%s': NOK (syntax error)", testsuite_name);
+ XBT_ERROR("Test suite `%s': NOK (syntax error)", testsuite_name);
rctx_armageddon(rctx, 1);
}
if (rctx->cmd)
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--cd")) {
if (i == argc - 1) {
- ERROR0("--cd argument requires an argument");
+ XBT_ERROR("--cd argument requires an argument");
exit(1);
}
if (chdir(argv[i + 1])) {
- ERROR2("Cannot change directory to %s: %s", argv[i + 1],
+ XBT_ERROR("Cannot change directory to %s: %s", argv[i + 1],
strerror(errno));
exit(1);
}
- INFO1("Change directory to %s", argv[i + 1]);
+ XBT_INFO("Change directory to %s", argv[i + 1]);
memmove(argv + i, argv + i + 2, (argc - i - 1) * sizeof(char *));
argc -= 2;
i -= 2;
} else if (!strcmp(argv[i], "--setenv" )) {
if (i == argc - 1) {
- ERROR0("--setenv argument requires an argument");
+ XBT_ERROR("--setenv argument requires an argument");
exit(1);
}
char *eq = strchr(argv[i+1], '=');
xbt_assert1(eq,"The argument of --setenv must contain a '=' (got %s instead)",argv[i+1]);
char *key = bprintf("%.*s", (int) (eq - argv[i+1]), argv[i+1]);
xbt_dict_set(env, key, xbt_strdup(eq + 1), xbt_free_f);
- INFO2("setting environment variable '%s' to '%s'", key, eq+1);
+ XBT_INFO("setting environment variable '%s' to '%s'", key, eq+1);
free(key);
memmove(argv + i, argv + i + 2, (argc - i - 1) * sizeof(char *));
argc -= 2;
i -= 2;
} else if (!strcmp(argv[i], "--cfg" )) {
if (i == argc - 1) {
- ERROR0("--cfg argument requires an argument");
+ XBT_ERROR("--cfg argument requires an argument");
exit(1);
}
if(!option){ //if option is NULL
}else{
option = bprintf("%s --cfg=%s",option,argv[i+1]);
}
- INFO1("Add option \'--cfg=%s\' to command line",argv[i+1]);
+ XBT_INFO("Add option \'--cfg=%s\' to command line",argv[i+1]);
memmove(argv + i, argv + i + 2, (argc - i - 1) * sizeof(char *));
argc -= 2;
i -= 2;
/* Find the description file */
if (argc == 1) {
- INFO0("Test suite from stdin");
+ XBT_INFO("Test suite from stdin");
testsuite_name = "(stdin)";
handle_suite(testsuite_name, stdin);
rctx_wait_bg();
- INFO0("Test suite from stdin OK");
+ XBT_INFO("Test suite from stdin OK");
} else {
for (i = 1; i < argc; i++) {
!strcmp(".tesh", suitename + strlen(suitename) - 5))
suitename[strlen(suitename) - 5] = '\0';
- INFO1("Test suite `%s'", suitename);
+ XBT_INFO("Test suite `%s'", suitename);
testsuite_name = suitename;
FICIN = fopen(argv[i], "r");
if (!FICIN) {
perror(bprintf("Impossible to open the suite file `%s'", argv[i]));
- ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+ XBT_ERROR("Test suite `%s': NOK (system error)", testsuite_name);
rctx_armageddon(rctx, 1);
}
handle_suite(suitename, FICIN);
rctx_wait_bg();
fclose(FICIN);
- INFO1("Test suite `%s' OK", suitename);
+ XBT_INFO("Test suite `%s' OK", suitename);
free(suitename);
}
}