1 /* Copyright (c) 2004-2013. The SimGrid Team.
2 * All rights reserved. */
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. */
11 #include "xbt/dynar.h"
13 #include "xbt/graph.h"
16 #include "xbt/config.h"
17 #include "surf/datatypes.h"
19 #include "surf/surf_routing.h"
20 #include "simgrid/platf_interface.h"
23 /* Actions and models are highly connected structures... */
25 /* user-visible parameters */
26 extern double sg_tcp_gamma;
27 extern double sg_sender_gap;
28 extern double sg_latency_factor;
29 extern double sg_bandwidth_factor;
30 extern double sg_weight_S_parameter;
31 extern int sg_network_crosstraffic;
33 extern double sg_gtnets_jitter;
34 extern int sg_gtnets_jitter_seed;
36 extern xbt_dynar_t surf_path;
39 SURF_NETWORK_ELEMENT_NULL = 0, /* NULL */
40 SURF_NETWORK_ELEMENT_HOST, /* host type */
41 SURF_NETWORK_ELEMENT_ROUTER, /* router type */
42 SURF_NETWORK_ELEMENT_AS /* AS type */
43 } e_surf_network_element_type_t;
48 class WorkstationModel;
49 class NetworkCm02Model;
53 class WorkstationCLM03;
54 class NetworkCm02Link;
58 class StorageActionLmm;
63 typedef struct Model Model;
64 typedef struct CpuModel CpuModel;
65 typedef struct WorkstationModel WorkstationModel;
66 typedef struct NetworkCm02Model NetworkCm02Model;
67 typedef struct StorageModel StorageModel;
68 typedef struct Resource Resource;
69 typedef struct ResourceLmm ResourceLmm;
70 typedef struct WorkstationCLM03 WorkstationCLM03;
71 typedef struct NetworkCm02Link NetworkCm02Link;
72 typedef struct Cpu Cpu;
73 typedef struct Action Action;
74 typedef struct ActionLmm ActionLmm;
75 typedef struct StorageActionLmm StorageActionLmm;
77 typedef struct RoutingEdge RoutingEdge;
78 typedef struct RoutingPlatf RoutingPlatf;
81 /** \ingroup SURF_models
82 * \brief Model datatype
84 * Generic data structure for a model. The workstations,
85 * the CPUs and the network links are examples of models.
87 typedef Model *surf_model_t;
88 typedef CpuModel *surf_cpu_model_t;
89 typedef WorkstationModel *surf_workstation_model_t;
90 typedef NetworkCm02Model *surf_network_model_t;
91 typedef StorageModel *surf_storage_model_t;
93 typedef xbt_dictelm_t surf_resource_t;
94 typedef Resource *surf_cpp_resource_t;
95 typedef WorkstationCLM03 *surf_workstation_CLM03_t;
96 typedef NetworkCm02Link *surf_network_link_t;
97 typedef Cpu *surf_cpu_t;
99 /** \ingroup SURF_actions
100 * \brief Action structure
102 * Never create s_surf_action_t by yourself ! The actions are created
103 * on the fly when you call execute or communicate on a model.
105 * \see e_surf_action_state_t
107 typedef Action *surf_action_t;
108 typedef ActionLmm *surf_action_lmm_t;
109 typedef StorageActionLmm *surf_storage_action_lmm_t;
112 typedef RoutingEdge *routing_edge_t;
113 typedef RoutingPlatf *routing_platf_t;
115 typedef struct surf_file *surf_file_t;
117 XBT_PUBLIC(e_surf_network_element_type_t)
118 routing_get_network_element_type(const char* name);
120 /** @Brief Specify that we use that action */
121 XBT_PUBLIC(void) surf_action_ref(surf_action_t action);
123 /** @brief Creates a new action.
125 * @param size The size is the one of the subtype you want to create
126 * @param cost initial value
127 * @param model to which model we should attach this action
128 * @param failed whether we should start this action in failed mode
130 XBT_PUBLIC(void *) surf_action_new(size_t size, double cost,
131 surf_model_t model, int failed);
133 /** \brief Resource model description
135 typedef struct surf_model_description {
137 const char *description;
138 void_f_void_t model_init_preparse;
139 } s_surf_model_description_t, *surf_model_description_t;
141 XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
143 XBT_PUBLIC(void) model_help(const char *category,
144 s_surf_model_description_t * table);
148 /** \ingroup SURF_actions
149 * \brief Action states
153 * \see surf_action_t, surf_action_state_t
157 SURF_ACTION_READY = 0, /**< Ready */
158 SURF_ACTION_RUNNING, /**< Running */
159 SURF_ACTION_FAILED, /**< Task Failure */
160 SURF_ACTION_DONE, /**< Completed */
161 SURF_ACTION_TO_FREE, /**< Action to free in next cleanup */
162 SURF_ACTION_NOT_IN_THE_SYSTEM
163 /**< Not in the system anymore. Why did you ask ? */
164 } e_surf_action_state_t;
166 /***************************/
167 /* Generic model object */
168 /***************************/
169 //FIXME:REMOVE typedef struct s_routing_platf s_routing_platf_t, *routing_platf_t;
170 XBT_PUBLIC_DATA(routing_platf_t) routing_platf;
172 /*******************************************
173 * TUTORIAL: New model
174 * New model extension public
175 * Public functions specific to a New model.
177 typedef struct surf_new_model_extension_public {
178 surf_action_t(*fct) ();
179 void* (*create_resource) ();
180 } s_surf_model_extension_new_model_t;
181 /*******************************************/
183 /** \ingroup SURF_models
184 * \brief Private data available on all models
186 typedef struct surf_model_private *surf_model_private_t;
190 /** \ingroup SURF_models
191 * \brief CPU model extension public
193 * Public functions specific to the CPU model.
195 typedef struct surf_cpu_model_extension_public {
196 surf_action_t(*execute) (void *cpu, double size);
197 surf_action_t(*sleep) (void *cpu, double duration);
198 e_surf_resource_state_t(*get_state) (void *cpu);
199 int (*get_core) (void *cpu);
200 double (*get_speed) (void *cpu, double load);
201 double (*get_available_speed) (void *cpu);
202 double (*get_current_power_peak) (void *cpu);
203 double (*get_power_peak_at) (void *cpu, int pstate_index);
204 int (*get_nb_pstates) (void *cpu);
205 void (*set_power_peak_at) (void *cpu, int pstate_index);
206 double (*get_consumed_energy) (void *cpu);
207 void (*add_traces) (void);
208 } s_surf_model_extension_cpu_t;
212 /** \ingroup SURF_models
213 * \brief Network model extension public
215 * Public functions specific to the network model
217 typedef struct surf_network_model_extension_public {
218 surf_action_t (*communicate) (sg_routing_edge_t src,
219 sg_routing_edge_t dst,
220 double size, double rate);
221 xbt_dynar_t(*get_route) (void *src, void *dst); //FIXME: kill field? That is done by the routing nowadays
222 double (*get_link_bandwidth) (const void *link);
223 double (*get_link_latency) (const void *link);
224 int (*link_shared) (const void *link);
225 void (*add_traces) (void);
226 } s_surf_model_extension_network_t;
230 /** \ingroup SURF_models
231 * \brief Storage model extension public
233 * Public functions specific to the Storage model.
236 typedef struct surf_storage_model_extension_public {
237 surf_action_t(*open) (void *storage, const char* mount, const char* path);
238 surf_action_t(*close) (void *storage, surf_file_t fd);
239 surf_action_t(*read) (void *storage, surf_file_t fd, sg_storage_size_t size);
240 surf_action_t(*write) (void *storage, surf_file_t fd, sg_storage_size_t size);
241 surf_action_t(*stat) (void *storage, surf_file_t fd);
242 surf_action_t(*ls) (void *storage, const char *path);
243 xbt_dict_t(*get_properties) (const void *storage);
244 xbt_dict_t(*get_content) (void *storage);
245 sg_storage_size_t(*get_size) (void *storage);
246 } s_surf_model_extension_storage_t;
248 /** \ingroup SURF_models
249 * \brief Workstation model extension public
251 * Public functions specific to the workstation model.
253 typedef struct surf_workstation_model_extension_public {
254 surf_action_t(*execute) (void *workstation, double size); /**< Execute a computation amount on a workstation
255 and create the corresponding action */
256 surf_action_t(*sleep) (void *workstation, double duration); /**< Make a workstation sleep during a given duration */
257 e_surf_resource_state_t(*get_state) (void *workstation); /**< Return the CPU state of a workstation */
259 int (*get_core) (void *workstation);
260 double (*get_speed) (void *workstation, double load); /**< Return the speed of a workstation */
261 double (*get_available_speed) (void *workstation); /**< Return tha available speed of a workstation */
263 double (*get_current_power_peak) (void *workstation); /**< Return the current CPU speed of a workstation */
264 double (*get_power_peak_at) (void *workstation, int pstate_index); /**< Return the speed of a workstation for a specific pstate,
265 (where higher pstate values represent lower processor speeds) */
266 int (*get_nb_pstates) (void *workstation); /**< Return the number of pstates defined for a workstation (default is 1) */
267 void (*set_power_peak_at) (void *workstation, int pstate_index); /**< Set the processor speed of a workstation to the speed associated with the pstate_index pstate */
268 double (*get_consumed_energy) (void *workstation); /**< Return the total energy consumed by a workstation */
270 surf_action_t(*communicate) (void *workstation_src, /**< Execute a communication amount between two workstations */
271 void *workstation_dst, double size,
273 // FIXME: kill next field, which duplicates the routing
274 xbt_dynar_t(*get_route) (void *workstation_src, void *workstation_dst); /**< Get the list of links between two ws */
276 surf_action_t(*execute_parallel_task) (int workstation_nb, /**< Execute a parallel task on several workstations */
277 void **workstation_list,
278 double *computation_amount,
279 double *communication_amount,
281 double (*get_link_bandwidth) (const void *link); /**< Return the current bandwidth of a network link */
282 double (*get_link_latency) (const void *link); /**< Return the current latency of a network link */
283 surf_action_t(*open) (void *workstation, const char* storage,
285 surf_action_t(*close) (void *workstation, surf_file_t fd);
286 surf_action_t(*read) (void *workstation, surf_file_t fd, sg_storage_size_t size);
287 surf_action_t(*write) (void *workstation, surf_file_t fd, sg_storage_size_t size);
288 surf_action_t(*stat) (void *workstation, surf_file_t fd);
289 int(*unlink) (void *workstation, surf_file_t fd);
290 surf_action_t(*ls) (void *workstation, const char* mount, const char *path);
291 sg_storage_size_t (*get_size) (void *workstation, surf_file_t fd);
292 xbt_dynar_t (*get_info) (void *workstation, surf_file_t fd);
294 int (*link_shared) (const void *link);
295 xbt_dict_t(*get_properties) (const void *resource);
296 void (*add_traces) (void);
298 sg_storage_size_t (*get_free_size) (void *workstation,const char* name);
299 sg_storage_size_t (*get_used_size) (void *workstation,const char* name);
300 xbt_dict_t (*get_storage_list) (void *workstation);
302 } s_surf_model_extension_workstation_t;
305 static inline void *surf_cpu_resource_priv(const void *host) {
306 return xbt_lib_get_level((xbt_dictelm_t)host, SURF_CPU_LEVEL);
308 static inline void *surf_workstation_resource_priv(const void *host){
309 return (void*)xbt_lib_get_level((xbt_dictelm_t)host, SURF_WKS_LEVEL);
311 static inline void *surf_storage_resource_priv(const void *storage){
312 return (void*)xbt_lib_get_level((xbt_dictelm_t)storage, SURF_STORAGE_LEVEL);
315 static inline void *surf_cpu_resource_by_name(const char *name) {
316 return xbt_lib_get_elm_or_null(host_lib, name);
318 static inline void *surf_workstation_resource_by_name(const char *name){
319 return xbt_lib_get_elm_or_null(host_lib, name);
321 static inline void *surf_storage_resource_by_name(const char *name){
322 return xbt_lib_get_elm_or_null(storage_lib, name);
328 char *surf_routing_edge_name(sg_routing_edge_t edge);
329 void *surf_as_cluster_get_backbone(AS_t as);
330 void surf_as_cluster_set_backbone(AS_t as, void* backbone);
331 const char *surf_model_name(surf_model_t model);
332 xbt_swag_t surf_model_done_action_set(surf_model_t model);
333 xbt_swag_t surf_model_failed_action_set(surf_model_t model);
334 xbt_swag_t surf_model_ready_action_set(surf_model_t model);
335 xbt_swag_t surf_model_running_action_set(surf_model_t model);
336 surf_action_t surf_workstation_model_execute_parallel_task(surf_workstation_model_t model,
338 void **workstation_list,
339 double *computation_amount,
340 double *communication_amount,
342 surf_action_t surf_workstation_model_communicate(surf_workstation_model_t model, surf_resource_t src, surf_resource_t dst, double size, double rate);
343 xbt_dynar_t surf_workstation_model_get_route(surf_workstation_model_t model, surf_resource_t src, surf_resource_t dst);
344 surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_routing_edge_t src, sg_routing_edge_t dst, double size, double rate);
345 const char *surf_resource_name(surf_cpp_resource_t resource);
346 xbt_dict_t surf_resource_get_properties(surf_cpp_resource_t resource);
347 e_surf_resource_state_t surf_resource_get_state(surf_cpp_resource_t resource);
348 double surf_workstation_get_speed(surf_resource_t resource, double load);
349 double surf_workstation_get_available_speed(surf_resource_t resource);
350 int surf_workstation_get_core(surf_resource_t resource);
351 surf_action_t surf_workstation_execute(surf_resource_t resource, double size);
352 surf_action_t surf_workstation_sleep(surf_resource_t resource, double duration);
353 surf_action_t surf_workstation_open(surf_resource_t workstation, const char* mount, const char* path);
354 surf_action_t surf_workstation_close(surf_resource_t workstation, surf_file_t fd);
355 surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size);
356 surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size);
357 xbt_dynar_t surf_workstation_get_info(surf_resource_t resource, surf_file_t fd);
358 sg_storage_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name);
359 sg_storage_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name);
360 surf_action_t surf_cpu_execute(surf_resource_t cpu, double size);
361 surf_action_t surf_cpu_sleep(surf_resource_t cpu, double duration);
362 double surf_workstation_get_current_power_peak(surf_resource_t host);
363 double surf_workstation_get_power_peak_at(surf_resource_t host, int pstate_index);
364 int surf_workstation_get_nb_pstates(surf_resource_t host);
365 void surf_workstation_set_power_peak_at(surf_resource_t host, int pstate_index);
366 double surf_workstation_get_consumed_energy(surf_resource_t host);
367 xbt_dict_t surf_workstation_get_storage_list(surf_resource_t workstation);
368 int surf_workstation_unlink(surf_resource_t workstation, surf_file_t fd);
369 surf_action_t surf_workstation_ls(surf_resource_t workstation, const char* mount, const char *path);
370 size_t surf_workstation_get_size(surf_resource_t workstation, surf_file_t fd);
371 int surf_network_link_is_shared(surf_cpp_resource_t link);
372 double surf_network_link_get_bandwidth(surf_cpp_resource_t link);
373 double surf_network_link_get_latency(surf_cpp_resource_t link);
374 xbt_dict_t surf_storage_get_content(surf_resource_t resource);
375 sg_storage_size_t surf_storage_get_size(surf_resource_t resource);
376 void *surf_action_get_data(surf_action_t action);
377 void surf_action_set_data(surf_action_t action, void *data);
378 void surf_action_unref(surf_action_t action);
379 double surf_action_get_start_time(surf_action_t action);
380 double surf_action_get_finish_time(surf_action_t action);
381 double surf_action_get_remains(surf_action_t action);
382 void surf_action_suspend(surf_action_t action);
383 void surf_action_resume(surf_action_t action);
384 void surf_action_cancel(surf_action_t action);
385 void surf_action_set_priority(surf_action_t action, double priority);
386 void surf_action_set_category(surf_action_t action, const char *category);
387 e_surf_action_state_t surf_action_get_state(surf_action_t action);
388 int surf_action_get_cost(surf_action_t action);
389 surf_file_t surf_storage_action_get_file(surf_action_t action);
390 xbt_dict_t surf_storage_action_get_ls_dict(surf_action_t action);
396 /**************************************/
397 /* Implementations of model object */
398 /**************************************/
401 /** \ingroup SURF_models
402 * \brief The CPU model
404 XBT_PUBLIC_DATA(surf_cpu_model_t) surf_cpu_model;
406 /** \ingroup SURF_models
407 * \brief Initializes the CPU model with the model Cas01
409 * By default, this model uses the lazy optimization mechanism that
410 * relies on partial invalidation in LMM and a heap for lazy action update.
411 * You can change this behavior by setting the cpu/optim configuration
412 * variable to a different value.
414 * You shouldn't have to call it by yourself.
416 XBT_PUBLIC(void) surf_cpu_model_init_Cas01(void);
418 /** \ingroup SURF_models
419 * \brief Initializes the CPU model with trace integration [Deprecated]
421 * You shouldn't have to call it by yourself.
423 XBT_PUBLIC(void) surf_cpu_model_init_ti(void);
425 /** \ingroup SURF_models
426 * \brief The list of all available optimization modes (both for cpu and networks).
427 * These optimization modes can be set using --cfg=cpu/optim:... and --cfg=network/optim:...
429 XBT_PUBLIC_DATA(s_surf_model_description_t) surf_optimization_mode_description[];
431 /** \ingroup SURF_models
432 * \brief The list of all available cpu model models
434 XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[];
436 /**\brief create new host bypass the parser
441 /** \ingroup SURF_models
442 * \brief The network model
444 * When creating a new API on top on SURF, you shouldn't use the
445 * network model unless you know what you are doing. Only the workstation
446 * model should be accessed because depending on the platform model,
447 * the network model can be NULL.
449 XBT_PUBLIC_DATA(surf_network_model_t) surf_network_model;
451 /** \ingroup SURF_models
452 * \brief Same as network model 'LagrangeVelho', only with different correction factors.
454 * This model is proposed by Pierre-Nicolas Clauss and Martin Quinson and Stéphane Génaud
455 * based on the model 'LV08' and different correction factors depending on the communication
456 * size (< 1KiB, < 64KiB, >= 64KiB).
457 * See comments in the code for more information.
459 * \see surf_workstation_model_init_SMPI()
461 XBT_PUBLIC(void) surf_network_model_init_SMPI(void);
463 /** \ingroup SURF_models
464 * \brief Initializes the platform with the network model 'LegrandVelho'
466 * This model is proposed by Arnaud Legrand and Pedro Velho based on
467 * the results obtained with the GTNets simulator for onelink and
468 * dogbone sharing scenarios. See comments in the code for more information.
470 * \see surf_workstation_model_init_LegrandVelho()
472 XBT_PUBLIC(void) surf_network_model_init_LegrandVelho(void);
474 /** \ingroup SURF_models
475 * \brief Initializes the platform with the network model 'Constant'
477 * In this model, the communication time between two network cards is
478 * constant, hence no need for a routing table. This is particularly
479 * usefull when simulating huge distributed algorithms where
480 * scalability is really an issue. This function is called in
481 * conjunction with surf_workstation_model_init_compound.
483 * \see surf_workstation_model_init_compound()
485 XBT_PUBLIC(void) surf_network_model_init_Constant(void);
487 /** \ingroup SURF_models
488 * \brief Initializes the platform with the network model CM02
490 * You sould call this function by yourself only if you plan using
491 * surf_workstation_model_init_compound.
492 * See comments in the code for more information.
494 XBT_PUBLIC(void) surf_network_model_init_CM02(void);
497 /** \ingroup SURF_models
498 * \brief Initializes the platform with the network model GTNETS
499 * \param filename XML platform file name
501 * This function is called by surf_workstation_model_init_GTNETS
502 * or by yourself only if you plan using surf_workstation_model_init_compound
504 * \see surf_workstation_model_init_GTNETS()
506 XBT_PUBLIC(void) surf_network_model_init_GTNETS(void);
510 /** \ingroup SURF_models
511 * \brief Initializes the platform with the network model NS3
512 * \param filename XML platform file name
514 * This function is called by surf_workstation_model_init_NS3
515 * or by yourself only if you plan using surf_workstation_model_init_compound
517 * \see surf_workstation_model_init_NS3()
519 XBT_PUBLIC(void) surf_network_model_init_NS3(void);
522 /** \ingroup SURF_models
523 * \brief Initializes the platform with the network model Reno
524 * \param filename XML platform file name
526 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
529 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
530 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
532 * Call this function only if you plan using surf_workstation_model_init_compound.
535 XBT_PUBLIC(void) surf_network_model_init_Reno(void);
537 /** \ingroup SURF_models
538 * \brief Initializes the platform with the network model Reno2
539 * \param filename XML platform file name
541 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
544 * [LOW01] S. H. Low. A duality model of TCP and queue management algorithms.
545 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
547 * Call this function only if you plan using surf_workstation_model_init_compound.
550 XBT_PUBLIC(void) surf_network_model_init_Reno2(void);
552 /** \ingroup SURF_models
553 * \brief Initializes the platform with the network model Vegas
554 * \param filename XML platform file name
556 * This problem is related to max( sum( a * Df * ln(xi) ) ) which is equivalent
557 * to the proportional fairness.
560 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
561 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
563 * Call this function only if you plan using surf_workstation_model_init_compound.
566 XBT_PUBLIC(void) surf_network_model_init_Vegas(void);
568 /** \ingroup SURF_models
569 * \brief The list of all available network model models
571 XBT_PUBLIC_DATA(s_surf_model_description_t)
572 surf_network_model_description[];
574 /** \ingroup SURF_models
575 * \brief The storage model
577 XBT_PUBLIC(void) surf_storage_model_init_default(void);
579 /** \ingroup SURF_models
580 * \brief The list of all available storage modes.
581 * This storage mode can be set using --cfg=storage/model:...
583 XBT_PUBLIC_DATA(s_surf_model_description_t) surf_storage_model_description[];
585 XBT_PUBLIC_DATA(surf_storage_model_t) surf_storage_model;
587 /** \ingroup SURF_models
588 * \brief The workstation model
590 * Note that when you create an API on top of SURF,
591 * the workstation model should be the only one you use
592 * because depending on the platform model, the network model and the CPU model
595 XBT_PUBLIC_DATA(surf_workstation_model_t) surf_workstation_model;
597 /** \ingroup SURF_models
598 * \brief Initializes the platform with a compound workstation model
600 * This function should be called after a cpu_model and a
601 * network_model have been set up.
604 XBT_PUBLIC(void) surf_workstation_model_init_compound(void);
606 /** \ingroup SURF_models
607 * \brief Initializes the platform with the current best network and cpu models at hand
609 * This platform model seperates the workstation model and the network model.
610 * The workstation model will be initialized with the model compound, the network
611 * model with the model LV08 (with cross traffic support) and the CPU model with
613 * Such model is subject to modification with warning in the ChangeLog so monitor it!
616 XBT_PUBLIC(void) surf_workstation_model_init_current_default(void);
618 /** \ingroup SURF_models
619 * \brief Initializes the platform with the model KCCFLN05
621 * With this model, only parallel tasks can be used. Resource sharing
622 * is done by identifying bottlenecks and giving an equal share of
623 * the model to each action.
626 XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(void);
628 /** \ingroup SURF_models
629 * \brief The list of all available workstation model models
631 XBT_PUBLIC_DATA(s_surf_model_description_t)
632 surf_workstation_model_description[];
634 /*******************************************/
636 /** \ingroup SURF_models
637 * \brief List of initialized models
639 XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
641 /** \ingroup SURF_simulation
642 * \brief List of hosts that have juste restarted and whose autorestart process should be restarted.
644 XBT_PUBLIC_DATA(xbt_dynar_t) host_that_restart;
646 /** \ingroup SURF_simulation
647 * \brief List of hosts for which one want to be notified if they ever restart.
649 XBT_PUBLIC(xbt_dict_t) watched_hosts_lib;
651 /*******************************************/
652 /*** SURF Platform *************************/
653 /*******************************************/
657 XBT_PUBLIC_DATA(AS_t) surf_AS_get_routing_root(void);
658 XBT_PUBLIC_DATA(const char *) surf_AS_get_name(AS_t as);
659 XBT_PUBLIC_DATA(xbt_dict_t) surf_AS_get_routing_sons(AS_t as);
660 XBT_PUBLIC_DATA(const char *) surf_AS_get_model(AS_t as);
661 XBT_PUBLIC_DATA(xbt_dynar_t) surf_AS_get_hosts(AS_t as);
662 XBT_PUBLIC_DATA(void) surf_AS_get_graph(AS_t as, xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
663 XBT_PUBLIC_DATA(AS_t) surf_platf_get_root(routing_platf_t platf);
664 XBT_PUBLIC_DATA(e_surf_network_element_type_t) surf_routing_edge_get_rc_type(sg_routing_edge_t edge);
669 /*******************************************/
670 /*** SURF Globals **************************/
671 /*******************************************/
673 /** \ingroup SURF_simulation
674 * \brief Initialize SURF
675 * \param argc argument number
676 * \param argv arguments
678 * This function has to be called to initialize the common
679 * structures. Then you will have to create the environment by
681 * e.g. surf_workstation_model_init_CM02()
683 * \see surf_workstation_model_init_CM02(), surf_workstation_model_init_compound(), surf_exit()
685 XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */
687 /** \ingroup SURF_simulation
688 * \brief Finish simulation initialization
690 * This function must be called before the first call to surf_solve()
692 XBT_PUBLIC(void) surf_presolve(void);
694 /** \ingroup SURF_simulation
695 * \brief Performs a part of the simulation
696 * \param max_date Maximum date to update the simulation to, or -1
697 * \return the elapsed time, or -1.0 if no event could be executed
699 * This function execute all possible events, update the action states
700 * and returns the time elapsed.
701 * When you call execute or communicate on a model, the corresponding actions
702 * are not executed immediately but only when you call surf_solve.
703 * Note that the returned elapsed time can be zero.
705 XBT_PUBLIC(double) surf_solve(double max_date);
707 /** \ingroup SURF_simulation
708 * \brief Return the current time
710 * Return the current time in millisecond.
712 XBT_PUBLIC(double) surf_get_clock(void);
714 /** \ingroup SURF_simulation
721 XBT_PUBLIC(void) surf_exit(void);
723 /* Prototypes of the functions that handle the properties */
724 XBT_PUBLIC_DATA(xbt_dict_t) current_property_set; /* the prop set for the currently parsed element (also used in SIMIX) */
726 /* surf parse file related (public because called from a test suite) */
727 XBT_PUBLIC(void) parse_platform_file(const char *file);
729 /* For the trace and trace:connect tag (store their content till the end of the parsing) */
730 XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
731 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail;
732 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_power;
733 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
734 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
735 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
738 XBT_PUBLIC(double) get_cpu_power(const char *power);
740 XBT_PUBLIC(xbt_dict_t) get_as_router_properties(const char* name);
742 int surf_get_nthreads(void);
743 void surf_set_nthreads(int nthreads);
746 * Returns the initial path. On Windows the initial path is
747 * the current directory for the current process in the other
748 * case the function returns "./" that represents the current
749 * directory on Unix/Linux platforms.
751 const char *__surf_get_initial_path(void);
753 /********** Tracing **********/
754 /* from surf_instr.c */
755 void TRACE_surf_action(surf_action_t surf_action, const char *category);
756 void TRACE_surf_alloc(void);
757 void TRACE_surf_release(void);
759 /* instr_routing.c */
760 void instr_routing_define_callbacks (void);
761 void instr_new_variable_type (const char *new_typename, const char *color);
762 void instr_new_user_variable_type (const char *father_type, const char *new_typename, const char *color);
763 void instr_new_user_state_type (const char *father_type, const char *new_typename);
764 void instr_new_value_for_user_state_type (const char *_typename, const char *value, const char *color);
765 int instr_platform_traced (void);
766 xbt_graph_t instr_routing_platform_graph (void);
767 void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
770 #endif /* _SURF_SURF_H */