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);
507 /** \brief Initializes the platform with the network model Reno
508 * \ingroup SURF_models
509 * \param filename XML platform file name
511 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
514 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
515 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
517 * Call this function only if you plan using surf_workstation_model_init_compound.
520 XBT_PUBLIC(void) surf_network_model_init_Reno(const char *filename);
522 /** \brief Initializes the platform with the network model Reno2
523 * \ingroup SURF_models
524 * \param filename XML platform file name
526 * The problem is related to max( sum( arctan(C * Df * xi) ) ).
529 * [LOW01] 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_Reno2(const char *filename);
537 /** \brief Initializes the platform with the network model Vegas
538 * \ingroup SURF_models
539 * \param filename XML platform file name
541 * This problem is related to max( sum( a * Df * ln(xi) ) ) which is equivalent
542 * to the proportional fairness.
545 * [LOW03] S. H. Low. A duality model of TCP and queue management algorithms.
546 * IEEE/ACM Transaction on Networking, 11(4):525-536, 2003.
548 * Call this function only if you plan using surf_workstation_model_init_compound.
551 XBT_PUBLIC(void) surf_network_model_init_Vegas(const char *filename);
553 /** \brief The list of all available network model models
554 * \ingroup SURF_models
556 XBT_PUBLIC_DATA(s_surf_model_description_t)
557 surf_network_model_description[];
560 /** \brief The workstation model
561 * \ingroup SURF_models
563 * Note that when you create an API on top of SURF,
564 * the workstation model should be the only one you use
565 * because depending on the platform model, the network model and the CPU model
568 XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model;
570 /** \brief Initializes the platform with a compound workstation model
571 * \ingroup SURF_models
572 * \param filename XML platform file name
574 * This function should be called after a cpu_model and a
575 * network_model have been set up.
578 XBT_PUBLIC(void) surf_workstation_model_init_compound(const char
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(const char *filename);
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(const char
609 /** \brief Initializes the platform with the model KCCFLN05
610 * \ingroup SURF_models
611 * \param filename XML platform file name
613 * With this model, only parallel tasks can be used. Resource sharing
614 * is done by identifying bottlenecks and giving an equal share of
615 * the model to each action.
618 XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(const char
621 /** \brief The list of all available workstation model models
622 * \ingroup SURF_models
624 XBT_PUBLIC_DATA(s_surf_model_description_t)
625 surf_workstation_model_description[];
627 /** \brief List of initialized models
628 * \ingroup SURF_models
630 XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
632 /*******************************************/
633 /*** SURF Globals **************************/
634 /*******************************************/
635 XBT_PUBLIC_DATA(xbt_cfg_t) _surf_cfg_set;
637 /** \brief Initialize SURF
638 * \ingroup SURF_simulation
639 * \param argc argument number
640 * \param argv arguments
642 * This function has to be called to initialize the common
643 * structures. Then you will have to create the environment by
645 * e.g. surf_workstation_model_init_CLM03() or
646 * surf_workstation_model_init_KCCFLN05().
648 * \see surf_workstation_model_init_CLM03(),
649 * surf_workstation_model_init_KCCFLN05(), surf_workstation_model_init_compound(), surf_exit()
651 XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */
653 /** \brief Initialize the used models.
655 * Must be called after the surf_init so that configuration infrastructure is created
656 * Must be called before parsing/creating the environment
657 * Must not be called within the initialization process so that the use get a chance to change the settings from
658 * its code between, say, MSG_init and MSG_create_environment using MSG_config
660 XBT_PUBLIC(void) surf_config_models_setup(const char *platform_file);
662 /** \brief create the elements of the models
664 * Must be called after parsing the platform file and before using any elements
666 XBT_PUBLIC(void) surf_config_models_create_elms(void);
668 /** \brief Finish simulation initialization
669 * \ingroup SURF_simulation
671 * This function must be called before the first call to surf_solve()
673 XBT_PUBLIC(void) surf_presolve(void);
675 /** \brief Performs a part of the simulation
676 * \ingroup SURF_simulation
677 * \param max_date Maximum date to update the simulation to, or -1
678 * \return the elapsed time, or -1.0 if no event could be executed
680 * This function execute all possible events, update the action states
681 * and returns the time elapsed.
682 * When you call execute or communicate on a model, the corresponding actions
683 * are not executed immediately but only when you call surf_solve.
684 * Note that the returned elapsed time can be zero.
686 XBT_PUBLIC(double) surf_solve(double max_date);
688 /** \brief Return the current time
689 * \ingroup SURF_simulation
691 * Return the current time in millisecond.
693 XBT_INLINE XBT_PUBLIC(double) surf_get_clock(void);
696 * \ingroup SURF_simulation
702 XBT_PUBLIC(void) surf_exit(void);
704 /* Prototypes of the functions that handle the properties */
705 XBT_PUBLIC_DATA(xbt_dict_t) current_property_set; /* the prop set for the currently parsed element (also used in SIMIX) */
706 XBT_PUBLIC_DATA(void) parse_properties(const char* prop_id, const char* prop_value);
707 XBT_PUBLIC_DATA(void) parse_properties_XML(void);
708 XBT_PUBLIC_DATA(void) parse_properties_lua(const char* prop_id, const char* prop_value);
710 /* surf parse file related (public because called from a test suite) */
711 XBT_PUBLIC(void) parse_platform_file(const char *file);
713 /* Stores the sets */
714 XBT_PUBLIC_DATA(xbt_dict_t) set_list;
716 /* For the trace and trace:connect tag (store their content till the end of the parsing) */
717 XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
718 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail;
719 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_power;
720 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail;
721 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
722 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
725 XBT_PUBLIC(double) get_cpu_power(const char *power);
727 /*public interface to create resource bypassing the parser via cpu/network model
729 * see surfxml_parse.c
731 XBT_PUBLIC(void) surf_host_create_resource(char *name, double power_peak,
733 tmgr_trace_t power_trace,
735 e_surf_resource_state_t
737 tmgr_trace_t state_trace,
738 xbt_dict_t cpu_properties);
740 /*public interface to create resource bypassing the parser via workstation_ptask_L07 model
742 * see surfxml_parse.c
744 XBT_PUBLIC(void) surf_wsL07_host_create_resource(char *name,
747 tmgr_trace_t power_trace,
748 e_surf_resource_state_t
750 tmgr_trace_t state_trace,
754 * create link resource
755 * see surfxml_parse.c
757 XBT_PUBLIC(void) surf_link_create_resource(char *name,
759 tmgr_trace_t bw_trace,
761 tmgr_trace_t lat_trace,
762 e_surf_resource_state_t
764 tmgr_trace_t state_trace,
765 e_surf_link_sharing_policy_t
766 policy, xbt_dict_t properties);
769 XBT_PUBLIC(void) surf_wsL07_link_create_resource(char *name,
771 tmgr_trace_t bw_trace,
773 tmgr_trace_t lat_trace,
774 e_surf_resource_state_t
776 tmgr_trace_t state_trace,
777 e_surf_link_sharing_policy_t
779 xbt_dict_t properties);
781 * add route element (link_ctn) bypassing the parser
783 * see surfxml_parse.c
786 XBT_PUBLIC(void) surf_add_route_element(char *link_ctn_id);
789 * set route src_id,dest_id, and create a route resource
791 * see surf_routing.c && surfxml_parse.c
794 XBT_PUBLIC(void) surf_set_routes(void);
799 * see surfxml_parse.c
801 XBT_PUBLIC(void) surf_add_host_traces(void);
802 XBT_PUBLIC(void) surf_add_link_traces(void);
803 XBT_PUBLIC(void) surf_wsL07_add_traces(void);
806 * init AS from lua console
809 XBT_PUBLIC(void) routing_AS_init(const char *id, const char *mode);
810 XBT_PUBLIC(void) routing_AS_end(const char *id);
811 // add host to network element list
812 XBT_PUBLIC(void) routing_add_host(const char *host_id);
813 //Set a new link on the actual list of link for a route or ASroute
814 XBT_PUBLIC(void) routing_add_link(const char *link_id);
815 //Set the endpoints for a route
816 XBT_PUBLIC(void) routing_set_route(const char *src_id, const char *dst_id);
818 XBT_PUBLIC(void) routing_store_route(void);
821 * interface between surf and lua bindings
822 * see surfxml_parse.c
824 XBT_PUBLIC(void) surf_AS_new(const char *id, const char *mode);
825 XBT_PUBLIC(void) surf_AS_finalize(const char *id);
826 XBT_PUBLIC(void) surf_route_add_host(const char *id);
827 XBT_PUBLIC(void) surf_routing_add_route(const char *src_id,
829 xbt_dynar_t links_id);
831 #include "surf/surf_resource.h"
832 #include "surf/surf_resource_lmm.h"
835 #endif /* _SURF_SURF_H */