Logo AND Algorithmique Numérique Distribuée

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