Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
revise documentation of async examples
[simgrid.git] / examples / msg / trace-simple / trace-simple.c
1 /* Copyright (c) 2010, 2012-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 "simgrid/msg.h"
8
9 /** @addtogroup MSG_examples
10  * 
11  * @section MSG_ex_tracing Tracing and vizualisation features
12  * 
13  * - <b>tracing/simple.c</b> very simple program where each process creates, executes and destroy a task. You might want
14  *  to run this program with the following parameters:
15  *   --cfg=tracing/uncategorized:yes
16  *   (See \ref tracing_tracing_options for details)
17  */
18
19 static int simple_func(int argc, char *argv[])
20 {
21   msg_task_t task = MSG_task_create("task", 100, 0, NULL);
22   MSG_task_execute (task);
23   MSG_task_destroy (task);
24   return 0;
25 }
26
27 int main(int argc, char *argv[])
28 {
29   MSG_init(&argc, argv);
30   xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
31
32   MSG_create_environment(argv[1]);
33   MSG_process_create("simple_func", simple_func, NULL, MSG_get_host_by_name("Tremblay"));
34   MSG_process_create("simple_func", simple_func, NULL, MSG_get_host_by_name("Fafard"));
35
36   MSG_main();
37   return 0;
38 }