#include "msg/msg.h"
/** This flag enable the debugging messages from PRINT_DEBUG_MESSAGE() */
-#undef VERBOSE
+#define VERBOSE
#include "messages.h"
int unix_emitter(int argc, char *argv[]);
int unix_receiver(int argc, char *argv[]);
+int unix_forwarder(int argc, char *argv[]);
void test_all(const char *platform_file, const char *application_file, double sharing);
MAX_CHANNEL
} channel_t;
+void print_args(int argc, char** argv);
+void print_args(int argc, char** argv)
+{
+ int i ;
+
+ fprintf(stderr,"<");
+ for(i=0; i<argc; i++)
+ fprintf(stderr,"%s ",argv[i]);
+ fprintf(stderr,">\n");
+}
+
/** The number of task each slave will process */
#define NB_TASK 3
int unix_emitter(int argc, char *argv[])
m_task_t *todo = NULL;
int i;
+ PRINT_MESSAGE("Hello !");
+ print_args(argc,argv);
{ /* Process organisation */
slaves_count = argc - 1;
m_task_t *todo = (m_task_t *) calloc(NB_TASK, sizeof(m_task_t));
int i;
+ PRINT_MESSAGE("Hello !");
+ print_args(argc,argv);
+
+ for (i = 0; i < NB_TASK;) {
+ int a;
+ PRINT_MESSAGE("Awaiting Task %d \n", i);
+ a = MSG_task_get(&(todo[i]), PORT_22);
+ if (a == MSG_OK) {
+ todo_count++;
+ PRINT_MESSAGE("Received \"%s\" \n", todo[i]->name);
+ PRINT_MESSAGE("Processing \"%s\" \n", todo[i]->name);
+ MSG_task_execute(todo[i]);
+ PRINT_MESSAGE("\"%s\" done \n", todo[i]->name);
+ MSG_task_destroy(todo[i]);
+ i++;
+ } else {
+ PRINT_MESSAGE("Hey ?! What's up ? \n");
+ DIE("Unexpected behaviour");
+ }
+ }
+ free(todo);
+ PRINT_MESSAGE("I'm done. See you!\n");
+ return 0;
+}
+
+
+int unix_forwarder(int argc, char *argv[])
+{
+ int todo_count = 0;
+ m_task_t *todo = (m_task_t *) calloc(NB_TASK, sizeof(m_task_t));
+ int i;
+
+ PRINT_MESSAGE("Hello !");
+ print_args(argc,argv);
for (i = 0; i < NB_TASK;) {
int a;
}
}
free(todo);
+ PRINT_MESSAGE("I'm done. See you!\n");
return 0;
}
MSG_launch_application(application_file);
}
MSG_main();
-/* printf("Simulation time %g\n",MSG_getClock()); */
+ printf("Simulation time %Lg\n",MSG_getClock());
MSG_clean();
}
int main(int argc, char *argv[])
{
test_all("msg_platform.txt","msg_deployment.txt",-.1);
- test_all("msg_platform.txt","msg_deployment.txt",.1);
+/* test_all("msg_platform.txt","msg_deployment.txt",.1); */
return (0);
}