Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanup XML jungle in teshsuite
[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 XBT_LOG_NEW_DEFAULT_CATEGORY(basic_tracing,"Messages specific for this example");
12
13 static int host(int argc, char *argv[])
14 {
15   XBT_INFO("Sleep for 1s");
16   MSG_process_sleep(1);
17   return 0;
18 }
19
20 int main(int argc, char **argv)
21 {
22   MSG_init(&argc, argv);
23   MSG_create_environment(argv[1]);
24   MSG_function_register("host", host);
25   xbt_dynar_t all_hosts = MSG_hosts_as_dynar();
26   MSG_process_create( "host", host, NULL, xbt_dynar_pop_as(all_hosts,msg_host_t));
27   xbt_dynar_free(&all_hosts);
28
29   int res = MSG_main();
30   XBT_INFO("Simulation time %g", MSG_get_clock());
31
32   return res != MSG_OK;
33 }