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