+void __MSG_display_process_status(void)
+{
+ m_process_t process = NULL;
+ xbt_fifo_item_t item = NULL;
+ int i;
+ int nbprocess=xbt_fifo_size(msg_global->process_list);
+
+ INFO1("MSG: %d processes are still running, waiting for something.",
+ nbprocess);
+ /* List the process and their state */
+ INFO0("MSG: <process>(<pid>) on <host>: <status>.");
+ xbt_fifo_foreach(msg_global->process_list,item,process,m_process_t) {
+ simdata_process_t p_simdata = (simdata_process_t) process->simdata;
+ simdata_host_t h_simdata=(simdata_host_t)p_simdata->host->simdata;
+ char *who;
+
+ asprintf(&who,"MSG: %s(%d) on %s: %s",
+ process->name,p_simdata->PID,
+ p_simdata->host->name,
+ (process->simdata->blocked)?"[blocked] "
+ :((process->simdata->suspended)?"[suspended] ":""));
+
+ for (i=0; i<msg_global->max_channel; i++) {
+ if (h_simdata->sleeping[i] == process) {
+ INFO2("%s\tListening on channel %d",who,i);
+ break;
+ }
+ }
+ if (i==msg_global->max_channel) {
+ if(p_simdata->waiting_task) {
+ if(p_simdata->waiting_task->simdata->compute) {
+ if(p_simdata->put_host) {
+ INFO4("%s\tTrying to send the task '%s' to Host %s, channel %d.",
+ who, p_simdata->waiting_task->name,p_simdata->put_host->name, p_simdata->put_channel);
+ } else {
+ INFO2("%s\tWaiting for %s to finish.",who,p_simdata->waiting_task->name);
+ }
+ } else if (p_simdata->waiting_task->simdata->comm) {
+ INFO2("%s\tWaiting for %s to be finished transfered.",
+ who,p_simdata->waiting_task->name);
+ } else {
+ INFO1("%s\tUNKNOWN STATUS. Please report this bug.",who);
+ }
+/* The following would display the trace of where the maestro thread is,
+ since this is the thread calling this. I'd like to get the other threads to
+ run this to see where they were blocked, but I'm not sure of how to do this */
+/* xbt_backtrace_display(); */
+ } else { /* Must be trying to put a task somewhere */
+ INFO1("%s\tUNKNOWN STATUS. Please report this bug.",who);
+ }
+ }
+ free(who);
+ }
+}
+
+/* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */
+#include <signal.h>
+
+static void _XBT_CALL inthandler(int ignored)
+{
+ INFO0("CTRL-C pressed. Displaying status and bailing out");
+ __MSG_display_process_status();
+ exit(1);
+}
+