Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
5b8db615fff152e54f3d9ba091bbefca0f286c3e
[simgrid.git] / teshsuite / simdag / platforms / basic_tracing.c
1 /* Copyright (c) 2008-2015. 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
11 int host(int argc, char *argv[]);
12
13 XBT_LOG_NEW_DEFAULT_CATEGORY(basic_tracing,"Messages specific for this example");
14
15 int host(int argc, char *argv[])
16 {
17   XBT_INFO("Sleep for 1s");
18   MSG_process_sleep(1);
19   return 0;
20 }
21
22 int main(int argc, char **argv)
23 {
24   int res;
25   xbt_dynar_t all_hosts;
26   msg_host_t first_host;
27   MSG_init(&argc, argv);
28   MSG_create_environment(argv[1]);
29   MSG_function_register("host", host);
30   all_hosts = MSG_hosts_as_dynar();
31   first_host = xbt_dynar_pop_as(all_hosts,msg_host_t);
32   MSG_process_create( "host", host, NULL, first_host);
33   xbt_dynar_free(&all_hosts);
34
35   res = MSG_main();
36   XBT_INFO("Simulation time %g", MSG_get_clock());
37
38   return res != MSG_OK;
39 }