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"
18 #include "surf/surf_routing.h"
21 /* Actions and models are highly connected structures... */
23 SURF_RESOURCE_ON = 1, /**< Up & ready */
24 SURF_RESOURCE_OFF = 0 /**< Down & broken */
25 } e_surf_resource_state_t;
28 SURF_LINK_FULLDUPLEX = 2,
31 } e_surf_link_sharing_policy_t;
34 SURF_NETWORK_ELEMENT_NULL = 0, /* NULL */
35 SURF_NETWORK_ELEMENT_HOST, /* host type */
36 SURF_NETWORK_ELEMENT_ROUTER, /* router type */
37 SURF_NETWORK_ELEMENT_AS, /* AS type */
38 } e_surf_network_element_type_t;
40 XBT_PUBLIC(e_surf_network_element_type_t) get_network_element_type(const char
43 /** @Brief Specify that we use that action */
44 XBT_PUBLIC(void) surf_action_ref(surf_action_t action);
45 /** @brief Creates a new action.
47 * @param size The size is the one of the subtype you want to create
48 * @param cost initial value
49 * @param model to which model we should attach this action
50 * @param failed whether we should start this action in failed mode
52 XBT_PUBLIC(void *) surf_action_new(size_t size, double cost,
53 surf_model_t model, int failed);
55 /** \brief Resource model description
57 typedef struct surf_model_description {
59 const char *description;
61 void (*model_init_preparse) (const char *filename);
62 void (*model_init_postparse) (void);
63 } s_surf_model_description_t, *surf_model_description_t;
65 XBT_PUBLIC(void) update_model_description(s_surf_model_description_t *
66 table, const char *name,
68 XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
70 XBT_PUBLIC(void) model_help(const char *category,
71 s_surf_model_description_t * table);
73 /** \brief Action structure
74 * \ingroup SURF_actions
76 * Never create s_surf_action_t by yourself ! The actions are created
77 * on the fly when you call execute or communicate on a model.
79 * \see e_surf_action_state_t
81 typedef struct surf_action {
82 s_xbt_swag_hookup_t state_hookup;
84 double cost; /**< cost */
85 double priority; /**< priority (1.0 by default) */
86 double max_duration; /**< max_duration (may fluctuate until
87 the task is completed) */
88 double remains; /**< How much of that cost remains to
89 * be done in the currently running task */
90 #ifdef HAVE_LATENCY_BOUND_TRACKING
91 int latency_limited; /**< Set to 1 if is limited by latency, 0 otherwise */
94 double start; /**< start time */
95 double finish; /**< finish time : this is modified during the run
96 * and fluctuates until the task is completed */
97 void *data; /**< for your convenience */
99 surf_model_t model_type;
101 char *category; /**< tracing category for categorized resource utilization monitoring */
105 typedef struct surf_action_lmm {
106 s_surf_action_t generic_action;
107 lmm_variable_t variable;
109 } s_surf_action_lmm_t, *surf_action_lmm_t;
111 /** \brief Action states
112 * \ingroup SURF_actions
116 * \see surf_action_t, surf_action_state_t
119 SURF_ACTION_READY = 0, /**< Ready */
120 SURF_ACTION_RUNNING, /**< Running */
121 SURF_ACTION_FAILED, /**< Task Failure */
122 SURF_ACTION_DONE, /**< Completed */
123 SURF_ACTION_TO_FREE, /**< Action to free in next cleanup */
124 SURF_ACTION_NOT_IN_THE_SYSTEM
125 /**< Not in the system anymore. Why did you ask ? */
126 } e_surf_action_state_t;
128 /** \brief Action state sets
129 * \ingroup SURF_actions
131 * This structure contains some sets of actions.
132 * It provides a fast access to the actions in each state.
134 * \see surf_action_t, e_surf_action_state_t
136 typedef struct surf_action_state {
137 xbt_swag_t ready_action_set;
138 /**< Actions in state SURF_ACTION_READY */
139 xbt_swag_t running_action_set;
140 /**< Actions in state SURF_ACTION_RUNNING */
141 xbt_swag_t failed_action_set;
142 /**< Actions in state SURF_ACTION_FAILED */
143 xbt_swag_t done_action_set;
144 /**< Actions in state SURF_ACTION_DONE */
145 } s_surf_action_state_t, *surf_action_state_t;
147 /***************************/
148 /* Generic model object */
149 /***************************/
150 typedef struct s_routing_global s_routing_global_t, *routing_global_t;
151 XBT_PUBLIC_DATA(routing_global_t) global_routing;
154 /** \brief Private data available on all models
155 * \ingroup SURF_models
157 typedef struct surf_model_private *surf_model_private_t;
161 /** \brief CPU model extension public
162 * \ingroup SURF_models
164 * Public functions specific to the CPU model.
166 typedef struct surf_cpu_model_extension_public {
167 surf_action_t(*execute) (void *cpu, double size);
168 surf_action_t(*sleep) (void *cpu, double duration);
169 e_surf_resource_state_t(*get_state) (void *cpu);
170 double (*get_speed) (void *cpu, double load);
171 double (*get_available_speed) (void *cpu);
172 void (*create_resource) (char *name, double power_peak,
174 tmgr_trace_t power_trace,
176 e_surf_resource_state_t state_initial,
177 tmgr_trace_t state_trace,
178 xbt_dict_t cpu_properties);
179 void (*add_traces) (void);
180 } s_surf_model_extension_cpu_t;
184 /** \brief Network model extension public
185 * \ingroup SURF_models
187 * Public functions specific to the network model
189 typedef struct surf_network_model_extension_public {
190 surf_action_t(*communicate) (const char *src_name,
191 const char *dst_name,
192 double size, double rate);
193 xbt_dynar_t(*get_route) (const char *src_name, const char *dst_name);
194 double (*get_link_bandwidth) (const void *link);
195 double (*get_link_latency) (const void *link);
196 int (*link_shared) (const void *link);
197 void (*add_traces) (void);
198 void (*create_resource) (char *name,
200 tmgr_trace_t bw_trace,
202 tmgr_trace_t lat_trace,
203 e_surf_resource_state_t
205 tmgr_trace_t state_trace,
206 e_surf_link_sharing_policy_t policy,
207 xbt_dict_t properties);
208 } s_surf_model_extension_network_t;
210 /** \brief Workstation model extension public
211 * \ingroup SURF_models
213 * Public functions specific to the workstation model.
215 typedef struct surf_workstation_model_extension_public {
216 surf_action_t(*execute) (void *workstation, double size); /**< Execute a computation amount on a workstation
217 and create the corresponding action */
218 surf_action_t(*sleep) (void *workstation, double duration); /**< Make a workstation sleep during a given duration */
219 e_surf_resource_state_t(*get_state) (void *workstation); /**< Return the CPU state of a workstation */
220 double (*get_speed) (void *workstation, double load); /**< Return the speed of a workstation */
221 double (*get_available_speed) (void *workstation); /**< Return tha available speed of a workstation */
222 surf_action_t(*communicate) (void *workstation_src, /**< Execute a communication amount between two workstations */
223 void *workstation_dst, double size,
225 xbt_dynar_t(*get_route) (void *workstation_src, void *workstation_dst); /**< Get the list of links between two ws */
227 surf_action_t(*execute_parallel_task) (int workstation_nb, /**< Execute a parallel task on several workstations */
228 void **workstation_list,
229 double *computation_amount,
230 double *communication_amount,
231 double amount, double rate);
232 double (*get_link_bandwidth) (const void *link); /**< Return the current bandwidth of a network link */
233 double (*get_link_latency) (const void *link); /**< Return the current latency of a network link */
234 int (*link_shared) (const void *link);
235 xbt_dict_t(*get_properties) (const void *resource);
236 void (*link_create_resource) (char *name,
238 tmgr_trace_t bw_trace,
240 tmgr_trace_t lat_trace,
241 e_surf_resource_state_t
243 tmgr_trace_t state_trace,
244 e_surf_link_sharing_policy_t
245 policy, xbt_dict_t properties);
246 void (*cpu_create_resource) (char *name, double power_peak,
248 tmgr_trace_t power_trace,
249 e_surf_resource_state_t state_initial,
250 tmgr_trace_t state_trace,
251 xbt_dict_t cpu_properties);
252 void (*add_traces) (void);
254 } s_surf_model_extension_workstation_t;
259 /** \brief Model datatype
260 * \ingroup SURF_models
262 * Generic data structure for a model. The workstations,
263 * the CPUs and the network links are examples of models.
265 typedef struct surf_model {
266 const char *name; /**< Name of this model */
267 s_surf_action_state_t states; /**< Any living action on this model */
269 e_surf_action_state_t(*action_state_get) (surf_action_t action);
270 /**< Return the state of an action */
271 void (*action_state_set) (surf_action_t action,
272 e_surf_action_state_t state);
273 /**< Change an action state*/
275 double (*action_get_start_time) (surf_action_t action); /**< Return the start time of an action */
276 double (*action_get_finish_time) (surf_action_t action); /**< Return the finish time of an action */
277 int (*action_unref) (surf_action_t action); /**< Specify that we don't use that action anymore */
278 void (*action_cancel) (surf_action_t action); /**< Cancel a running action */
279 void (*action_recycle) (surf_action_t action); /**< Recycle an action */
280 void (*action_data_set) (surf_action_t action, void *data); /**< Set the user data of an action */
281 void (*suspend) (surf_action_t action); /**< Suspend an action */
282 void (*resume) (surf_action_t action); /**< Resume a suspended action */
283 int (*is_suspended) (surf_action_t action); /**< Return whether an action is suspended */
284 void (*set_max_duration) (surf_action_t action, double duration); /**< Set the max duration of an action*/
285 void (*set_priority) (surf_action_t action, double priority); /**< Set the priority of an action */
287 void (*set_category) (surf_action_t action, const char *category); /**< Set the category of an action */
289 double (*get_remains) (surf_action_t action); /**< Get the remains of an action */
290 #ifdef HAVE_LATENCY_BOUND_TRACKING
291 int (*get_latency_limited) (surf_action_t action); /**< Return 1 if action is limited by latency, 0 otherwise */
294 surf_model_private_t model_private;
297 s_surf_model_extension_cpu_t cpu;
298 s_surf_model_extension_network_t network;
299 s_surf_model_extension_workstation_t workstation;
303 surf_model_t surf_model_init(void);
304 void surf_model_exit(surf_model_t model);
306 static inline void *surf_cpu_resource_by_name(const char *name) {
307 return xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL);
309 static inline void *surf_workstation_resource_by_name(const char *name){
310 return xbt_lib_get_or_null(host_lib, name, SURF_WKS_LEVEL);
312 static inline void *surf_network_resource_by_name(const char *name){
313 return xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL);
316 typedef struct surf_resource {
319 xbt_dict_t properties;
320 } s_surf_resource_t, *surf_resource_t;
325 * Resource which have a metric handled by a maxmin system
330 tmgr_trace_event_t event;
333 typedef struct surf_resource_lmm {
334 s_surf_resource_t generic_resource;
335 lmm_constraint_t constraint;
336 e_surf_resource_state_t state_current;
337 tmgr_trace_event_t state_event;
338 s_surf_metric_t power;
339 } s_surf_resource_lmm_t, *surf_resource_lmm_t;
341 /**************************************/
342 /* Implementations of model object */
343 /**************************************/
346 /** \brief The CPU model
347 * \ingroup SURF_models
349 XBT_PUBLIC_DATA(surf_model_t) surf_cpu_model;
351 /** \brief Initializes the CPU model with the model Cas01
352 * \ingroup SURF_models
354 * This function is called by surf_workstation_model_init_CLM03
355 * so you shouldn't have to call it by yourself.
357 * \see surf_workstation_model_init_CLM03()
359 XBT_PUBLIC(void) surf_cpu_model_init_Cas01(const char *filename);
361 /** \brief Initializes the CPU model with trace integration
362 * \ingroup SURF_models
365 XBT_PUBLIC(void) surf_cpu_model_init_ti(const char *filename);
367 /** \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.
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_im(const char *filename);
377 /** \brief The list of all available cpu model models
378 * \ingroup SURF_models
380 XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[];
382 XBT_PUBLIC(void) create_workstations(void);
384 /**\brief create new host bypass the parser
389 /** \brief The network model
390 * \ingroup SURF_models
392 * When creating a new API on top on SURF, you shouldn't use the
393 * network model unless you know what you are doing. Only the workstation
394 * model should be accessed because depending on the platform model,
395 * the network model can be NULL.
397 XBT_PUBLIC_DATA(surf_model_t) surf_network_model;
399 /** \brief Same as network model 'LagrangeVelho', only with different correction factors.
400 * \ingroup SURF_models
401 * \param filename XML platform file name
403 * This model is proposed by Pierre-Nicolas Clauss and Martin Quinson and Stéphane Génaud
404 * based on the model 'LV08' and different correction factors depending on the communication
405 * size (< 1KiB, < 64KiB, >= 64KiB).
407 * \see surf_workstation_model_init_SMPI()
409 XBT_PUBLIC(void) surf_network_model_init_SMPI(const char *filename);
411 /** \brief Initializes the platform with the network model 'LagrangeVelho'
412 * \ingroup SURF_models
413 * \param filename XML platform file name
415 * This model is proposed by Arnaud Legrand and Pedro Velho based on
416 * the results obtained with the GTNets simulator for onelink and
417 * dogbone sharing scenarios.
419 * \see surf_workstation_model_init_LegrandVelho()
421 XBT_PUBLIC(void) surf_network_model_init_LegrandVelho(const char
425 /** \brief Initializes the platform with the network model 'LV08_im'
426 * \ingroup SURF_models
427 * \param filename XML platform file name
429 * This model is adds the lazy management improvement to Legrand and
430 * Velho model. This improvement essentially replaces the list of actions
431 * inside the simulation kernel by a heap in order to reduce the complexity
432 * at each iteration of the simulation kernel.
434 * \see surf_workstation_model_init_LegrandVelho()
436 XBT_PUBLIC(void) im_surf_network_model_init_LegrandVelho(const char
439 /** \brief Initializes the platform with the network model 'Constant'
440 * \ingroup SURF_models
441 * \param filename XML platform file name
443 * In this model, the communication time between two network cards is
444 * constant, hence no need for a routing table. This is particularly
445 * usefull when simulating huge distributed algorithms where
446 * scalability is really an issue. This function is called in
447 * conjunction with surf_workstation_model_init_compound.
449 * \see surf_workstation_model_init_compound()
451 XBT_PUBLIC(void) surf_network_model_init_Constant(const char *filename);
453 /** \brief Initializes the platform with the network model CM02
454 * \ingroup SURF_models
455 * \param filename XML platform file name
457 * This function is called by surf_workstation_model_init_CLM03
458 * or by yourself only if you plan using surf_workstation_model_init_compound
460 * \see surf_workstation_model_init_CLM03()
462 XBT_PUBLIC(void) surf_network_model_init_CM02(const char *filename);
465 * brief initialize the the network model bypassing the XML parser
467 XBT_PUBLIC(void) surf_network_model_init_bypass(const char *id,
472 /** \brief Initializes the platform with the network model GTNETS
473 * \ingroup SURF_models
474 * \param filename XML platform file name
476 * This function is called by surf_workstation_model_init_GTNETS
477 * or by yourself only if you plan using surf_workstation_model_init_compound
479 * \see surf_workstation_model_init_GTNETS()
481 XBT_PUBLIC(void) surf_network_model_init_GTNETS(const char *filename);
485 /** \brief Initializes the platform with the network model NS3
486 * \ingroup SURF_models
487 * \param filename XML platform file name
489 * This function is called by surf_workstation_model_init_NS3
490 * or by yourself only if you plan using surf_workstation_model_init_compound
492 * \see surf_workstation_model_init_NS3()
494 XBT_PUBLIC(void) surf_network_model_init_NS3(const char *filename);
496 XBT_PUBLIC(void) parse_ns3_add_host(void);
497 XBT_PUBLIC(void) parse_ns3_add_router(void);
498 XBT_PUBLIC(void) parse_ns3_add_link(void);
499 XBT_PUBLIC(void) parse_ns3_add_AS(void);
500 XBT_PUBLIC(void) parse_ns3_add_route(void);
501 XBT_PUBLIC(void) parse_ns3_add_ASroute(void);
502 XBT_PUBLIC(void) parse_ns3_add_cluster(void);
503 XBT_PUBLIC(void) parse_ns3_end_platform(void);
504 XBT_PUBLIC(void) create_ns3_topology(void);
505 XBT_PUBLIC(double) ns3_get_link_latency(const void *link);
506 XBT_PUBLIC(double) ns3_get_link_bandwidth(const void *link);
510 /** \brief Initializes the platform with the network model Reno
511 * \ingroup SURF_models
512 * \param filename XML platform file name
514 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
517 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
518 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
520 * Call this function only if you plan using surf_workstation_model_init_compound.
523 XBT_PUBLIC(void) surf_network_model_init_Reno(const char *filename);
525 /** \brief Initializes the platform with the network model Reno2
526 * \ingroup SURF_models
527 * \param filename XML platform file name
529 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
532 * [LOW01] S. H. Low. A duality model of TCP and queue management algorithms.
533 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
535 * Call this function only if you plan using surf_workstation_model_init_compound.
538 XBT_PUBLIC(void) surf_network_model_init_Reno2(const char *filename);
540 /** \brief Initializes the platform with the network model Vegas
541 * \ingroup SURF_models
542 * \param filename XML platform file name
544 * This problem is related to max( sum( a * Df * ln(xi) ) ) which is equivalent
545 * to the proportional fairness.
548 * [LOW03] 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_Vegas(const char *filename);
556 /** \brief The list of all available network model models
557 * \ingroup SURF_models
559 XBT_PUBLIC_DATA(s_surf_model_description_t)
560 surf_network_model_description[];
563 /** \brief The workstation model
564 * \ingroup SURF_models
566 * Note that when you create an API on top of SURF,
567 * the workstation model should be the only one you use
568 * because depending on the platform model, the network model and the CPU model
571 XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model;
573 /** \brief Initializes the platform with a compound workstation model
574 * \ingroup SURF_models
575 * \param filename XML platform file name
577 * This function should be called after a cpu_model and a
578 * network_model have been set up.
581 XBT_PUBLIC(void) surf_workstation_model_init_compound(const char
584 /** \brief Initializes the platform with the workstation model CLM03
585 * \ingroup SURF_models
586 * \param filename XML platform file name
588 * This platform model seperates the workstation model and the network model.
589 * The workstation model will be initialized with the model CLM03, the network
590 * model with the model CM02 and the CPU model with the model Cas01.
591 * In future releases, some other network models will be implemented and will be
592 * combined with the workstation model CLM03.
594 * \see surf_workstation_model_init_KCCFLN05()
596 XBT_PUBLIC(void) surf_workstation_model_init_CLM03(const char *filename);
598 /** \brief Initializes the platform with the model KCCFLN05
599 * \ingroup SURF_models
600 * \param filename XML platform file name
602 * With this model, the workstations and the network are handled
603 * together. The network model is roughly the same as in CM02 but
604 * interference between computations and communications can be taken
605 * into account. This platform model is the default one for MSG and
609 XBT_PUBLIC(void) surf_workstation_model_init_KCCFLN05(const char
612 /** \brief Initializes the platform with the model KCCFLN05
613 * \ingroup SURF_models
614 * \param filename XML platform file name
616 * With this model, only parallel tasks can be used. Resource sharing
617 * is done by identifying bottlenecks and giving an equal share of
618 * the model to each action.
621 XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(const char
624 /** \brief The list of all available workstation model models
625 * \ingroup SURF_models
627 XBT_PUBLIC_DATA(s_surf_model_description_t)
628 surf_workstation_model_description[];
630 /** \brief List of initialized models
631 * \ingroup SURF_models
633 XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
635 /*******************************************/
636 /*** SURF Globals **************************/
637 /*******************************************/
638 XBT_PUBLIC_DATA(xbt_cfg_t) _surf_cfg_set;
640 /** \brief Initialize SURF
641 * \ingroup SURF_simulation
642 * \param argc argument number
643 * \param argv arguments
645 * This function has to be called to initialize the common
646 * structures. Then you will have to create the environment by
648 * e.g. surf_workstation_model_init_CLM03() or
649 * surf_workstation_model_init_KCCFLN05().
651 * \see surf_workstation_model_init_CLM03(),
652 * surf_workstation_model_init_KCCFLN05(), surf_workstation_model_init_compound(), surf_exit()
654 XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */
656 /** \brief Initialize the used models.
658 * Must be called after the surf_init so that configuration infrastructure is created
659 * Must be called before parsing/creating the environment
660 * Must not be called within the initialization process so that the use get a chance to change the settings from
661 * its code between, say, MSG_init and MSG_create_environment using MSG_config
663 XBT_PUBLIC(void) surf_config_models_setup(const char *platform_file);
665 /** \brief create the elements of the models
667 * Must be called after parsing the platform file and before using any elements
669 XBT_PUBLIC(void) surf_config_models_create_elms(void);
671 /** \brief Finish simulation initialization
672 * \ingroup SURF_simulation
674 * This function must be called before the first call to surf_solve()
676 XBT_PUBLIC(void) surf_presolve(void);
678 /** \brief Performs a part of the simulation
679 * \ingroup SURF_simulation
680 * \param max_date Maximum date to update the simulation to, or -1
681 * \return the elapsed time, or -1.0 if no event could be executed
683 * This function execute all possible events, update the action states
684 * and returns the time elapsed.
685 * When you call execute or communicate on a model, the corresponding actions
686 * are not executed immediately but only when you call surf_solve.
687 * Note that the returned elapsed time can be zero.
689 XBT_PUBLIC(double) surf_solve(double max_date);
691 /** \brief Return the current time
692 * \ingroup SURF_simulation
694 * Return the current time in millisecond.
696 XBT_INLINE XBT_PUBLIC(double) surf_get_clock(void);
699 * \ingroup SURF_simulation
705 XBT_PUBLIC(void) surf_exit(void);
707 /* Prototypes of the functions that handle the properties */
708 XBT_PUBLIC_DATA(xbt_dict_t) current_property_set; /* the prop set for the currently parsed element (also used in SIMIX) */
709 XBT_PUBLIC_DATA(void) parse_properties(const char* prop_id, const char* prop_value);
710 XBT_PUBLIC_DATA(void) parse_properties_XML(void);
711 XBT_PUBLIC_DATA(void) parse_properties_lua(const char* prop_id, const char* prop_value);
713 /* surf parse file related (public because called from a test suite) */
714 XBT_PUBLIC(void) parse_platform_file(const char *file);
716 /* Stores the sets */
717 XBT_PUBLIC_DATA(xbt_dict_t) set_list;
719 /* For the trace and trace:connect tag (store their content till the end of the parsing) */
720 XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
721 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail;
722 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_power;
723 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
724 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
725 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
728 XBT_PUBLIC(double) get_cpu_power(const char *power);
730 /*public interface to create resource bypassing the parser via cpu/network model
732 * see surfxml_parse.c
734 XBT_PUBLIC(void) surf_host_create_resource(char *name, double power_peak,
736 tmgr_trace_t power_trace,
738 e_surf_resource_state_t
740 tmgr_trace_t state_trace,
741 xbt_dict_t cpu_properties);
743 /*public interface to create resource bypassing the parser via workstation_ptask_L07 model
745 * see surfxml_parse.c
747 XBT_PUBLIC(void) surf_wsL07_host_create_resource(char *name,
750 tmgr_trace_t power_trace,
751 e_surf_resource_state_t
753 tmgr_trace_t state_trace,
757 * create link resource
758 * see surfxml_parse.c
760 XBT_PUBLIC(void) surf_link_create_resource(char *name,
762 tmgr_trace_t bw_trace,
764 tmgr_trace_t lat_trace,
765 e_surf_resource_state_t
767 tmgr_trace_t state_trace,
768 e_surf_link_sharing_policy_t
769 policy, xbt_dict_t properties);
772 XBT_PUBLIC(void) surf_wsL07_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
782 xbt_dict_t properties);
784 * add route element (link_ctn) bypassing the parser
786 * see surfxml_parse.c
789 XBT_PUBLIC(void) surf_add_route_element(char *link_ctn_id);
792 * set route src_id,dest_id, and create a route resource
794 * see surf_routing.c && surfxml_parse.c
797 XBT_PUBLIC(void) surf_set_routes(void);
802 * see surfxml_parse.c
804 XBT_PUBLIC(void) surf_add_host_traces(void);
805 XBT_PUBLIC(void) surf_add_link_traces(void);
806 XBT_PUBLIC(void) surf_wsL07_add_traces(void);
809 * init AS from lua console
812 XBT_PUBLIC(void) routing_AS_init(const char *id, const char *mode);
813 XBT_PUBLIC(void) routing_AS_end(const char *id);
814 // add host to network element list
815 XBT_PUBLIC(void) routing_add_host(const char *host_id);
816 //Set a new link on the actual list of link for a route or ASroute
817 XBT_PUBLIC(void) routing_add_link(const char *link_id);
818 //Set the endpoints for a route
819 XBT_PUBLIC(void) routing_set_route(const char *src_id, const char *dst_id);
821 XBT_PUBLIC(void) routing_store_route(void);
824 * interface between surf and lua bindings
825 * see surfxml_parse.c
827 XBT_PUBLIC(void) surf_AS_new(const char *id, const char *mode);
828 XBT_PUBLIC(void) surf_AS_finalize(const char *id);
829 XBT_PUBLIC(void) surf_route_add_host(const char *id);
830 XBT_PUBLIC(void) surf_routing_add_route(const char *src_id,
832 xbt_dynar_t links_id);
834 #include "surf/surf_resource.h"
835 #include "surf/surf_resource_lmm.h"
838 #endif /* _SURF_SURF_H */