Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
end of MSG examples doc revision
[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 visualization features
12  * Tracing can be activated by various configuration options which are illustrated in these example.
13  * See \ref tracing_tracing_options for details.
14  * - <b>Basic example: trace-simple/trace-simple.c</b>. In this very simple program, each process creates, executes,
15  *   and destroy a task. You might want to run it with the <i>--cfg=tracing/uncategorized:yes</i> option.
16  */
17
18 static int simple_func(int argc, char *argv[])
19 {
20   msg_task_t task = MSG_task_create("task", 100, 0, NULL);
21   MSG_task_execute (task);
22   MSG_task_destroy (task);
23   return 0;
24 }
25
26 int main(int argc, char *argv[])
27 {
28   MSG_init(&argc, argv);
29   xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
30
31   MSG_create_environment(argv[1]);
32   MSG_process_create("simple_func", simple_func, NULL, MSG_get_host_by_name("Tremblay"));
33   MSG_process_create("simple_func", simple_func, NULL, MSG_get_host_by_name("Fafard"));
34
35   MSG_main();
36   return 0;
37 }