Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] fix trace_platform tesh
[simgrid.git] / examples / msg / tracing / simple.c
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <stdio.h>
8 #include "msg/msg.h"
9 #include "xbt/sysdep.h"         /* calloc, printf */
10
11 /* Create a log channel to have nice outputs. */
12 #include "xbt/log.h"
13 #include "xbt/asserts.h"
14 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
15                              "Messages specific for this msg example");
16
17 int simple_func(int argc, char *argv[]);
18
19 /** Emitter function  */
20 int simple_func(int argc, char *argv[])
21 {
22   m_task_t task = MSG_task_create("task", 100, 0, NULL);
23   MSG_task_execute (task);
24   MSG_task_destroy (task);
25   return 0;
26 }
27
28 /** Main function */
29 int main(int argc, char *argv[])
30 {
31   MSG_global_init(&argc, argv);
32   if (argc < 3) {
33     printf("Usage: %s platform_file deployment_file\n", argv[0]);
34     exit(1);
35   }
36
37   char *platform_file = argv[1];
38   char *deployment_file = argv[2];
39   MSG_create_environment(platform_file);
40
41   MSG_function_register("master", simple_func);
42   MSG_function_register("slave", simple_func);
43   MSG_launch_application(deployment_file);
44
45   MSG_main();
46   MSG_clean();
47   return 0;
48 }