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) (void);
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(void);
361 /** \brief Initializes the CPU model with trace integration
362 * \ingroup SURF_models
365 XBT_PUBLIC(void) surf_cpu_model_init_ti(void);
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(void);
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(void);
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(void);
424 /** \brief Initializes the platform with the network model 'LV08_im'
425 * \ingroup SURF_models
426 * \param filename XML platform file name
428 * This model is adds the lazy management improvement to Legrand and
429 * Velho model. This improvement essentially replaces the list of actions
430 * inside the simulation kernel by a heap in order to reduce the complexity
431 * at each iteration of the simulation kernel.
433 * \see surf_workstation_model_init_LegrandVelho()
435 XBT_PUBLIC(void) im_surf_network_model_init_LegrandVelho(void);
437 /** \brief Initializes the platform with the network model 'Constant'
438 * \ingroup SURF_models
439 * \param filename XML platform file name
441 * In this model, the communication time between two network cards is
442 * constant, hence no need for a routing table. This is particularly
443 * usefull when simulating huge distributed algorithms where
444 * scalability is really an issue. This function is called in
445 * conjunction with surf_workstation_model_init_compound.
447 * \see surf_workstation_model_init_compound()
449 XBT_PUBLIC(void) surf_network_model_init_Constant(void);
451 /** \brief Initializes the platform with the network model CM02
452 * \ingroup SURF_models
453 * \param filename XML platform file name
455 * This function is called by surf_workstation_model_init_CLM03
456 * or by yourself only if you plan using surf_workstation_model_init_compound
458 * \see surf_workstation_model_init_CLM03()
460 XBT_PUBLIC(void) surf_network_model_init_CM02(void);
463 * brief initialize the the network model bypassing the XML parser
465 XBT_PUBLIC(void) surf_network_model_init_bypass(const char *id,
470 /** \brief Initializes the platform with the network model GTNETS
471 * \ingroup SURF_models
472 * \param filename XML platform file name
474 * This function is called by surf_workstation_model_init_GTNETS
475 * or by yourself only if you plan using surf_workstation_model_init_compound
477 * \see surf_workstation_model_init_GTNETS()
479 XBT_PUBLIC(void) surf_network_model_init_GbTNETS(void);
483 /** \brief Initializes the platform with the network model NS3
484 * \ingroup SURF_models
485 * \param filename XML platform file name
487 * This function is called by surf_workstation_model_init_NS3
488 * or by yourself only if you plan using surf_workstation_model_init_compound
490 * \see surf_workstation_model_init_NS3()
492 XBT_PUBLIC(void) surf_network_model_init_NS3(void);
494 XBT_PUBLIC(void) parse_ns3_add_host(void);
495 XBT_PUBLIC(void) parse_ns3_add_router(void);
496 XBT_PUBLIC(void) parse_ns3_add_link(void);
497 XBT_PUBLIC(void) parse_ns3_add_AS(void);
498 XBT_PUBLIC(void) parse_ns3_add_route(void);
499 XBT_PUBLIC(void) parse_ns3_add_ASroute(void);
500 XBT_PUBLIC(void) parse_ns3_add_cluster(void);
501 XBT_PUBLIC(void) parse_ns3_end_platform(void);
502 XBT_PUBLIC(void) create_ns3_topology(void);
503 XBT_PUBLIC(double) ns3_get_link_latency(const void *link);
504 XBT_PUBLIC(double) ns3_get_link_bandwidth(const void *link);
508 /** \brief Initializes the platform with the network model Reno
509 * \ingroup SURF_models
510 * \param filename XML platform file name
512 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
515 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
516 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
518 * Call this function only if you plan using surf_workstation_model_init_compound.
521 XBT_PUBLIC(void) surf_network_model_init_Reno(void);
523 /** \brief Initializes the platform with the network model Reno2
524 * \ingroup SURF_models
525 * \param filename XML platform file name
527 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
530 * [LOW01] S. H. Low. A duality model of TCP and queue management algorithms.
531 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
533 * Call this function only if you plan using surf_workstation_model_init_compound.
536 XBT_PUBLIC(void) surf_network_model_init_Reno2(void);
538 /** \brief Initializes the platform with the network model Vegas
539 * \ingroup SURF_models
540 * \param filename XML platform file name
542 * This problem is related to max( sum( a * Df * ln(xi) ) ) which is equivalent
543 * to the proportional fairness.
546 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
547 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
549 * Call this function only if you plan using surf_workstation_model_init_compound.
552 XBT_PUBLIC(void) surf_network_model_init_Vegas(void);
554 /** \brief The list of all available network model models
555 * \ingroup SURF_models
557 XBT_PUBLIC_DATA(s_surf_model_description_t)
558 surf_network_model_description[];
561 /** \brief The workstation model
562 * \ingroup SURF_models
564 * Note that when you create an API on top of SURF,
565 * the workstation model should be the only one you use
566 * because depending on the platform model, the network model and the CPU model
569 XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model;
571 /** \brief Initializes the platform with a compound workstation model
572 * \ingroup SURF_models
573 * \param filename XML platform file name
575 * This function should be called after a cpu_model and a
576 * network_model have been set up.
579 XBT_PUBLIC(void) surf_workstation_model_init_compound(void);
581 /** \brief Initializes the platform with the workstation model CLM03
582 * \ingroup SURF_models
583 * \param filename XML platform file name
585 * This platform model seperates the workstation model and the network model.
586 * The workstation model will be initialized with the model CLM03, the network
587 * model with the model CM02 and the CPU model with the model Cas01.
588 * In future releases, some other network models will be implemented and will be
589 * combined with the workstation model CLM03.
591 * \see surf_workstation_model_init_KCCFLN05()
593 XBT_PUBLIC(void) surf_workstation_model_init_CLM03(void);
595 /** \brief Initializes the platform with the model KCCFLN05
596 * \ingroup SURF_models
597 * \param filename XML platform file name
599 * With this model, the workstations and the network are handled
600 * together. The network model is roughly the same as in CM02 but
601 * interference between computations and communications can be taken
602 * into account. This platform model is the default one for MSG and
606 XBT_PUBLIC(void) surf_workstation_model_init_KCCFLN05(void);
608 /** \brief Initializes the platform with the model KCCFLN05
609 * \ingroup SURF_models
610 * \param filename XML platform file name
612 * With this model, only parallel tasks can be used. Resource sharing
613 * is done by identifying bottlenecks and giving an equal share of
614 * the model to each action.
617 XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(void);
619 /** \brief The list of all available workstation model models
620 * \ingroup SURF_models
622 XBT_PUBLIC_DATA(s_surf_model_description_t)
623 surf_workstation_model_description[];
625 /** \brief List of initialized models
626 * \ingroup SURF_models
628 XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
630 /*******************************************/
631 /*** SURF Globals **************************/
632 /*******************************************/
633 XBT_PUBLIC_DATA(xbt_cfg_t) _surf_cfg_set;
635 /** \brief Initialize SURF
636 * \ingroup SURF_simulation
637 * \param argc argument number
638 * \param argv arguments
640 * This function has to be called to initialize the common
641 * structures. Then you will have to create the environment by
643 * e.g. surf_workstation_model_init_CLM03() or
644 * surf_workstation_model_init_KCCFLN05().
646 * \see surf_workstation_model_init_CLM03(),
647 * surf_workstation_model_init_KCCFLN05(), surf_workstation_model_init_compound(), surf_exit()
649 XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */
651 /** \brief Initialize the used models.
653 * Must be called after the surf_init so that configuration infrastructure is created
654 * Must be called before parsing/creating the environment
655 * Must not be called within the initialization process so that the use get a chance to change the settings from
656 * its code between, say, MSG_init and MSG_create_environment using MSG_config
658 XBT_PUBLIC(void) surf_config_models_setup(void);
660 /** \brief create the elements of the models
662 * Must be called after parsing the platform file and before using any elements
664 XBT_PUBLIC(void) surf_config_models_create_elms(void);
666 /** \brief Finish simulation initialization
667 * \ingroup SURF_simulation
669 * This function must be called before the first call to surf_solve()
671 XBT_PUBLIC(void) surf_presolve(void);
673 /** \brief Performs a part of the simulation
674 * \ingroup SURF_simulation
675 * \param max_date Maximum date to update the simulation to, or -1
676 * \return the elapsed time, or -1.0 if no event could be executed
678 * This function execute all possible events, update the action states
679 * and returns the time elapsed.
680 * When you call execute or communicate on a model, the corresponding actions
681 * are not executed immediately but only when you call surf_solve.
682 * Note that the returned elapsed time can be zero.
684 XBT_PUBLIC(double) surf_solve(double max_date);
686 /** \brief Return the current time
687 * \ingroup SURF_simulation
689 * Return the current time in millisecond.
691 XBT_INLINE XBT_PUBLIC(double) surf_get_clock(void);
694 * \ingroup SURF_simulation
700 XBT_PUBLIC(void) surf_exit(void);
702 /* Prototypes of the functions that handle the properties */
703 XBT_PUBLIC_DATA(xbt_dict_t) current_property_set; /* the prop set for the currently parsed element (also used in SIMIX) */
704 XBT_PUBLIC_DATA(void) parse_properties(const char* prop_id, const char* prop_value);
705 XBT_PUBLIC_DATA(void) parse_properties_XML(void);
707 /* surf parse file related (public because called from a test suite) */
708 XBT_PUBLIC(void) parse_platform_file(const char *file);
710 /* Stores the sets */
711 XBT_PUBLIC_DATA(xbt_dict_t) set_list;
713 /* For the trace and trace:connect tag (store their content till the end of the parsing) */
714 XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
715 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail;
716 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_power;
717 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
718 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
719 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
722 XBT_PUBLIC(double) get_cpu_power(const char *power);
724 /*public interface to create resource bypassing the parser via cpu/network model
726 * see surfxml_parse.c
728 XBT_PUBLIC(void*) surf_host_create_resource(char *name, double power_peak,
730 tmgr_trace_t power_trace,
732 e_surf_resource_state_t
734 tmgr_trace_t state_trace,
735 xbt_dict_t cpu_properties);
737 /*public interface to create resource bypassing the parser via workstation_ptask_L07 model
739 * see surfxml_parse.c
741 XBT_PUBLIC(void*) surf_wsL07_host_create_resource(char *name,
744 tmgr_trace_t power_trace,
745 e_surf_resource_state_t
747 tmgr_trace_t state_trace,
751 * create link resource
752 * see surfxml_parse.c
754 XBT_PUBLIC(void*) surf_link_create_resource(char *name,
756 tmgr_trace_t bw_trace,
758 tmgr_trace_t lat_trace,
759 e_surf_resource_state_t
761 tmgr_trace_t state_trace,
762 e_surf_link_sharing_policy_t
763 policy, xbt_dict_t properties);
766 XBT_PUBLIC(void*) surf_wsL07_link_create_resource(char *name,
768 tmgr_trace_t bw_trace,
770 tmgr_trace_t lat_trace,
771 e_surf_resource_state_t
773 tmgr_trace_t state_trace,
774 e_surf_link_sharing_policy_t
776 xbt_dict_t properties);
778 * add route element (link_ctn) bypassing the parser
780 * see surfxml_parse.c
783 XBT_PUBLIC(void) surf_add_route_element(char *link_ctn_id);
786 * set route src_id,dest_id, and create a route resource
788 * see surf_routing.c && surfxml_parse.c
791 XBT_PUBLIC(void) surf_set_routes(void);
796 * see surfxml_parse.c
798 XBT_PUBLIC(void) surf_add_host_traces(void);
799 XBT_PUBLIC(void) surf_add_link_traces(void);
800 XBT_PUBLIC(void) surf_wsL07_add_traces(void);
803 * init AS from lua console
806 XBT_PUBLIC(void) routing_AS_init(const char *id, const char *mode);
807 XBT_PUBLIC(void) routing_AS_end(const char *id);
808 // add host to network element list
809 XBT_PUBLIC(void) routing_add_host(const char *host_id);
810 //Set a new link on the actual list of link for a route or ASroute
811 XBT_PUBLIC(void) routing_add_link(const char *link_id);
812 //Set the endpoints for a route
813 XBT_PUBLIC(void) routing_set_route(const char *src_id, const char *dst_id);
815 XBT_PUBLIC(void) routing_store_route(void);
818 * interface between surf and lua bindings
819 * see surfxml_parse.c
821 XBT_PUBLIC(void) surf_AS_new(const char *id, const char *mode);
822 XBT_PUBLIC(void) surf_AS_finalize(const char *id);
823 XBT_PUBLIC(void) surf_route_add_host(const char *id);
824 XBT_PUBLIC(void) surf_routing_add_route(const char *src_id,
826 xbt_dynar_t links_id);
828 #include "surf/surf_resource.h"
829 #include "surf/surf_resource_lmm.h"
832 #endif /* _SURF_SURF_H */