Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
adding test example to trace process migration using the mask TRACE_PROCESS
[simgrid.git] / include / msg / datatypes.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2002,2003,2004 Arnaud Legrand. All rights reserved.        */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #ifndef MSG_DATATYPE_H
9 #define MSG_DATATYPE_H
10 #include "xbt/misc.h"
11 #include "instr/tracing_config.h" // for HAVE_TRACING
12
13 SG_BEGIN_DECL()
14
15 /* ******************************** Host ************************************ */
16 /** @defgroup m_datatypes_management_details Details on MSG datatypes
17     @ingroup  m_datatypes_management*/
18      typedef struct simdata_host *simdata_host_t;
19 /** @brief Host datatype 
20     @ingroup m_datatypes_management_details */
21      typedef struct m_host {
22        char *name;              /**< @brief host name if any */
23        simdata_host_t simdata;  /**< @brief simulator data */
24        void *data;              /**< @brief user data */
25      } s_m_host_t;
26 /** @brief Host datatype  
27     @ingroup m_datatypes_management
28
29     A <em>location</em> (or <em>host</em>) is any possible place where
30     a process may run. Thus it is represented as a <em>physical
31     resource with computing capabilities</em>, some <em>mailboxes</em>
32     to enable running process to communicate with remote ones, and
33     some <em>private data</em> that can be only accessed by local
34     process.
35
36     \see m_host_management
37   @{ */
38      typedef struct m_host *m_host_t;
39 /** @} */
40 /* ******************************** Task ************************************ */
41
42      typedef struct simdata_task *simdata_task_t;
43 /** @brief Task datatype 
44     @ingroup m_datatypes_management_details */
45      typedef struct m_task {
46        char *name;              /**< @brief task name if any */
47        simdata_task_t simdata;  /**< @brief simulator data */
48        void *data;              /**< @brief user data */
49 #ifdef HAVE_TRACING
50        long long int counter;   /* task unique identifier for instrumentation */
51        char *category;      /* task category for instrumentation */
52 #endif
53      } s_m_task_t;
54 /** @brief Task datatype  
55     @ingroup m_datatypes_management 
56
57     A <em>task</em> may then be defined by a <em>computing
58     amount</em>, a <em>message size</em> and some <em>private
59     data</em>.
60     \see m_task_management
61   @{ */
62      typedef struct m_task *m_task_t;
63
64 /** \brief Default value for an uninitialized #m_task_t.
65     \ingroup m_datatypes_management 
66 */
67 #define MSG_TASK_UNINITIALIZED NULL
68
69 /** @} */
70
71
72
73 /* ****************************** Process *********************************** */
74      typedef struct simdata_process *simdata_process_t;
75 /** @brief Process datatype 
76     @ingroup m_datatypes_management_details @{ */
77      typedef struct m_process {
78        char *name;              /**< @brief process name if any */
79        simdata_process_t simdata;
80                                 /**< @brief simulator data */
81        void *data;              /**< @brief user data */
82        char *category;      /* process category for instrumentation */
83      } s_m_process_t;
84 /** @} */
85 /** @brief Agent datatype  
86     @ingroup m_datatypes_management 
87
88     An agent may be defined as a <em>code</em>, with some <em>private
89     data</em>, executing in a <em>location</em>.
90     \see m_process_management
91   @{ */
92      typedef struct m_process *m_process_t;
93 /** @} */
94
95 /* ********************************* Channel ******************************** */
96 /** @brief Channel datatype  
97     @ingroup m_datatypes_management 
98
99     A <em>channel</em>  is a number and identifies a mailbox type (just as a 
100     port number does).
101     \see m_channel_management
102    @{ */
103      typedef int m_channel_t;
104 /** @} */
105
106 /* ******************************** Mailbox ************************************ */
107
108      typedef struct s_msg_mailbox *msg_mailbox_t;
109 /** @brief Mailbox datatype
110     @ingroup m_datatypes_management_details @{ */
111
112      msg_mailbox_t MSG_mailbox_create(const char *alias);
113      void MSG_mailbox_free(void *mailbox);
114
115
116 /** @} */
117
118
119 /* ***************************** Error handling ***************************** */
120 /** @brief Error handling 
121     @ingroup m_datatypes_management 
122     @{
123 */ /* Keep these code as binary values: java bindings manipulate | of these values */
124      typedef enum {
125        MSG_OK = 0,            /**< @brief Everything is right. Keep on going this way ! */
126        MSG_TIMEOUT=1,         /**< @brief nothing good happened before the timer you provided elapsed */
127        MSG_TRANSFER_FAILURE=2,/**< @brief There has been a problem during you task
128       transfer. Either the network is down or the remote host has been
129       shutdown. */
130        MSG_HOST_FAILURE=4,    /**< @brief System shutdown. The host on which you are
131       running has just been rebooted. Free your datastructures and
132       return now !*/
133        MSG_TASK_CANCELLED=8,  /**< @brief Canceled task. This task has been canceled by somebody!*/
134      } MSG_error_t;
135 /** @} */
136
137 SG_END_DECL()
138 #endif