Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanups in teshsuite/simdag/platforms, don't ask why
[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   MSG_init(&argc, argv);
25   MSG_create_environment(argv[1]);
26   MSG_function_register("host", host);
27   xbt_dynar_t all_hosts = MSG_hosts_as_dynar();
28   MSG_process_create( "host", host, NULL, xbt_dynar_pop_as(all_hosts,msg_host_t));
29   xbt_dynar_free(&all_hosts);
30
31   int res = MSG_main();
32   XBT_INFO("Simulation time %g", MSG_get_clock());
33
34   return res != MSG_OK;
35 }