Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Functions RngStream must be XBT_PUBLIC for dll
[simgrid.git] / include / simgrid / platf.h
1 /* platf.h - Public interface to the SimGrid platforms                      */
2
3 /* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010, 2011. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #ifndef SG_PLATF_H
10 #define SG_PLATF_H
11
12 #include <xbt.h>
13
14 typedef void *sg_routing_link_t; /* The actual type is model-dependent so use void* instead*/
15 typedef struct s_routing_edge *sg_routing_edge_t;
16
17 XBT_PUBLIC(sg_routing_edge_t) sg_routing_edge_by_name_or_null(const char *name);
18
19
20
21 typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
22 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new(const char *filename);
23 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id,
24                                                     const char *input,
25                                                     double periodicity);
26
27 /** Defines whether a given resource is working or not */
28 typedef enum {
29   SURF_RESOURCE_ON = 1,                   /**< Up & ready        */
30   SURF_RESOURCE_OFF = 0                   /**< Down & broken     */
31 } e_surf_resource_state_t;
32
33 typedef enum {
34   SURF_LINK_FULLDUPLEX = 2,
35   SURF_LINK_SHARED = 1,
36   SURF_LINK_FATPIPE = 0
37 } e_surf_link_sharing_policy_t;
38
39 /*
40  * Platform creation functions. Instead of passing 123 arguments to the creation functions
41  * (one for each possible XML attribute), we pass structures containing them all. It removes the
42  * chances of switching arguments by error, and reduce the burden when we add a new attribute:
43  * old models can just continue to ignore it without having to update their headers.
44  *
45  * It shouldn't be too costly at runtime, provided that structures living on the stack are
46  * used, instead of malloced structures.
47  */
48
49 typedef struct {
50   const char* id;
51   double power_peak;
52   int core_amount;
53   double power_scale;
54   tmgr_trace_t power_trace;
55   e_surf_resource_state_t initial_state;
56   tmgr_trace_t state_trace;
57   const char* coord;
58   xbt_dict_t properties;
59 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
60
61 typedef struct {
62   const char* id;
63   const char* coord;
64 } s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
65
66 typedef struct {
67   const char* id;
68   double bandwidth;
69   tmgr_trace_t bandwidth_trace;
70   double latency;
71   tmgr_trace_t latency_trace;
72   e_surf_resource_state_t state;
73   tmgr_trace_t state_trace;
74   e_surf_link_sharing_policy_t policy;
75   xbt_dict_t properties;
76 } s_sg_platf_link_cbarg_t, *sg_platf_link_cbarg_t;
77
78 typedef struct s_sg_platf_peer_cbarg *sg_platf_peer_cbarg_t;
79 typedef struct s_sg_platf_peer_cbarg {
80   const char* id;
81   double power;
82   double bw_in;
83   double bw_out;
84   double lat;
85   const char* coord;
86   tmgr_trace_t availability_trace;
87   tmgr_trace_t state_trace;
88 } s_sg_platf_peer_cbarg_t;
89
90 typedef struct s_sg_platf_linkctn_cbarg *sg_platf_linkctn_cbarg_t;
91 typedef struct s_sg_platf_linkctn_cbarg {
92   const char *id;
93   const char *direction;
94 } s_sg_platf_linkctn_cbarg_t;
95
96 typedef struct s_sg_platf_cluster_cbarg *sg_platf_cluster_cbarg_t;
97 typedef struct s_sg_platf_cluster_cbarg {
98   const char* id;
99   const char* prefix;
100   const char* suffix;
101   const char* radical;
102   double power;
103   int core_amount;
104   double bw;
105   double lat;
106   double bb_bw;
107   double bb_lat;
108   const char* router_id;
109   e_surf_link_sharing_policy_t sharing_policy;
110   e_surf_link_sharing_policy_t bb_sharing_policy;
111   const char* availability_trace; //don't convert to tmgr_trace_t since there is a trace per host and some rewriting is needed
112   const char* state_trace;
113 } s_sg_platf_cluster_cbarg_t;
114
115 typedef struct {
116   const char* id;
117   const char* type_id;
118 } s_sg_platf_storage_cbarg_t, *sg_platf_storage_cbarg_t;
119
120 typedef struct {
121   const char* id;
122   const char* model;
123   const char* content;
124   xbt_dict_t properties;
125 } s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
126
127 typedef struct {
128   const char* type_id;
129   const char* name;
130 } s_sg_platf_mstorage_cbarg_t, *sg_platf_mstorage_cbarg_t;
131
132 typedef struct {
133   const char* id;
134   const char* name;
135 } s_sg_platf_mount_cbarg_t, *sg_platf_mount_cbarg_t;
136
137
138 XBT_PUBLIC(void) sg_platf_begin(void);  // Start a new platform
139 XBT_PUBLIC(void) sg_platf_end(void); // Finish the creation of the platform
140
141 XBT_PUBLIC(void) sg_platf_new_AS_begin(const char *id, const char *mode); // Begin description of new AS
142 XBT_PUBLIC(void) sg_platf_new_AS_end(void);                            // That AS is fully described
143
144 XBT_PUBLIC(void) sg_platf_new_host   (sg_platf_host_cbarg_t   host);   // Add an host   to the currently described AS
145 XBT_PUBLIC(void) sg_platf_new_router (sg_platf_router_cbarg_t router); // Add a router  to the currently described AS
146 XBT_PUBLIC(void) sg_platf_new_link   (sg_platf_link_cbarg_t link);     // Add a link    to the currently described AS
147 XBT_PUBLIC(void) sg_platf_new_peer   (sg_platf_peer_cbarg_t peer);     // Add a peer    to the currently described AS
148 XBT_PUBLIC(void) sg_platf_new_cluster(sg_platf_cluster_cbarg_t clust); // Add a cluster to the currently described AS
149 XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS
150 XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS
151 XBT_PUBLIC(void) sg_platf_new_mstorage(sg_platf_mstorage_cbarg_t mstorage);
152 XBT_PUBLIC(void) sg_platf_new_storage_type(sg_platf_storage_type_cbarg_t storage_type);
153 XBT_PUBLIC(void) sg_platf_new_mount(sg_platf_mount_cbarg_t mount);
154
155 #endif                          /* SG_PLATF_H */