Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e7316ac5812e080366bb9576fff99e02ff84b99d
[simgrid.git] / examples / msg / chainsend / chainsend.c
1 /* Copyright (c) 2007-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 #include "iterator.h"
9 #include "messages.h"
10 #include "broadcaster.h"
11 #include "peer.h"
12
13 /** @addtogroup MSG_examples
14  * 
15  *  - <b>chainsend: MSG implementation of a file broadcasting system, similar to Kastafior (from Kadeploy).</b>.
16  */
17
18 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chainsend, "Messages specific for chainsend");
19
20 int main(int argc, char *argv[])
21 {
22   msg_error_t res = MSG_OK;
23
24   MSG_init(&argc, argv);
25
26   MSG_create_environment(argv[1]);
27
28   /* Trace categories */
29   TRACE_category_with_color("host0", "0 0 1");
30   TRACE_category_with_color("host1", "0 1 0");
31   TRACE_category_with_color("host2", "0 1 1");
32   TRACE_category_with_color("host3", "1 0 0");
33   TRACE_category_with_color("host4", "1 0 1");
34   TRACE_category_with_color("host5", "0 0 0");
35   TRACE_category_with_color("host6", "1 1 0");
36   TRACE_category_with_color("host7", "1 1 1");
37   TRACE_category_with_color("host8", "0 1 0");
38
39   /*   Application deployment */
40   MSG_function_register("broadcaster", broadcaster);
41   MSG_function_register("peer", peer);
42
43   MSG_launch_application(argv[2]);
44
45   res = MSG_main();
46
47   XBT_INFO("Total simulation time: %e", MSG_get_clock());
48
49   return res != MSG_OK;
50 }