Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge before commiting VM changes - Adrien
[simgrid.git] / teshsuite / simdag / platforms / basic_tracing.c
1 /* Copyright (c) 2008-2014. 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 <stdlib.h>
9 #include "simgrid/msg.h"
10 #include "surf/surf_private.h"
11
12 int host(int argc, char *argv[]);
13
14 XBT_LOG_NEW_DEFAULT_CATEGORY(basic_tracing,"Messages specific for this example");
15
16 int host(int argc, char *argv[])
17 {
18   XBT_INFO("Sleep for 1s");
19   MSG_process_sleep(1);
20   return 0;
21 }
22
23 int main(int argc, char **argv)
24 {
25   int res;
26   xbt_dynar_t all_hosts;
27   msg_host_t first_host;
28   MSG_init(&argc, argv);
29   MSG_create_environment(argv[1]);
30   MSG_function_register("host", host);
31   all_hosts = MSG_hosts_as_dynar();
32   first_host = xbt_dynar_pop_as(all_hosts,msg_host_t);
33   MSG_process_create( "host", host, NULL, first_host);
34   xbt_dynar_free(&all_hosts);
35
36   res = MSG_main();
37   XBT_INFO("Simulation time %g", MSG_get_clock());
38
39   if (res == MSG_OK)
40     return 0;
41   else
42     return 1;
43 }