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
27 int NS3_HOST_LEVEL; //host node for ns3
30 int SD_LINK_LEVEL; //Simdag level
31 int SURF_LINK_LEVEL; //Surf level
32 int NS3_LINK_LEVEL; //link for ns3
34 xbt_lib_t as_router_lib;
35 int ROUTING_ASR_LEVEL; //Routing level
36 int COORD_ASR_LEVEL; //Coordinates level
37 int NS3_ASR_LEVEL; //host node for ns3
40 /* Actions and models are highly connected structures... */
42 SURF_RESOURCE_ON = 1, /**< Up & ready */
43 SURF_RESOURCE_OFF = 0 /**< Down & broken */
44 } e_surf_resource_state_t;
47 SURF_LINK_FULLDUPLEX = 2,
50 } e_surf_link_sharing_policy_t;
53 SURF_NETWORK_ELEMENT_NULL = 0, /* NULL */
54 SURF_NETWORK_ELEMENT_HOST, /* host type */
55 SURF_NETWORK_ELEMENT_ROUTER, /* router type */
56 SURF_NETWORK_ELEMENT_AS, /* AS type */
57 } e_surf_network_element_type_t;
59 XBT_PUBLIC(e_surf_network_element_type_t) get_network_element_type(const char
62 /** @Brief Specify that we use that action */
63 XBT_PUBLIC(void) surf_action_ref(surf_action_t action);
64 /** @brief Creates a new action.
66 * @param size The size is the one of the subtype you want to create
67 * @param cost initial value
68 * @param model to which model we should attach this action
69 * @param failed whether we should start this action in failed mode
71 XBT_PUBLIC(void *) surf_action_new(size_t size, double cost,
72 surf_model_t model, int failed);
74 /** \brief Resource model description
76 typedef struct surf_model_description {
78 const char *description;
80 void (*model_init_preparse) (const char *filename);
81 void (*model_init_postparse) (void);
82 } s_surf_model_description_t, *surf_model_description_t;
84 XBT_PUBLIC(void) update_model_description(s_surf_model_description_t *
85 table, const char *name,
87 XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
89 XBT_PUBLIC(void) model_help(const char *category,
90 s_surf_model_description_t * table);
92 /** \brief Action structure
93 * \ingroup SURF_actions
95 * Never create s_surf_action_t by yourself ! The actions are created
96 * on the fly when you call execute or communicate on a model.
98 * \see e_surf_action_state_t
100 typedef struct surf_action {
101 s_xbt_swag_hookup_t state_hookup;
102 xbt_swag_t state_set;
103 double cost; /**< cost */
104 double priority; /**< priority (1.0 by default) */
105 double max_duration; /**< max_duration (may fluctuate until
106 the task is completed) */
107 double remains; /**< How much of that cost remains to
108 * be done in the currently running task */
109 #ifdef HAVE_LATENCY_BOUND_TRACKING
110 int latency_limited; /**< Set to 1 if is limited by latency, 0 otherwise */
113 double start; /**< start time */
114 double finish; /**< finish time : this is modified during the run
115 * and fluctuates until the task is completed */
116 void *data; /**< for your convenience */
118 surf_model_t model_type;
120 char *category; /**< tracing category for categorized resource utilization monitoring */
124 typedef struct surf_action_lmm {
125 s_surf_action_t generic_action;
126 lmm_variable_t variable;
128 } s_surf_action_lmm_t, *surf_action_lmm_t;
130 /** \brief Action states
131 * \ingroup SURF_actions
135 * \see surf_action_t, surf_action_state_t
138 SURF_ACTION_READY = 0, /**< Ready */
139 SURF_ACTION_RUNNING, /**< Running */
140 SURF_ACTION_FAILED, /**< Task Failure */
141 SURF_ACTION_DONE, /**< Completed */
142 SURF_ACTION_TO_FREE, /**< Action to free in next cleanup */
143 SURF_ACTION_NOT_IN_THE_SYSTEM
144 /**< Not in the system anymore. Why did you ask ? */
145 } e_surf_action_state_t;
147 /** \brief Action state sets
148 * \ingroup SURF_actions
150 * This structure contains some sets of actions.
151 * It provides a fast access to the actions in each state.
153 * \see surf_action_t, e_surf_action_state_t
155 typedef struct surf_action_state {
156 xbt_swag_t ready_action_set;
157 /**< Actions in state SURF_ACTION_READY */
158 xbt_swag_t running_action_set;
159 /**< Actions in state SURF_ACTION_RUNNING */
160 xbt_swag_t failed_action_set;
161 /**< Actions in state SURF_ACTION_FAILED */
162 xbt_swag_t done_action_set;
163 /**< Actions in state SURF_ACTION_DONE */
164 } s_surf_action_state_t, *surf_action_state_t;
166 /***************************/
167 /* Generic model object */
168 /***************************/
169 typedef struct s_routing_global s_routing_global_t, *routing_global_t;
170 XBT_PUBLIC_DATA(routing_global_t) global_routing;
173 /** \brief Private data available on all models
174 * \ingroup SURF_models
176 typedef struct surf_model_private *surf_model_private_t;
180 /** \brief CPU model extension public
181 * \ingroup SURF_models
183 * Public functions specific to the CPU model.
185 typedef struct surf_cpu_model_extension_public {
186 surf_action_t(*execute) (void *cpu, double size);
187 surf_action_t(*sleep) (void *cpu, double duration);
188 e_surf_resource_state_t(*get_state) (void *cpu);
189 double (*get_speed) (void *cpu, double load);
190 double (*get_available_speed) (void *cpu);
191 void (*create_resource) (char *name, double power_peak,
193 tmgr_trace_t power_trace,
195 e_surf_resource_state_t state_initial,
196 tmgr_trace_t state_trace,
197 xbt_dict_t cpu_properties);
198 void (*add_traces) (void);
199 } s_surf_model_extension_cpu_t;
203 /** \brief Network model extension public
204 * \ingroup SURF_models
206 * Public functions specific to the network model
208 typedef struct surf_network_model_extension_public {
209 surf_action_t(*communicate) (const char *src_name,
210 const char *dst_name,
211 double size, double rate);
212 xbt_dynar_t(*get_route) (const char *src_name, const char *dst_name);
213 double (*get_link_bandwidth) (const void *link);
214 double (*get_link_latency) (const void *link);
215 int (*link_shared) (const void *link);
216 void (*add_traces) (void);
217 void (*create_resource) (char *name,
219 tmgr_trace_t bw_trace,
221 tmgr_trace_t lat_trace,
222 e_surf_resource_state_t
224 tmgr_trace_t state_trace,
225 e_surf_link_sharing_policy_t policy,
226 xbt_dict_t properties);
227 } s_surf_model_extension_network_t;
229 /** \brief Workstation model extension public
230 * \ingroup SURF_models
232 * Public functions specific to the workstation model.
234 typedef struct surf_workstation_model_extension_public {
235 surf_action_t(*execute) (void *workstation, double size); /**< Execute a computation amount on a workstation
236 and create the corresponding action */
237 surf_action_t(*sleep) (void *workstation, double duration); /**< Make a workstation sleep during a given duration */
238 e_surf_resource_state_t(*get_state) (void *workstation); /**< Return the CPU state of a workstation */
239 double (*get_speed) (void *workstation, double load); /**< Return the speed of a workstation */
240 double (*get_available_speed) (void *workstation); /**< Return tha available speed of a workstation */
241 surf_action_t(*communicate) (void *workstation_src, /**< Execute a communication amount between two workstations */
242 void *workstation_dst, double size,
244 xbt_dynar_t(*get_route) (void *workstation_src, void *workstation_dst); /**< Get the list of links between two ws */
246 surf_action_t(*execute_parallel_task) (int workstation_nb, /**< Execute a parallel task on several workstations */
247 void **workstation_list,
248 double *computation_amount,
249 double *communication_amount,
250 double amount, double rate);
251 double (*get_link_bandwidth) (const void *link); /**< Return the current bandwidth of a network link */
252 double (*get_link_latency) (const void *link); /**< Return the current latency of a network link */
253 int (*link_shared) (const void *link);
254 xbt_dict_t(*get_properties) (const void *resource);
255 void (*link_create_resource) (char *name,
257 tmgr_trace_t bw_trace,
259 tmgr_trace_t lat_trace,
260 e_surf_resource_state_t
262 tmgr_trace_t state_trace,
263 e_surf_link_sharing_policy_t
264 policy, xbt_dict_t properties);
265 void (*cpu_create_resource) (char *name, double power_peak,
267 tmgr_trace_t power_trace,
268 e_surf_resource_state_t state_initial,
269 tmgr_trace_t state_trace,
270 xbt_dict_t cpu_properties);
271 void (*add_traces) (void);
273 } s_surf_model_extension_workstation_t;
278 /** \brief Model datatype
279 * \ingroup SURF_models
281 * Generic data structure for a model. The workstations,
282 * the CPUs and the network links are examples of models.
284 typedef struct surf_model {
285 const char *name; /**< Name of this model */
286 s_surf_action_state_t states; /**< Any living action on this model */
288 e_surf_action_state_t(*action_state_get) (surf_action_t action);
289 /**< Return the state of an action */
290 void (*action_state_set) (surf_action_t action,
291 e_surf_action_state_t state);
292 /**< Change an action state*/
294 double (*action_get_start_time) (surf_action_t action); /**< Return the start time of an action */
295 double (*action_get_finish_time) (surf_action_t action); /**< Return the finish time of an action */
296 int (*action_unref) (surf_action_t action); /**< Specify that we don't use that action anymore */
297 void (*action_cancel) (surf_action_t action); /**< Cancel a running action */
298 void (*action_recycle) (surf_action_t action); /**< Recycle an action */
299 void (*action_data_set) (surf_action_t action, void *data); /**< Set the user data of an action */
300 void (*suspend) (surf_action_t action); /**< Suspend an action */
301 void (*resume) (surf_action_t action); /**< Resume a suspended action */
302 int (*is_suspended) (surf_action_t action); /**< Return whether an action is suspended */
303 void (*set_max_duration) (surf_action_t action, double duration); /**< Set the max duration of an action*/
304 void (*set_priority) (surf_action_t action, double priority); /**< Set the priority of an action */
306 void (*set_category) (surf_action_t action, const char *category); /**< Set the category of an action */
308 double (*get_remains) (surf_action_t action); /**< Get the remains of an action */
309 #ifdef HAVE_LATENCY_BOUND_TRACKING
310 int (*get_latency_limited) (surf_action_t action); /**< Return 1 if action is limited by latency, 0 otherwise */
313 surf_model_private_t model_private;
316 s_surf_model_extension_cpu_t cpu;
317 s_surf_model_extension_network_t network;
318 s_surf_model_extension_workstation_t workstation;
322 surf_model_t surf_model_init(void);
323 void surf_model_exit(surf_model_t model);
325 static inline void *surf_cpu_resource_by_name(const char *name) {
326 return xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL);
328 static inline void *surf_workstation_resource_by_name(const char *name){
329 return xbt_lib_get_or_null(host_lib, name, SURF_WKS_LEVEL);
331 static inline void *surf_network_resource_by_name(const char *name){
332 return xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL);
335 typedef struct surf_resource {
338 xbt_dict_t properties;
339 } s_surf_resource_t, *surf_resource_t;
344 * Resource which have a metric handled by a maxmin system
349 tmgr_trace_event_t event;
352 typedef struct surf_resource_lmm {
353 s_surf_resource_t generic_resource;
354 lmm_constraint_t constraint;
355 e_surf_resource_state_t state_current;
356 tmgr_trace_event_t state_event;
357 s_surf_metric_t power;
358 } s_surf_resource_lmm_t, *surf_resource_lmm_t;
360 /**************************************/
361 /* Implementations of model object */
362 /**************************************/
365 /** \brief The CPU model
366 * \ingroup SURF_models
368 XBT_PUBLIC_DATA(surf_model_t) surf_cpu_model;
370 /** \brief Initializes the CPU model with the model Cas01
371 * \ingroup SURF_models
373 * This function is called by surf_workstation_model_init_CLM03
374 * so you shouldn't have to call it by yourself.
376 * \see surf_workstation_model_init_CLM03()
378 XBT_PUBLIC(void) surf_cpu_model_init_Cas01(const char *filename);
380 /** \brief Initializes the CPU model with trace integration
381 * \ingroup SURF_models
384 XBT_PUBLIC(void) surf_cpu_model_init_ti(const char *filename);
386 /** \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.
387 * \ingroup SURF_models
389 * This function is called by surf_workstation_model_init_CLM03
390 * so you shouldn't have to call it by yourself.
392 * \see surf_workstation_model_init_CLM03()
394 XBT_PUBLIC(void) surf_cpu_model_init_Cas01_im(const char *filename);
396 /** \brief The list of all available cpu model models
397 * \ingroup SURF_models
399 XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[];
401 XBT_PUBLIC(void) create_workstations(void);
403 /**\brief create new host bypass the parser
408 /** \brief The network model
409 * \ingroup SURF_models
411 * When creating a new API on top on SURF, you shouldn't use the
412 * network model unless you know what you are doing. Only the workstation
413 * model should be accessed because depending on the platform model,
414 * the network model can be NULL.
416 XBT_PUBLIC_DATA(surf_model_t) surf_network_model;
418 /** \brief Same as network model 'LagrangeVelho', only with different correction factors.
419 * \ingroup SURF_models
420 * \param filename XML platform file name
422 * This model is proposed by Pierre-Nicolas Clauss and Martin Quinson and Stéphane Génaud
423 * based on the model 'LV08' and different correction factors depending on the communication
424 * size (< 1KiB, < 64KiB, >= 64KiB).
426 * \see surf_workstation_model_init_SMPI()
428 XBT_PUBLIC(void) surf_network_model_init_SMPI(const char *filename);
430 /** \brief Initializes the platform with the network model 'LagrangeVelho'
431 * \ingroup SURF_models
432 * \param filename XML platform file name
434 * This model is proposed by Arnaud Legrand and Pedro Velho based on
435 * the results obtained with the GTNets simulator for onelink and
436 * dogbone sharing scenarios.
438 * \see surf_workstation_model_init_LegrandVelho()
440 XBT_PUBLIC(void) surf_network_model_init_LegrandVelho(const char
444 /** \brief Initializes the platform with the network model 'LV08_im'
445 * \ingroup SURF_models
446 * \param filename XML platform file name
448 * This model is adds the lazy management improvement to Legrand and
449 * Velho model. This improvement essentially replaces the list of actions
450 * inside the simulation kernel by a heap in order to reduce the complexity
451 * at each iteration of the simulation kernel.
453 * \see surf_workstation_model_init_LegrandVelho()
455 XBT_PUBLIC(void) im_surf_network_model_init_LegrandVelho(const char
458 /** \brief Initializes the platform with the network model 'Constant'
459 * \ingroup SURF_models
460 * \param filename XML platform file name
462 * In this model, the communication time between two network cards is
463 * constant, hence no need for a routing table. This is particularly
464 * usefull when simulating huge distributed algorithms where
465 * scalability is really an issue. This function is called in
466 * conjunction with surf_workstation_model_init_compound.
468 * \see surf_workstation_model_init_compound()
470 XBT_PUBLIC(void) surf_network_model_init_Constant(const char *filename);
472 /** \brief Initializes the platform with the network model CM02
473 * \ingroup SURF_models
474 * \param filename XML platform file name
476 * This function is called by surf_workstation_model_init_CLM03
477 * or by yourself only if you plan using surf_workstation_model_init_compound
479 * \see surf_workstation_model_init_CLM03()
481 XBT_PUBLIC(void) surf_network_model_init_CM02(const char *filename);
484 * brief initialize the the network model bypassing the XML parser
486 XBT_PUBLIC(void) surf_network_model_init_bypass(const char *id,
491 /** \brief Initializes the platform with the network model GTNETS
492 * \ingroup SURF_models
493 * \param filename XML platform file name
495 * This function is called by surf_workstation_model_init_GTNETS
496 * or by yourself only if you plan using surf_workstation_model_init_compound
498 * \see surf_workstation_model_init_GTNETS()
500 XBT_PUBLIC(void) surf_network_model_init_GTNETS(const char *filename);
504 /** \brief Initializes the platform with the network model NS3
505 * \ingroup SURF_models
506 * \param filename XML platform file name
508 * This function is called by surf_workstation_model_init_NS3
509 * or by yourself only if you plan using surf_workstation_model_init_compound
511 * \see surf_workstation_model_init_NS3()
513 XBT_PUBLIC(void) surf_network_model_init_NS3(const char *filename);
515 XBT_PUBLIC(void) parse_ns3_add_host(void);
516 XBT_PUBLIC(void) parse_ns3_add_router(void);
517 XBT_PUBLIC(void) parse_ns3_add_link(void);
518 XBT_PUBLIC(void) parse_ns3_add_AS(void);
519 XBT_PUBLIC(void) parse_ns3_add_route(void);
520 XBT_PUBLIC(void) parse_ns3_add_ASroute(void);
521 XBT_PUBLIC(void) parse_ns3_add_cluster(void);
522 XBT_PUBLIC(void) parse_ns3_end_platform(void);
526 /** \brief Initializes the platform with the network model Reno
527 * \ingroup SURF_models
528 * \param filename XML platform file name
530 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
533 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
534 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
536 * Call this function only if you plan using surf_workstation_model_init_compound.
539 XBT_PUBLIC(void) surf_network_model_init_Reno(const char *filename);
541 /** \brief Initializes the platform with the network model Reno2
542 * \ingroup SURF_models
543 * \param filename XML platform file name
545 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
548 * [LOW01] S. H. Low. A duality model of TCP and queue management algorithms.
549 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
551 * Call this function only if you plan using surf_workstation_model_init_compound.
554 XBT_PUBLIC(void) surf_network_model_init_Reno2(const char *filename);
556 /** \brief Initializes the platform with the network model Vegas
557 * \ingroup SURF_models
558 * \param filename XML platform file name
560 * This problem is related to max( sum( a * Df * ln(xi) ) ) which is equivalent
561 * to the proportional fairness.
564 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
565 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
567 * Call this function only if you plan using surf_workstation_model_init_compound.
570 XBT_PUBLIC(void) surf_network_model_init_Vegas(const char *filename);
572 /** \brief The list of all available network model models
573 * \ingroup SURF_models
575 XBT_PUBLIC_DATA(s_surf_model_description_t)
576 surf_network_model_description[];
579 /** \brief The workstation model
580 * \ingroup SURF_models
582 * Note that when you create an API on top of SURF,
583 * the workstation model should be the only one you use
584 * because depending on the platform model, the network model and the CPU model
587 XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model;
589 /** \brief Initializes the platform with a compound workstation model
590 * \ingroup SURF_models
591 * \param filename XML platform file name
593 * This function should be called after a cpu_model and a
594 * network_model have been set up.
597 XBT_PUBLIC(void) surf_workstation_model_init_compound(const char
600 /** \brief Initializes the platform with the workstation model CLM03
601 * \ingroup SURF_models
602 * \param filename XML platform file name
604 * This platform model seperates the workstation model and the network model.
605 * The workstation model will be initialized with the model CLM03, the network
606 * model with the model CM02 and the CPU model with the model Cas01.
607 * In future releases, some other network models will be implemented and will be
608 * combined with the workstation model CLM03.
610 * \see surf_workstation_model_init_KCCFLN05()
612 XBT_PUBLIC(void) surf_workstation_model_init_CLM03(const char *filename);
614 /** \brief Initializes the platform with the model KCCFLN05
615 * \ingroup SURF_models
616 * \param filename XML platform file name
618 * With this model, the workstations and the network are handled
619 * together. The network model is roughly the same as in CM02 but
620 * interference between computations and communications can be taken
621 * into account. This platform model is the default one for MSG and
625 XBT_PUBLIC(void) surf_workstation_model_init_KCCFLN05(const char
628 /** \brief Initializes the platform with the model KCCFLN05
629 * \ingroup SURF_models
630 * \param filename XML platform file name
632 * With this model, only parallel tasks can be used. Resource sharing
633 * is done by identifying bottlenecks and giving an equal share of
634 * the model to each action.
637 XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(const char
640 /** \brief The list of all available workstation model models
641 * \ingroup SURF_models
643 XBT_PUBLIC_DATA(s_surf_model_description_t)
644 surf_workstation_model_description[];
646 /** \brief List of initialized models
647 * \ingroup SURF_models
649 XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
651 /*******************************************/
652 /*** SURF Globals **************************/
653 /*******************************************/
654 XBT_PUBLIC_DATA(xbt_cfg_t) _surf_cfg_set;
656 /** \brief Initialize SURF
657 * \ingroup SURF_simulation
658 * \param argc argument number
659 * \param argv arguments
661 * This function has to be called to initialize the common
662 * structures. Then you will have to create the environment by
664 * e.g. surf_workstation_model_init_CLM03() or
665 * surf_workstation_model_init_KCCFLN05().
667 * \see surf_workstation_model_init_CLM03(),
668 * surf_workstation_model_init_KCCFLN05(), surf_workstation_model_init_compound(), surf_exit()
670 XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */
672 /** \brief Initialize the used models.
674 * Must be called after the surf_init so that configuration infrastructure is created
675 * Must be called before parsing/creating the environment
676 * Must not be called within the initialization process so that the use get a chance to change the settings from
677 * its code between, say, MSG_init and MSG_create_environment using MSG_config
679 XBT_PUBLIC(void) surf_config_models_setup(const char *platform_file);
681 /** \brief create the elements of the models
683 * Must be called after parsing the platform file and before using any elements
685 XBT_PUBLIC(void) surf_config_models_create_elms(void);
687 /** \brief Finish simulation initialization
688 * \ingroup SURF_simulation
690 * This function must be called before the first call to surf_solve()
692 XBT_PUBLIC(void) surf_presolve(void);
694 /** \brief Performs a part of the simulation
695 * \ingroup SURF_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 /** \brief Return the current time
708 * \ingroup SURF_simulation
710 * Return the current time in millisecond.
712 XBT_INLINE XBT_PUBLIC(double) surf_get_clock(void);
715 * \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) */
725 XBT_PUBLIC_DATA(void) parse_properties(const char* prop_id, const char* prop_value);
726 XBT_PUBLIC_DATA(void) parse_properties_XML(void);
727 XBT_PUBLIC_DATA(void) parse_properties_lua(const char* prop_id, const char* prop_value);
729 /* surf parse file related (public because called from a test suite) */
730 XBT_PUBLIC(void) parse_platform_file(const char *file);
732 /* Stores the sets */
733 XBT_PUBLIC_DATA(xbt_dict_t) set_list;
735 /* For the trace and trace:connect tag (store their content till the end of the parsing) */
736 XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
737 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail;
738 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_power;
739 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
740 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
741 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
744 XBT_PUBLIC(double) get_cpu_power(const char *power);
746 /*public interface to create resource bypassing the parser via cpu/network model
748 * see surfxml_parse.c
750 XBT_PUBLIC(void) surf_host_create_resource(char *name, double power_peak,
752 tmgr_trace_t power_trace,
754 e_surf_resource_state_t
756 tmgr_trace_t state_trace,
757 xbt_dict_t cpu_properties);
759 /*public interface to create resource bypassing the parser via workstation_ptask_L07 model
761 * see surfxml_parse.c
763 XBT_PUBLIC(void) surf_wsL07_host_create_resource(char *name,
766 tmgr_trace_t power_trace,
767 e_surf_resource_state_t
769 tmgr_trace_t state_trace,
773 * create link resource
774 * see surfxml_parse.c
776 XBT_PUBLIC(void) surf_link_create_resource(char *name,
778 tmgr_trace_t bw_trace,
780 tmgr_trace_t lat_trace,
781 e_surf_resource_state_t
783 tmgr_trace_t state_trace,
784 e_surf_link_sharing_policy_t
785 policy, xbt_dict_t properties);
788 XBT_PUBLIC(void) surf_wsL07_link_create_resource(char *name,
790 tmgr_trace_t bw_trace,
792 tmgr_trace_t lat_trace,
793 e_surf_resource_state_t
795 tmgr_trace_t state_trace,
796 e_surf_link_sharing_policy_t
798 xbt_dict_t properties);
800 * add route element (link_ctn) bypassing the parser
802 * see surfxml_parse.c
805 XBT_PUBLIC(void) surf_add_route_element(char *link_ctn_id);
808 * set route src_id,dest_id, and create a route resource
810 * see surf_routing.c && surfxml_parse.c
813 XBT_PUBLIC(void) surf_set_routes(void);
818 * see surfxml_parse.c
820 XBT_PUBLIC(void) surf_add_host_traces(void);
821 XBT_PUBLIC(void) surf_add_link_traces(void);
822 XBT_PUBLIC(void) surf_wsL07_add_traces(void);
825 * init AS from lua console
828 XBT_PUBLIC(void) routing_AS_init(const char *id, const char *mode);
829 XBT_PUBLIC(void) routing_AS_end(const char *id);
830 // add host to network element list
831 XBT_PUBLIC(void) routing_add_host(const char *host_id);
832 //Set a new link on the actual list of link for a route or ASroute
833 XBT_PUBLIC(void) routing_add_link(const char *link_id);
834 //Set the endpoints for a route
835 XBT_PUBLIC(void) routing_set_route(const char *src_id, const char *dst_id);
837 XBT_PUBLIC(void) routing_store_route(void);
840 * interface between surf and lua bindings
841 * see surfxml_parse.c
843 XBT_PUBLIC(void) surf_AS_new(const char *id, const char *mode);
844 XBT_PUBLIC(void) surf_AS_finalize(const char *id);
845 XBT_PUBLIC(void) surf_route_add_host(const char *id);
846 XBT_PUBLIC(void) surf_routing_add_route(const char *src_id,
848 xbt_dynar_t links_id);
850 #include "surf/surf_resource.h"
851 #include "surf/surf_resource_lmm.h"
854 #endif /* _SURF_SURF_H */