1 /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. 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"
15 #include "xbt/config.h"
16 #include "surf/datatypes.h"
20 int ROUTING_HOST_LEVEL; //Routing level
21 int SURF_CPU_LEVEL; //Surf cpu level
22 int SURF_WKS_LEVEL; //Surf workstation level
23 int SIMIX_HOST_LEVEL; //Simix level
24 int MSG_HOST_LEVEL; //Msg level
25 int SD_HOST_LEVEL; //Simdag level
26 int COORD_HOST_LEVEL; //Coordinates level
29 int SD_LINK_LEVEL; //Simdag level
30 int SURF_LINK_LEVEL; //Surf level
32 xbt_lib_t as_router_lib;
33 int ROUTING_ASR_LEVEL; //Routing level
34 int COORD_ASR_LEVEL; //Coordinates level
37 /* Actions and models are highly connected structures... */
39 SURF_RESOURCE_ON = 1, /**< Up & ready */
40 SURF_RESOURCE_OFF = 0 /**< Down & broken */
41 } e_surf_resource_state_t;
44 SURF_LINK_FULLDUPLEX = 2,
47 } e_surf_link_sharing_policy_t;
50 SURF_NETWORK_ELEMENT_NULL = 0, /* NULL */
51 SURF_NETWORK_ELEMENT_HOST, /* host type */
52 SURF_NETWORK_ELEMENT_ROUTER, /* router type */
53 SURF_NETWORK_ELEMENT_AS, /* AS type */
54 } e_surf_network_element_type_t;
56 XBT_PUBLIC(e_surf_network_element_type_t) get_network_element_type(const char
59 /** @Brief Specify that we use that action */
60 XBT_PUBLIC(void) surf_action_ref(surf_action_t action);
61 /** @brief Creates a new action.
63 * @param size The size is the one of the subtype you want to create
64 * @param cost initial value
65 * @param model to which model we should attach this action
66 * @param failed whether we should start this action in failed mode
68 XBT_PUBLIC(void *) surf_action_new(size_t size, double cost,
69 surf_model_t model, int failed);
71 /** \brief Resource model description
73 typedef struct surf_model_description {
75 const char *description;
77 void (*model_init_preparse) (const char *filename);
78 void (*model_init_postparse) (void);
79 } s_surf_model_description_t, *surf_model_description_t;
81 XBT_PUBLIC(void) update_model_description(s_surf_model_description_t *
82 table, const char *name,
84 XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
86 XBT_PUBLIC(void) model_help(const char *category,
87 s_surf_model_description_t * table);
89 /** \brief Action structure
90 * \ingroup SURF_actions
92 * Never create s_surf_action_t by yourself ! The actions are created
93 * on the fly when you call execute or communicate on a model.
95 * \see e_surf_action_state_t
97 typedef struct surf_action {
98 s_xbt_swag_hookup_t state_hookup;
100 double cost; /**< cost */
101 double priority; /**< priority (1.0 by default) */
102 double max_duration; /**< max_duration (may fluctuate until
103 the task is completed) */
104 double remains; /**< How much of that cost remains to
105 * be done in the currently running task */
106 #ifdef HAVE_LATENCY_BOUND_TRACKING
107 int latency_limited; /**< Set to 1 if is limited by latency, 0 otherwise */
110 double start; /**< start time */
111 double finish; /**< finish time : this is modified during the run
112 * and fluctuates until the task is completed */
113 void *data; /**< for your convenience */
115 surf_model_t model_type;
117 char *category; /**< tracing category for categorized resource utilization monitoring */
121 typedef struct surf_action_lmm {
122 s_surf_action_t generic_action;
123 lmm_variable_t variable;
125 } s_surf_action_lmm_t, *surf_action_lmm_t;
127 /** \brief Action states
128 * \ingroup SURF_actions
132 * \see surf_action_t, surf_action_state_t
135 SURF_ACTION_READY = 0, /**< Ready */
136 SURF_ACTION_RUNNING, /**< Running */
137 SURF_ACTION_FAILED, /**< Task Failure */
138 SURF_ACTION_DONE, /**< Completed */
139 SURF_ACTION_TO_FREE, /**< Action to free in next cleanup */
140 SURF_ACTION_NOT_IN_THE_SYSTEM
141 /**< Not in the system anymore. Why did you ask ? */
142 } e_surf_action_state_t;
144 /** \brief Action state sets
145 * \ingroup SURF_actions
147 * This structure contains some sets of actions.
148 * It provides a fast access to the actions in each state.
150 * \see surf_action_t, e_surf_action_state_t
152 typedef struct surf_action_state {
153 xbt_swag_t ready_action_set;
154 /**< Actions in state SURF_ACTION_READY */
155 xbt_swag_t running_action_set;
156 /**< Actions in state SURF_ACTION_RUNNING */
157 xbt_swag_t failed_action_set;
158 /**< Actions in state SURF_ACTION_FAILED */
159 xbt_swag_t done_action_set;
160 /**< Actions in state SURF_ACTION_DONE */
161 } s_surf_action_state_t, *surf_action_state_t;
163 /***************************/
164 /* Generic model object */
165 /***************************/
166 typedef struct s_routing_global s_routing_global_t, *routing_global_t;
167 XBT_PUBLIC_DATA(routing_global_t) global_routing;
170 /** \brief Private data available on all models
171 * \ingroup SURF_models
173 typedef struct surf_model_private *surf_model_private_t;
177 /** \brief CPU model extension public
178 * \ingroup SURF_models
180 * Public functions specific to the CPU model.
182 typedef struct surf_cpu_model_extension_public {
183 surf_action_t(*execute) (void *cpu, double size);
184 surf_action_t(*sleep) (void *cpu, double duration);
185 e_surf_resource_state_t(*get_state) (void *cpu);
186 double (*get_speed) (void *cpu, double load);
187 double (*get_available_speed) (void *cpu);
188 void (*create_resource) (char *name, double power_peak,
190 tmgr_trace_t power_trace,
192 e_surf_resource_state_t state_initial,
193 tmgr_trace_t state_trace,
194 xbt_dict_t cpu_properties);
195 void (*add_traces) (void);
196 } s_surf_model_extension_cpu_t;
200 /** \brief Network model extension public
201 * \ingroup SURF_models
203 * Public functions specific to the network model
205 typedef struct surf_network_model_extension_public {
206 surf_action_t(*communicate) (const char *src_name,
207 const char *dst_name,
208 double size, double rate);
209 xbt_dynar_t(*get_route) (const char *src_name, const char *dst_name);
210 double (*get_link_bandwidth) (const void *link);
211 double (*get_link_latency) (const void *link);
212 int (*link_shared) (const void *link);
213 void (*add_traces) (void);
214 void (*create_resource) (char *name,
216 tmgr_trace_t bw_trace,
218 tmgr_trace_t lat_trace,
219 e_surf_resource_state_t
221 tmgr_trace_t state_trace,
222 e_surf_link_sharing_policy_t policy,
223 xbt_dict_t properties);
224 } s_surf_model_extension_network_t;
226 /** \brief Workstation model extension public
227 * \ingroup SURF_models
229 * Public functions specific to the workstation model.
231 typedef struct surf_workstation_model_extension_public {
232 surf_action_t(*execute) (void *workstation, double size); /**< Execute a computation amount on a workstation
233 and create the corresponding action */
234 surf_action_t(*sleep) (void *workstation, double duration); /**< Make a workstation sleep during a given duration */
235 e_surf_resource_state_t(*get_state) (void *workstation); /**< Return the CPU state of a workstation */
236 double (*get_speed) (void *workstation, double load); /**< Return the speed of a workstation */
237 double (*get_available_speed) (void *workstation); /**< Return tha available speed of a workstation */
238 surf_action_t(*communicate) (void *workstation_src, /**< Execute a communication amount between two workstations */
239 void *workstation_dst, double size,
241 xbt_dynar_t(*get_route) (void *workstation_src, void *workstation_dst); /**< Get the list of links between two ws */
243 surf_action_t(*execute_parallel_task) (int workstation_nb, /**< Execute a parallel task on several workstations */
244 void **workstation_list,
245 double *computation_amount,
246 double *communication_amount,
247 double amount, double rate);
248 double (*get_link_bandwidth) (const void *link); /**< Return the current bandwidth of a network link */
249 double (*get_link_latency) (const void *link); /**< Return the current latency of a network link */
250 int (*link_shared) (const void *link);
251 xbt_dict_t(*get_properties) (const void *resource);
252 void (*link_create_resource) (char *name,
254 tmgr_trace_t bw_trace,
256 tmgr_trace_t lat_trace,
257 e_surf_resource_state_t
259 tmgr_trace_t state_trace,
260 e_surf_link_sharing_policy_t
261 policy, xbt_dict_t properties);
262 void (*cpu_create_resource) (char *name, double power_peak,
264 tmgr_trace_t power_trace,
265 e_surf_resource_state_t state_initial,
266 tmgr_trace_t state_trace,
267 xbt_dict_t cpu_properties);
268 void (*add_traces) (void);
270 } s_surf_model_extension_workstation_t;
275 /** \brief Model datatype
276 * \ingroup SURF_models
278 * Generic data structure for a model. The workstations,
279 * the CPUs and the network links are examples of models.
281 typedef struct surf_model {
282 const char *name; /**< Name of this model */
283 s_surf_action_state_t states; /**< Any living action on this model */
285 e_surf_action_state_t(*action_state_get) (surf_action_t action);
286 /**< Return the state of an action */
287 void (*action_state_set) (surf_action_t action,
288 e_surf_action_state_t state);
289 /**< Change an action state*/
291 double (*action_get_start_time) (surf_action_t action); /**< Return the start time of an action */
292 double (*action_get_finish_time) (surf_action_t action); /**< Return the finish time of an action */
293 int (*action_unref) (surf_action_t action); /**< Specify that we don't use that action anymore */
294 void (*action_cancel) (surf_action_t action); /**< Cancel a running action */
295 void (*action_recycle) (surf_action_t action); /**< Recycle an action */
296 void (*action_data_set) (surf_action_t action, void *data); /**< Set the user data of an action */
297 void (*suspend) (surf_action_t action); /**< Suspend an action */
298 void (*resume) (surf_action_t action); /**< Resume a suspended action */
299 int (*is_suspended) (surf_action_t action); /**< Return whether an action is suspended */
300 void (*set_max_duration) (surf_action_t action, double duration); /**< Set the max duration of an action*/
301 void (*set_priority) (surf_action_t action, double priority); /**< Set the priority of an action */
303 void (*set_category) (surf_action_t action, const char *category); /**< Set the category of an action */
305 double (*get_remains) (surf_action_t action); /**< Get the remains of an action */
306 #ifdef HAVE_LATENCY_BOUND_TRACKING
307 int (*get_latency_limited) (surf_action_t action); /**< Return 1 if action is limited by latency, 0 otherwise */
310 surf_model_private_t model_private;
313 s_surf_model_extension_cpu_t cpu;
314 s_surf_model_extension_network_t network;
315 s_surf_model_extension_workstation_t workstation;
319 surf_model_t surf_model_init(void);
320 void surf_model_exit(surf_model_t model);
322 static inline void *surf_cpu_resource_by_name(const char *name) {
323 return xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL);
325 static inline void *surf_workstation_resource_by_name(const char *name){
326 return xbt_lib_get_or_null(host_lib, name, SURF_WKS_LEVEL);
328 static inline void *surf_network_resource_by_name(const char *name){
329 return xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL);
332 typedef struct surf_resource {
335 xbt_dict_t properties;
336 } s_surf_resource_t, *surf_resource_t;
341 * Resource which have a metric handled by a maxmin system
346 tmgr_trace_event_t event;
349 typedef struct surf_resource_lmm {
350 s_surf_resource_t generic_resource;
351 lmm_constraint_t constraint;
352 e_surf_resource_state_t state_current;
353 tmgr_trace_event_t state_event;
354 s_surf_metric_t power;
355 } s_surf_resource_lmm_t, *surf_resource_lmm_t;
357 /**************************************/
358 /* Implementations of model object */
359 /**************************************/
362 /** \brief The CPU model
363 * \ingroup SURF_models
365 XBT_PUBLIC_DATA(surf_model_t) surf_cpu_model;
367 /** \brief Initializes the CPU model with the model Cas01
368 * \ingroup SURF_models
370 * This function is called by surf_workstation_model_init_CLM03
371 * so you shouldn't have to call it by yourself.
373 * \see surf_workstation_model_init_CLM03()
375 XBT_PUBLIC(void) surf_cpu_model_init_Cas01(const char *filename);
377 /** \brief Initializes the CPU model with trace integration
378 * \ingroup SURF_models
381 XBT_PUBLIC(void) surf_cpu_model_init_ti(const char *filename);
383 /** \brief Initializes the CPU model with the model Cas01 Improved. This model uses a heap to order the events, decreasing the time complexity to get the minimum next event.
384 * \ingroup SURF_models
386 * This function is called by surf_workstation_model_init_CLM03
387 * so you shouldn't have to call it by yourself.
389 * \see surf_workstation_model_init_CLM03()
391 XBT_PUBLIC(void) surf_cpu_model_init_Cas01_im(const char *filename);
393 /** \brief The list of all available cpu model models
394 * \ingroup SURF_models
396 XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[];
398 XBT_PUBLIC(void) create_workstations(void);
400 /**\brief create new host bypass the parser
405 /** \brief The network model
406 * \ingroup SURF_models
408 * When creating a new API on top on SURF, you shouldn't use the
409 * network model unless you know what you are doing. Only the workstation
410 * model should be accessed because depending on the platform model,
411 * the network model can be NULL.
413 XBT_PUBLIC_DATA(surf_model_t) surf_network_model;
415 /** \brief Same as network model 'LagrangeVelho', only with different correction factors.
416 * \ingroup SURF_models
417 * \param filename XML platform file name
419 * This model is proposed by Pierre-Nicolas Clauss and Martin Quinson and Stéphane Génaud
420 * based on the model 'LV08' and different correction factors depending on the communication
421 * size (< 1KiB, < 64KiB, >= 64KiB).
423 * \see surf_workstation_model_init_SMPI()
425 XBT_PUBLIC(void) surf_network_model_init_SMPI(const char *filename);
427 /** \brief Initializes the platform with the network model 'LagrangeVelho'
428 * \ingroup SURF_models
429 * \param filename XML platform file name
431 * This model is proposed by Arnaud Legrand and Pedro Velho based on
432 * the results obtained with the GTNets simulator for onelink and
433 * dogbone sharing scenarios.
435 * \see surf_workstation_model_init_LegrandVelho()
437 XBT_PUBLIC(void) surf_network_model_init_LegrandVelho(const char
441 /** \brief Initializes the platform with the network model 'LV08_im'
442 * \ingroup SURF_models
443 * \param filename XML platform file name
445 * This model is adds the lazy management improvement to Legrand and
446 * Velho model. This improvement essentially replaces the list of actions
447 * inside the simulation kernel by a heap in order to reduce the complexity
448 * at each iteration of the simulation kernel.
450 * \see surf_workstation_model_init_LegrandVelho()
452 XBT_PUBLIC(void) im_surf_network_model_init_LegrandVelho(const char
455 /** \brief Initializes the platform with the network model 'Constant'
456 * \ingroup SURF_models
457 * \param filename XML platform file name
459 * In this model, the communication time between two network cards is
460 * constant, hence no need for a routing table. This is particularly
461 * usefull when simulating huge distributed algorithms where
462 * scalability is really an issue. This function is called in
463 * conjunction with surf_workstation_model_init_compound.
465 * \see surf_workstation_model_init_compound()
467 XBT_PUBLIC(void) surf_network_model_init_Constant(const char *filename);
469 /** \brief Initializes the platform with the network model CM02
470 * \ingroup SURF_models
471 * \param filename XML platform file name
473 * This function is called by surf_workstation_model_init_CLM03
474 * or by yourself only if you plan using surf_workstation_model_init_compound
476 * \see surf_workstation_model_init_CLM03()
478 XBT_PUBLIC(void) surf_network_model_init_CM02(const char *filename);
481 * brief initialize the the network model bypassing the XML parser
483 XBT_PUBLIC(void) surf_network_model_init_bypass(const char *id,
488 /** \brief Initializes the platform with the network model GTNETS
489 * \ingroup SURF_models
490 * \param filename XML platform file name
492 * This function is called by surf_workstation_model_init_GTNETS
493 * or by yourself only if you plan using surf_workstation_model_init_compound
495 * \see surf_workstation_model_init_GTNETS()
497 XBT_PUBLIC(void) surf_network_model_init_GTNETS(const char *filename);
501 /** \brief Initializes the platform with the network model NS3
502 * \ingroup SURF_models
503 * \param filename XML platform file name
505 * This function is called by surf_workstation_model_init_NS3
506 * or by yourself only if you plan using surf_workstation_model_init_compound
508 * \see surf_workstation_model_init_NS3()
510 XBT_PUBLIC(void) surf_network_model_init_NS3(const char *filename);
512 XBT_PUBLIC(void) parse_ns3_add_host(void);
513 XBT_PUBLIC(void) parse_ns3_add_router(void);
514 XBT_PUBLIC(void) parse_ns3_add_link(void);
515 XBT_PUBLIC(void) parse_ns3_add_AS(void);
516 XBT_PUBLIC(void) parse_ns3_add_route(void);
517 XBT_PUBLIC(void) parse_ns3_add_ASroute(void);
518 XBT_PUBLIC(void) parse_ns3_add_cluster(void);
522 /** \brief Initializes the platform with the network model Reno
523 * \ingroup SURF_models
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(const char *filename);
537 /** \brief Initializes the platform with the network model Reno2
538 * \ingroup SURF_models
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(const char *filename);
552 /** \brief Initializes the platform with the network model Vegas
553 * \ingroup SURF_models
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(const char *filename);
568 /** \brief The list of all available network model models
569 * \ingroup SURF_models
571 XBT_PUBLIC_DATA(s_surf_model_description_t)
572 surf_network_model_description[];
575 /** \brief The workstation model
576 * \ingroup SURF_models
578 * Note that when you create an API on top of SURF,
579 * the workstation model should be the only one you use
580 * because depending on the platform model, the network model and the CPU model
583 XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model;
585 /** \brief Initializes the platform with a compound workstation model
586 * \ingroup SURF_models
587 * \param filename XML platform file name
589 * This function should be called after a cpu_model and a
590 * network_model have been set up.
593 XBT_PUBLIC(void) surf_workstation_model_init_compound(const char
596 /** \brief Initializes the platform with the workstation model CLM03
597 * \ingroup SURF_models
598 * \param filename XML platform file name
600 * This platform model seperates the workstation model and the network model.
601 * The workstation model will be initialized with the model CLM03, the network
602 * model with the model CM02 and the CPU model with the model Cas01.
603 * In future releases, some other network models will be implemented and will be
604 * combined with the workstation model CLM03.
606 * \see surf_workstation_model_init_KCCFLN05()
608 XBT_PUBLIC(void) surf_workstation_model_init_CLM03(const char *filename);
610 /** \brief Initializes the platform with the model KCCFLN05
611 * \ingroup SURF_models
612 * \param filename XML platform file name
614 * With this model, the workstations and the network are handled
615 * together. The network model is roughly the same as in CM02 but
616 * interference between computations and communications can be taken
617 * into account. This platform model is the default one for MSG and
621 XBT_PUBLIC(void) surf_workstation_model_init_KCCFLN05(const char
624 /** \brief Initializes the platform with the model KCCFLN05
625 * \ingroup SURF_models
626 * \param filename XML platform file name
628 * With this model, only parallel tasks can be used. Resource sharing
629 * is done by identifying bottlenecks and giving an equal share of
630 * the model to each action.
633 XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(const char
636 /** \brief The list of all available workstation model models
637 * \ingroup SURF_models
639 XBT_PUBLIC_DATA(s_surf_model_description_t)
640 surf_workstation_model_description[];
642 /** \brief List of initialized models
643 * \ingroup SURF_models
645 XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
647 /*******************************************/
648 /*** SURF Globals **************************/
649 /*******************************************/
650 XBT_PUBLIC_DATA(xbt_cfg_t) _surf_cfg_set;
652 /** \brief Initialize SURF
653 * \ingroup SURF_simulation
654 * \param argc argument number
655 * \param argv arguments
657 * This function has to be called to initialize the common
658 * structures. Then you will have to create the environment by
660 * e.g. surf_workstation_model_init_CLM03() or
661 * surf_workstation_model_init_KCCFLN05().
663 * \see surf_workstation_model_init_CLM03(),
664 * surf_workstation_model_init_KCCFLN05(), surf_workstation_model_init_compound(), surf_exit()
666 XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */
668 /** \brief Initialize the used models.
670 * Must be called after the surf_init so that configuration infrastructure is created
671 * Must be called before parsing/creating the environment
672 * Must not be called within the initialization process so that the use get a chance to change the settings from
673 * its code between, say, MSG_init and MSG_create_environment using MSG_config
675 XBT_PUBLIC(void) surf_config_models_setup(const char *platform_file);
677 /** \brief create the elements of the models
679 * Must be called after parsing the platform file and before using any elements
681 XBT_PUBLIC(void) surf_config_models_create_elms(void);
683 /** \brief Finish simulation initialization
684 * \ingroup SURF_simulation
686 * This function must be called before the first call to surf_solve()
688 XBT_PUBLIC(void) surf_presolve(void);
690 /** \brief Performs a part of the simulation
691 * \ingroup SURF_simulation
692 * \param max_date Maximum date to update the simulation to, or -1
693 * \return the elapsed time, or -1.0 if no event could be executed
695 * This function execute all possible events, update the action states
696 * and returns the time elapsed.
697 * When you call execute or communicate on a model, the corresponding actions
698 * are not executed immediately but only when you call surf_solve.
699 * Note that the returned elapsed time can be zero.
701 XBT_PUBLIC(double) surf_solve(double max_date);
703 /** \brief Return the current time
704 * \ingroup SURF_simulation
706 * Return the current time in millisecond.
708 XBT_INLINE XBT_PUBLIC(double) surf_get_clock(void);
711 * \ingroup SURF_simulation
717 XBT_PUBLIC(void) surf_exit(void);
719 /* Prototypes of the functions that handle the properties */
720 XBT_PUBLIC_DATA(xbt_dict_t) current_property_set; /* the prop set for the currently parsed element (also used in SIMIX) */
721 XBT_PUBLIC_DATA(void) parse_properties(const char* prop_id, const char* prop_value);
722 XBT_PUBLIC_DATA(void) parse_properties_XML(void);
723 XBT_PUBLIC_DATA(void) parse_properties_lua(const char* prop_id, const char* prop_value);
725 /* surf parse file related (public because called from a test suite) */
726 XBT_PUBLIC(void) parse_platform_file(const char *file);
728 /* Stores the sets */
729 XBT_PUBLIC_DATA(xbt_dict_t) set_list;
731 /* For the trace and trace:connect tag (store their content till the end of the parsing) */
732 XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
733 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail;
734 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_power;
735 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
736 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
737 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
740 XBT_PUBLIC(double) get_cpu_power(const char *power);
742 /*public interface to create resource bypassing the parser via cpu/network model
744 * see surfxml_parse.c
746 XBT_PUBLIC(void) surf_host_create_resource(char *name, double power_peak,
748 tmgr_trace_t power_trace,
750 e_surf_resource_state_t
752 tmgr_trace_t state_trace,
753 xbt_dict_t cpu_properties);
755 /*public interface to create resource bypassing the parser via workstation_ptask_L07 model
757 * see surfxml_parse.c
759 XBT_PUBLIC(void) surf_wsL07_host_create_resource(char *name,
762 tmgr_trace_t power_trace,
763 e_surf_resource_state_t
765 tmgr_trace_t state_trace,
769 * create link resource
770 * see surfxml_parse.c
772 XBT_PUBLIC(void) surf_link_create_resource(char *name,
774 tmgr_trace_t bw_trace,
776 tmgr_trace_t lat_trace,
777 e_surf_resource_state_t
779 tmgr_trace_t state_trace,
780 e_surf_link_sharing_policy_t
781 policy, xbt_dict_t properties);
784 XBT_PUBLIC(void) surf_wsL07_link_create_resource(char *name,
786 tmgr_trace_t bw_trace,
788 tmgr_trace_t lat_trace,
789 e_surf_resource_state_t
791 tmgr_trace_t state_trace,
792 e_surf_link_sharing_policy_t
794 xbt_dict_t properties);
796 * add route element (link_ctn) bypassing the parser
798 * see surfxml_parse.c
801 XBT_PUBLIC(void) surf_add_route_element(char *link_ctn_id);
804 * set route src_id,dest_id, and create a route resource
806 * see surf_routing.c && surfxml_parse.c
809 XBT_PUBLIC(void) surf_set_routes(void);
814 * see surfxml_parse.c
816 XBT_PUBLIC(void) surf_add_host_traces(void);
817 XBT_PUBLIC(void) surf_add_link_traces(void);
818 XBT_PUBLIC(void) surf_wsL07_add_traces(void);
821 * init AS from lua console
824 XBT_PUBLIC(void) routing_AS_init(const char *id, const char *mode);
825 XBT_PUBLIC(void) routing_AS_end(const char *id);
826 // add host to network element list
827 XBT_PUBLIC(void) routing_add_host(const char *host_id);
828 //Set a new link on the actual list of link for a route or ASroute
829 XBT_PUBLIC(void) routing_add_link(const char *link_id);
830 //Set the endpoints for a route
831 XBT_PUBLIC(void) routing_set_route(const char *src_id, const char *dst_id);
833 XBT_PUBLIC(void) routing_store_route(void);
836 * interface between surf and lua bindings
837 * see surfxml_parse.c
839 XBT_PUBLIC(void) surf_AS_new(const char *id, const char *mode);
840 XBT_PUBLIC(void) surf_AS_finalize(const char *id);
841 XBT_PUBLIC(void) surf_route_add_host(const char *id);
842 XBT_PUBLIC(void) surf_routing_add_route(const char *src_id,
844 xbt_dynar_t links_id);
846 #include "surf/surf_resource.h"
847 #include "surf/surf_resource_lmm.h"
850 #endif /* _SURF_SURF_H */