1 /* Copyright (c) 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 "surf/surfxml_parse_private.h"
12 #include "surf/surf_private.h"
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf,
15 "Logging specific to the SURF parsing module");
17 #include "simgrid_dtd.c"
19 /* Initialize the parsing globals */
21 xbt_dict_t traces_set_list = NULL;
22 //xbt_dynar_t traces_connect_list = NULL;
23 xbt_dict_t trace_connect_list_host_avail = NULL;
24 xbt_dict_t trace_connect_list_power = NULL;
25 xbt_dict_t trace_connect_list_link_avail = NULL;
26 xbt_dict_t trace_connect_list_bandwidth = NULL;
27 xbt_dict_t trace_connect_list_latency = NULL;
29 /* This buffer is used to store the original buffer before substituing it by out own buffer. Usefull for the foreach tag */
30 static xbt_dynar_t surfxml_bufferstack_stack = NULL;
31 int surfxml_bufferstack_size = 2048;
32 static char *old_buff = NULL;
33 static void surf_parse_error(char *msg);
35 void surfxml_bufferstack_push(int new)
38 old_buff = surfxml_bufferstack;
40 xbt_dynar_push(surfxml_bufferstack_stack, &surfxml_bufferstack);
41 surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
45 void surfxml_bufferstack_pop(int new)
48 surfxml_bufferstack = old_buff;
50 free(surfxml_bufferstack);
51 xbt_dynar_pop(surfxml_bufferstack_stack, &surfxml_bufferstack);
55 /* Stores the set name reffered to by the foreach tag */
56 static char *foreach_set_name;
57 static xbt_dynar_t main_STag_surfxml_host_cb_list = NULL;
58 static xbt_dynar_t main_STag_surfxml_link_cb_list = NULL;
60 /* make sure these symbols are defined as strong ones in this file so that the linked can resolve them */
61 xbt_dynar_t STag_surfxml_platform_cb_list = NULL;
62 xbt_dynar_t ETag_surfxml_platform_cb_list = NULL;
63 xbt_dynar_t STag_surfxml_host_cb_list = NULL;
64 xbt_dynar_t ETag_surfxml_host_cb_list = NULL;
65 xbt_dynar_t STag_surfxml_router_cb_list = NULL;
66 xbt_dynar_t ETag_surfxml_router_cb_list = NULL;
67 xbt_dynar_t STag_surfxml_link_cb_list = NULL;
68 xbt_dynar_t ETag_surfxml_link_cb_list = NULL;
69 xbt_dynar_t STag_surfxml_route_cb_list = NULL;
70 xbt_dynar_t ETag_surfxml_route_cb_list = NULL;
71 xbt_dynar_t STag_surfxml_link_c_ctn_cb_list = NULL;
72 xbt_dynar_t ETag_surfxml_link_c_ctn_cb_list = NULL;
73 xbt_dynar_t STag_surfxml_process_cb_list = NULL;
74 xbt_dynar_t ETag_surfxml_process_cb_list = NULL;
75 xbt_dynar_t STag_surfxml_argument_cb_list = NULL;
76 xbt_dynar_t ETag_surfxml_argument_cb_list = NULL;
77 xbt_dynar_t STag_surfxml_prop_cb_list = NULL;
78 xbt_dynar_t ETag_surfxml_prop_cb_list = NULL;
79 xbt_dynar_t STag_surfxml_set_cb_list = NULL;
80 xbt_dynar_t ETag_surfxml_set_cb_list = NULL;
81 xbt_dynar_t STag_surfxml_foreach_cb_list = NULL;
82 xbt_dynar_t ETag_surfxml_foreach_cb_list = NULL;
83 xbt_dynar_t STag_surfxml_route_c_multi_cb_list = NULL;
84 xbt_dynar_t ETag_surfxml_route_c_multi_cb_list = NULL;
85 xbt_dynar_t STag_surfxml_cluster_cb_list = NULL;
86 xbt_dynar_t ETag_surfxml_cluster_cb_list = NULL;
87 xbt_dynar_t STag_surfxml_trace_cb_list = NULL;
88 xbt_dynar_t ETag_surfxml_trace_cb_list = NULL;
89 xbt_dynar_t STag_surfxml_trace_c_connect_cb_list = NULL;
90 xbt_dynar_t ETag_surfxml_trace_c_connect_cb_list = NULL;
91 xbt_dynar_t STag_surfxml_random_cb_list = NULL;
92 xbt_dynar_t ETag_surfxml_random_cb_list = NULL;
93 xbt_dynar_t STag_surfxml_AS_cb_list = NULL; // addded by david
94 xbt_dynar_t ETag_surfxml_AS_cb_list = NULL; // addded by david
95 xbt_dynar_t STag_surfxml_gateway_cb_list = NULL; // addded by david
96 xbt_dynar_t ETag_surfxml_gateway_cb_list = NULL; // addded by david
98 /* Stores the sets defined in the XML */
99 xbt_dict_t set_list = NULL;
101 xbt_dict_t current_property_set = NULL;
103 /* For the route:multi tag */
104 xbt_dict_t route_table = NULL;
105 xbt_dict_t route_multi_table = NULL;
106 xbt_dynar_t route_multi_elements = NULL;
107 static xbt_dynar_t route_link_list = NULL;
108 xbt_dynar_t links = NULL;
109 xbt_dynar_t keys = NULL;
111 xbt_dict_t random_data_list = NULL;
113 static xbt_dynar_t surf_input_buffer_stack = NULL;
114 static xbt_dynar_t surf_file_to_parse_stack = NULL;
116 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t);
118 YY_BUFFER_STATE surf_input_buffer;
119 FILE *surf_file_to_parse = NULL;
121 static void convert_route_multi_to_routes(void);
122 static void parse_route_elem(void);
123 static void parse_Stag_foreach(void);
124 static void parse_sets(void);
125 static void parse_Stag_route_multi(void);
126 static void parse_Etag_route_multi(void);
127 static void parse_Stag_trace(void);
128 static void parse_Etag_trace(void);
129 static void parse_Stag_trace_c_connect(void);
130 static void init_randomness(void);
131 static void add_randomness(void);
133 void surf_parse_free_callbacks(void)
135 xbt_dynar_free(&STag_surfxml_platform_cb_list);
136 xbt_dynar_free(&ETag_surfxml_platform_cb_list);
137 xbt_dynar_free(&STag_surfxml_host_cb_list);
138 xbt_dynar_free(&ETag_surfxml_host_cb_list);
139 xbt_dynar_free(&STag_surfxml_router_cb_list);
140 xbt_dynar_free(&ETag_surfxml_router_cb_list);
141 xbt_dynar_free(&STag_surfxml_link_cb_list);
142 xbt_dynar_free(&ETag_surfxml_link_cb_list);
143 xbt_dynar_free(&STag_surfxml_route_cb_list);
144 xbt_dynar_free(&ETag_surfxml_route_cb_list);
145 xbt_dynar_free(&STag_surfxml_link_c_ctn_cb_list);
146 xbt_dynar_free(&ETag_surfxml_link_c_ctn_cb_list);
147 xbt_dynar_free(&STag_surfxml_process_cb_list);
148 xbt_dynar_free(&ETag_surfxml_process_cb_list);
149 xbt_dynar_free(&STag_surfxml_argument_cb_list);
150 xbt_dynar_free(&ETag_surfxml_argument_cb_list);
151 xbt_dynar_free(&STag_surfxml_prop_cb_list);
152 xbt_dynar_free(&ETag_surfxml_prop_cb_list);
153 xbt_dynar_free(&STag_surfxml_set_cb_list);
154 xbt_dynar_free(&ETag_surfxml_set_cb_list);
155 xbt_dynar_free(&STag_surfxml_foreach_cb_list);
156 xbt_dynar_free(&ETag_surfxml_foreach_cb_list);
157 xbt_dynar_free(&STag_surfxml_route_c_multi_cb_list);
158 xbt_dynar_free(&ETag_surfxml_route_c_multi_cb_list);
159 xbt_dynar_free(&STag_surfxml_cluster_cb_list);
160 xbt_dynar_free(&ETag_surfxml_cluster_cb_list);
161 xbt_dynar_free(&STag_surfxml_trace_cb_list);
162 xbt_dynar_free(&ETag_surfxml_trace_cb_list);
163 xbt_dynar_free(&STag_surfxml_trace_c_connect_cb_list);
164 xbt_dynar_free(&ETag_surfxml_trace_c_connect_cb_list);
165 xbt_dynar_free(&STag_surfxml_random_cb_list);
166 xbt_dynar_free(&ETag_surfxml_random_cb_list);
167 xbt_dynar_free(&STag_surfxml_AS_cb_list); // addded by david
168 xbt_dynar_free(&ETag_surfxml_AS_cb_list); // addded by david
169 xbt_dynar_free(&STag_surfxml_gateway_cb_list); // addded by david
170 xbt_dynar_free(&ETag_surfxml_gateway_cb_list); // addded by david
173 void surf_parse_reset_parser(void)
175 surf_parse_free_callbacks();
176 STag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
177 ETag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
178 STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
179 ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
180 STag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
181 ETag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
182 STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
183 ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
184 STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
185 ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
186 STag_surfxml_link_c_ctn_cb_list =
187 xbt_dynar_new(sizeof(void_f_void_t), NULL);
188 ETag_surfxml_link_c_ctn_cb_list =
189 xbt_dynar_new(sizeof(void_f_void_t), NULL);
190 STag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
191 ETag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
192 STag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
193 ETag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
194 STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
195 ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
196 STag_surfxml_set_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
197 ETag_surfxml_set_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
198 STag_surfxml_foreach_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
199 ETag_surfxml_foreach_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
200 STag_surfxml_route_c_multi_cb_list =
201 xbt_dynar_new(sizeof(void_f_void_t), NULL);
202 ETag_surfxml_route_c_multi_cb_list =
203 xbt_dynar_new(sizeof(void_f_void_t), NULL);
204 STag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
205 ETag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
206 STag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
207 ETag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
208 STag_surfxml_trace_c_connect_cb_list =
209 xbt_dynar_new(sizeof(void_f_void_t), NULL);
210 ETag_surfxml_trace_c_connect_cb_list =
211 xbt_dynar_new(sizeof(void_f_void_t), NULL);
212 STag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
213 ETag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
214 STag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
215 ETag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
216 STag_surfxml_gateway_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
217 ETag_surfxml_gateway_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
220 void STag_surfxml_include(void)
222 xbt_dynar_push(surf_input_buffer_stack, &surf_input_buffer);
223 xbt_dynar_push(surf_file_to_parse_stack, &surf_file_to_parse);
225 surf_file_to_parse = surf_fopen(A_surfxml_include_file, "r");
226 xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n",
227 A_surfxml_include_file);
228 surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, 10);
229 surf_parse__switch_to_buffer(surf_input_buffer);
234 void ETag_surfxml_include(void)
238 surf_parse__delete_buffer(surf_input_buffer);
239 fclose(surf_file_to_parse);
240 xbt_dynar_pop(surf_file_to_parse_stack, &surf_file_to_parse);
241 xbt_dynar_pop(surf_input_buffer_stack, &surf_input_buffer);
244 void STag_surfxml_platform(void)
246 double version = 0.0;
248 sscanf(A_surfxml_platform_version, "%lg", &version);
250 xbt_assert0((version >= 1.0), "******* BIG FAT WARNING *********\n "
251 "You're using an ancient XML file. "
252 "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
253 "instead of MBytes, MFlops and seconds. "
254 "A script (surfxml_update.pl) to help you convert your old "
256 "is available in the contrib/platform_generation directory "
257 "of the simgrid repository. Please check also out the "
258 "SURF section of the ChangeLog for the 3.1 version. "
259 "Last, do not forget to also update your values for "
260 "the calls to MSG_task_create (if any).");
261 xbt_assert0((version >= 2.0), "******* BIG FAT WARNING *********\n "
262 "You're using an old XML file. "
263 "A script (surfxml_update.pl) to help you convert your old "
265 "is available in the contrib/platform_generation directory "
266 "of the simgrid repository.");
268 surfxml_call_cb_functions(STag_surfxml_platform_cb_list);
272 void ETag_surfxml_platform(void)
274 convert_route_multi_to_routes();
276 surfxml_call_cb_functions(ETag_surfxml_platform_cb_list);
278 xbt_dict_free(&random_data_list);
281 void STag_surfxml_host(void)
283 surfxml_call_cb_functions(STag_surfxml_host_cb_list);
287 void ETag_surfxml_host(void)
289 surfxml_call_cb_functions(ETag_surfxml_host_cb_list);
292 void STag_surfxml_router(void)
294 surfxml_call_cb_functions(STag_surfxml_router_cb_list);
297 void ETag_surfxml_router(void)
299 surfxml_call_cb_functions(ETag_surfxml_router_cb_list);
302 void STag_surfxml_link(void)
304 surfxml_call_cb_functions(STag_surfxml_link_cb_list);
307 void ETag_surfxml_link(void)
309 surfxml_call_cb_functions(ETag_surfxml_link_cb_list);
312 void STag_surfxml_route(void)
314 surfxml_call_cb_functions(STag_surfxml_route_cb_list);
317 void ETag_surfxml_route(void)
319 surfxml_call_cb_functions(ETag_surfxml_route_cb_list);
322 void STag_surfxml_link_c_ctn(void)
324 surfxml_call_cb_functions(STag_surfxml_link_c_ctn_cb_list);
327 void ETag_surfxml_link_c_ctn(void)
329 surfxml_call_cb_functions(ETag_surfxml_link_c_ctn_cb_list);
332 void STag_surfxml_process(void)
334 surfxml_call_cb_functions(STag_surfxml_process_cb_list);
337 void ETag_surfxml_process(void)
339 surfxml_call_cb_functions(ETag_surfxml_process_cb_list);
342 void STag_surfxml_argument(void)
344 surfxml_call_cb_functions(STag_surfxml_argument_cb_list);
347 void ETag_surfxml_argument(void)
349 surfxml_call_cb_functions(ETag_surfxml_argument_cb_list);
352 void STag_surfxml_prop(void)
354 surfxml_call_cb_functions(STag_surfxml_prop_cb_list);
357 void ETag_surfxml_prop(void)
359 surfxml_call_cb_functions(ETag_surfxml_prop_cb_list);
362 void STag_surfxml_set(void)
364 surfxml_call_cb_functions(STag_surfxml_set_cb_list);
367 void ETag_surfxml_set(void)
369 surfxml_call_cb_functions(ETag_surfxml_set_cb_list);
372 void STag_surfxml_foreach(void)
374 /* Save the current buffer */
375 surfxml_bufferstack_push(0);
376 surfxml_call_cb_functions(STag_surfxml_foreach_cb_list);
379 void ETag_surfxml_foreach(void)
381 surfxml_call_cb_functions(ETag_surfxml_foreach_cb_list);
383 /* free the temporary dynar and restore original */
384 xbt_dynar_free(&STag_surfxml_host_cb_list);
385 STag_surfxml_host_cb_list = main_STag_surfxml_host_cb_list;
387 /* free the temporary dynar and restore original */
388 xbt_dynar_free(&STag_surfxml_link_cb_list);
389 STag_surfxml_link_cb_list = main_STag_surfxml_link_cb_list;
392 void STag_surfxml_route_c_multi(void)
394 surfxml_call_cb_functions(STag_surfxml_route_c_multi_cb_list);
397 void ETag_surfxml_route_c_multi(void)
399 surfxml_call_cb_functions(ETag_surfxml_route_c_multi_cb_list);
402 void STag_surfxml_cluster(void)
404 surfxml_call_cb_functions(STag_surfxml_cluster_cb_list);
407 void ETag_surfxml_cluster(void)
409 surfxml_call_cb_functions(ETag_surfxml_cluster_cb_list);
412 void STag_surfxml_trace(void)
414 surfxml_call_cb_functions(STag_surfxml_trace_cb_list);
417 void ETag_surfxml_trace(void)
419 surfxml_call_cb_functions(ETag_surfxml_trace_cb_list);
422 void STag_surfxml_trace_c_connect(void)
424 surfxml_call_cb_functions(STag_surfxml_trace_c_connect_cb_list);
427 void ETag_surfxml_trace_c_connect(void)
429 surfxml_call_cb_functions(ETag_surfxml_trace_c_connect_cb_list);
432 void STag_surfxml_random(void)
434 surfxml_call_cb_functions(STag_surfxml_random_cb_list);
437 void ETag_surfxml_random(void)
439 surfxml_call_cb_functions(ETag_surfxml_random_cb_list);
442 void STag_surfxml_AS(void) // addded by david
444 surfxml_call_cb_functions(STag_surfxml_AS_cb_list);
447 void ETag_surfxml_AS(void) // addded by david
449 surfxml_call_cb_functions(ETag_surfxml_AS_cb_list);
452 void STag_surfxml_gateway(void) // addded by david
454 surfxml_call_cb_functions(STag_surfxml_gateway_cb_list);
457 void ETag_surfxml_gateway(void) // addded by david
459 surfxml_call_cb_functions(ETag_surfxml_gateway_cb_list);
462 void surf_parse_open(const char *file)
464 static int warned = 0; /* warn only once */
468 ("Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.");
473 surf_file_to_parse = surf_fopen(file, "r");
474 xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n", file);
476 if (!surf_input_buffer_stack)
477 surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE), NULL);
478 if (!surf_file_to_parse_stack)
479 surf_file_to_parse_stack = xbt_dynar_new(sizeof(FILE *), NULL);
481 surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, 10);
482 surf_parse__switch_to_buffer(surf_input_buffer);
483 surf_parse_lineno = 1;
486 void surf_parse_close(void)
488 if (surf_input_buffer_stack)
489 xbt_dynar_free(&surf_input_buffer_stack);
490 if (surf_file_to_parse_stack)
491 xbt_dynar_free(&surf_file_to_parse_stack);
493 if (surf_file_to_parse) {
494 surf_parse__delete_buffer(surf_input_buffer);
495 fclose(surf_file_to_parse);
499 static int _surf_parse(void)
501 return surf_parse_lex();
504 int_f_void_t surf_parse = _surf_parse;
506 void surf_parse_error(char *msg)
508 fprintf(stderr, "Parse error on line %d: %s\n", surf_parse_lineno, msg);
513 void surf_parse_get_double(double *value, const char *string)
517 ret = sscanf(string, "%lg", value);
519 surf_parse_error(bprintf("%s is not a double", string));
522 void surf_parse_get_int(int *value, const char *string)
526 ret = sscanf(string, "%d", value);
528 surf_parse_error(bprintf("%s is not an integer", string));
531 void parse_properties(void)
535 if (!current_property_set)
536 current_property_set = xbt_dict_new();
538 value = xbt_strdup(A_surfxml_prop_value);
539 xbt_dict_set(current_property_set, A_surfxml_prop_id, value, free);
542 void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
544 xbt_dynar_push(cb_list, &function);
547 void surfxml_del_callback(xbt_dynar_t* p_cb_list, void_f_void_t function)
549 xbt_dynar_t new_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
552 xbt_dynar_foreach(*p_cb_list,it,func) {
553 if( func != function )
554 xbt_dynar_push(new_cb_list, &func);
556 xbt_dynar_free(p_cb_list);
557 *p_cb_list = new_cb_list;
560 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
562 unsigned int iterator;
564 xbt_dynar_foreach(cb_list, iterator, fun) {
569 static void parse_route_set_endpoints(void)
571 route_link_list = xbt_dynar_new(sizeof(char *), NULL);
574 static void init_data(void)
576 xbt_dict_free(&route_table);
577 xbt_dynar_free(&route_link_list);
578 route_table = xbt_dict_new();
580 if (!surfxml_bufferstack_stack)
581 surfxml_bufferstack_stack = xbt_dynar_new(sizeof(char *), NULL);
582 route_multi_table = xbt_dict_new();
583 route_multi_elements = xbt_dynar_new(sizeof(char *), NULL);
584 traces_set_list = xbt_dict_new();
585 if (set_list == NULL)
586 set_list = xbt_dict_new();
588 trace_connect_list_host_avail = xbt_dict_new();
589 trace_connect_list_power = xbt_dict_new();
590 trace_connect_list_link_avail = xbt_dict_new();
591 trace_connect_list_bandwidth = xbt_dict_new();
592 trace_connect_list_latency = xbt_dict_new();
594 random_data_list = xbt_dict_new();
595 surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
596 surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
597 surfxml_add_callback(STag_surfxml_route_cb_list,
598 &parse_route_set_endpoints);
599 surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
600 surfxml_add_callback(STag_surfxml_route_c_multi_cb_list,
601 &parse_Stag_route_multi);
602 surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list,
603 &parse_Etag_route_multi);
604 surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_Stag_foreach);
605 surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_Stag_trace);
606 surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace);
607 surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list,
608 &parse_Stag_trace_c_connect);
609 surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
610 surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
613 static void free_data(void)
616 xbt_dict_cursor_t cursor = NULL;
618 unsigned int cpt = 0;
620 xbt_dict_foreach(route_table, cursor, key, data) {
621 xbt_dynar_t links = (xbt_dynar_t) data;
623 unsigned int cpt = 0;
625 xbt_dynar_foreach(links, cpt, name) free(name);
626 xbt_dynar_free(&links);
628 xbt_dict_free(&route_table);
629 route_link_list = NULL;
631 xbt_dict_free(&route_multi_table);
633 xbt_dynar_foreach(route_multi_elements, cpt, name) free(name);
634 xbt_dynar_free(&route_multi_elements);
636 xbt_dict_foreach(set_list, cursor, key, data) {
637 xbt_dynar_t set = (xbt_dynar_t) data;
639 xbt_dynar_foreach(set, cpt, name) free(name);
640 xbt_dynar_free(&set);
642 xbt_dict_free(&set_list);
644 xbt_dynar_free(&surfxml_bufferstack_stack);
646 xbt_dict_free(&traces_set_list);
647 xbt_dict_free(&trace_connect_list_host_avail);
648 xbt_dict_free(&trace_connect_list_power);
649 xbt_dict_free(&trace_connect_list_link_avail);
650 xbt_dict_free(&trace_connect_list_bandwidth);
651 xbt_dict_free(&trace_connect_list_latency);
652 xbt_dict_free(&traces_set_list);
655 void parse_platform_file(const char *file)
658 surf_parse_open(file);
660 parse_status = surf_parse();
664 xbt_dict_free(&random_data_list);
665 xbt_assert1(!parse_status, "Parse error in %s", file);
668 /* Functions to bypass route tag. Used by the route:multi tag */
670 static void parse_make_temporary_route(const char *src, const char *dst,
675 A_surfxml_route_action = action;
676 SURFXML_BUFFER_SET(route_src, src);
677 SURFXML_BUFFER_SET(route_dst, dst);
680 /* Functions for the sets and foreach tags */
682 static void parse_sets(void)
684 char *id, *suffix, *prefix, *radical;
686 xbt_dynar_t radical_elements;
687 xbt_dynar_t radical_ends;
688 xbt_dynar_t current_set;
689 char *value, *groups;
693 id = xbt_strdup(A_surfxml_set_id);
694 prefix = xbt_strdup(A_surfxml_set_prefix);
695 suffix = xbt_strdup(A_surfxml_set_suffix);
696 radical = xbt_strdup(A_surfxml_set_radical);
698 if (xbt_dict_get_or_null(set_list, id))
699 surf_parse_error(bprintf
700 ("Set '%s' declared several times in the platform file.",
703 current_set = xbt_dynar_new(sizeof(char *), NULL);
705 radical_elements = xbt_str_split(radical, ",");
706 xbt_dynar_foreach(radical_elements, iter, groups) {
708 radical_ends = xbt_str_split(groups, "-");
709 switch (xbt_dynar_length(radical_ends)) {
711 surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
712 value = bprintf("%s%d%s", prefix, start, suffix);
713 xbt_dynar_push(current_set, &value);
718 surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
719 surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *));
722 for (i = start; i <= end; i++) {
723 value = bprintf("%s%d%s", prefix, i, suffix);
724 xbt_dynar_push(current_set, &value);
729 surf_parse_error(xbt_strdup("Malformed radical"));
732 xbt_dynar_free(&radical_ends);
735 xbt_dict_set(set_list, id, current_set, NULL);
737 xbt_dynar_free(&radical_elements);
744 static void parse_host_foreach(void){
746 xbt_dynar_t names = NULL;
747 unsigned int cpt = 0;
749 xbt_dict_cursor_t cursor = NULL;
752 const char *surfxml_host_power = A_surfxml_host_power;
753 const char *surfxml_host_availability = A_surfxml_host_availability;
754 const char *surfxml_host_availability_file = A_surfxml_host_availability_file;
755 const char *surfxml_host_state_file = A_surfxml_host_state_file;
757 xbt_dict_t cluster_host_props = current_property_set;
759 names = xbt_dict_get_or_null(set_list, foreach_set_name);
761 surf_parse_error(bprintf("Set name '%s' used in <foreach> not found.",
763 if (strcmp(A_surfxml_host_id, "$1"))
764 surf_parse_error(bprintf
765 ("The host id within <foreach> should point to the foreach set_id (use $1 instead of %s)",
769 /* foreach name in set call the main host callback */
770 xbt_dynar_foreach(names, cpt, name) {
771 int AX_ptr = 0; /* needed by the SURFXML_BUFFER_SET macro */
773 surfxml_bufferstack_push(1);
775 SURFXML_BUFFER_SET(host_id, name);
776 SURFXML_BUFFER_SET(host_power, surfxml_host_power /*hostPower */ );
777 SURFXML_BUFFER_SET(host_availability, surfxml_host_availability);
778 SURFXML_BUFFER_SET(host_availability_file, surfxml_host_availability_file);
779 SURFXML_BUFFER_SET(host_state_file, surfxml_host_state_file);
781 surfxml_call_cb_functions(main_STag_surfxml_host_cb_list);
783 xbt_dict_foreach(cluster_host_props, cursor, key, data) {
784 xbt_dict_set(current_property_set, xbt_strdup(key), xbt_strdup(data),
788 /* Call the (unmodified) callbacks of </host>, if any */
789 surfxml_call_cb_functions(ETag_surfxml_host_cb_list);
790 surfxml_bufferstack_pop(1);
793 current_property_set = xbt_dict_new();
795 surfxml_bufferstack_pop(0);
798 static void parse_link_foreach(void) {
799 const char *surfxml_link_bandwidth = A_surfxml_link_bandwidth;
800 const char *surfxml_link_bandwidth_file = A_surfxml_link_bandwidth_file;
801 const char *surfxml_link_latency = A_surfxml_link_latency;
802 const char *surfxml_link_latency_file = A_surfxml_link_latency_file;
803 const char *surfxml_link_state_file = A_surfxml_link_state_file;
805 xbt_dynar_t names = NULL;
806 unsigned int cpt = 0;
808 xbt_dict_cursor_t cursor = NULL;
811 xbt_dict_t cluster_link_props = current_property_set;
813 names = xbt_dict_get_or_null(set_list, foreach_set_name);
815 surf_parse_error(bprintf("Set name '%s' used in <foreach> not found.",
817 if (strcmp(A_surfxml_link_id, "$1"))
818 surf_parse_error(bprintf
819 ("The host id within <foreach> should point to the foreach set_id (use $1 instead of %s)",
822 /* for each name in set call the main link callback */
823 xbt_dynar_foreach(names, cpt, name) {
824 int AX_ptr = 0; /* needed by the SURFXML_BUFFER_SET */
826 surfxml_bufferstack_push(1);
828 SURFXML_BUFFER_SET(link_id, name);
829 SURFXML_BUFFER_SET(link_bandwidth, surfxml_link_bandwidth);
830 SURFXML_BUFFER_SET(link_bandwidth_file, surfxml_link_bandwidth_file);
831 SURFXML_BUFFER_SET(link_latency, surfxml_link_latency);
832 SURFXML_BUFFER_SET(link_latency_file, surfxml_link_latency_file);
833 SURFXML_BUFFER_SET(link_state_file, surfxml_link_state_file);
835 surfxml_call_cb_functions(main_STag_surfxml_link_cb_list);
837 xbt_dict_foreach(cluster_link_props, cursor, key, data) {
838 xbt_dict_set(current_property_set, xbt_strdup(key), xbt_strdup(data),
842 /* Call the (unmodified) callbacks of </link>, if any */
843 surfxml_call_cb_functions(ETag_surfxml_link_cb_list);
844 surfxml_bufferstack_pop(1);
847 current_property_set = xbt_dict_new();
849 surfxml_bufferstack_pop(0);
850 free(foreach_set_name);
851 foreach_set_name = NULL;
854 static void parse_Stag_foreach(void)
856 /* save the host & link callbacks */
857 main_STag_surfxml_host_cb_list = STag_surfxml_host_cb_list;
858 main_STag_surfxml_link_cb_list = STag_surfxml_link_cb_list;
860 /* redefine host & link callbacks to be used only by the foreach tag */
861 STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
862 STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
864 surfxml_add_callback(STag_surfxml_host_cb_list, &parse_host_foreach);
865 surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_foreach);
868 foreach_set_name = xbt_strdup(A_surfxml_foreach_set_id);
871 /* Route:multi functions */
873 static int route_multi_size = 0;
874 static char *src_name, *dst_name;
875 static int is_symmetric_route;
877 static void parse_route_elem(void)
881 val = xbt_strdup(A_surfxml_link_c_ctn_id);
883 xbt_dynar_push(route_link_list, &val);
884 //INFO2("Push %s (size now:%ld)",val,xbt_dynar_length(route_link_list));
887 static void parse_Stag_route_multi(void)
889 src_name = xbt_strdup(A_surfxml_route_c_multi_src);
890 dst_name = xbt_strdup(A_surfxml_route_c_multi_dst);
891 route_action = A_surfxml_route_c_multi_action;
892 is_symmetric_route = A_surfxml_route_c_multi_symmetric;
895 route_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
899 This function is used to append or override the contents of an already existing route in the case a new one with its name is found.
900 The decision is based upon the value of action specified in the xml route:multi attribute action
902 void manage_route(xbt_dict_t routing_table, const char *route_name,
903 int action, int isMultiRoute)
909 /* get already existing list if it exists */
910 links = xbt_dict_get_or_null(routing_table, route_name);
911 DEBUG3("ROUTE: %s (action:%s; len:%ld)", route_name,
912 (action==A_surfxml_route_action_OVERRIDE?"override":(
913 action==A_surfxml_route_action_PREPEND?"prepend":"postpend")),
914 (links?xbt_dynar_length(links):0));
918 case A_surfxml_route_action_PREPEND: /* add existing links at the end; route_link_list + links */
919 xbt_dynar_foreach(links, cpt, value) {
920 xbt_dynar_push(route_link_list, &value);
922 xbt_dynar_free(&links);
924 case A_surfxml_route_action_POSTPEND: /* add existing links in front; links + route_link_list */
925 xbt_dynar_foreach(route_link_list, cpt, value) {
926 xbt_dynar_push(links, &value);
928 xbt_dynar_free(&route_link_list);
929 route_link_list = links;
931 case A_surfxml_route_action_OVERRIDE:
932 xbt_dynar_free(&links);
935 xbt_die(bprintf("While dealing with routes of %s, got action=%d. Please report this bug.",
941 /* this is the final route; do not add if name is a set; add only if name is in set list */
943 xbt_dict_set(routing_table, route_name, route_link_list, NULL);
947 static void parse_Etag_route_multi(void)
952 bprintf("%s#%s#%d#%d#%d", src_name, dst_name, route_action,
953 is_symmetric_route, route_multi_size);
955 xbt_dynar_push(route_multi_elements, &route_name);
958 xbt_dict_set(route_multi_table, route_name, route_link_list, NULL);
959 /* add symmetric if it is the case */
960 if (is_symmetric_route == 1) {
961 char *symmetric_name =
962 bprintf("%s#%s#%d#%d#%d", dst_name, src_name, route_action,
963 !is_symmetric_route, route_multi_size);
965 xbt_dict_set(route_multi_table, symmetric_name, route_link_list, NULL);
966 xbt_dynar_push(route_multi_elements, &symmetric_name);
967 is_symmetric_route = 0;
973 static void add_multi_links(const char *src, const char *dst,
974 xbt_dynar_t links, const char *src_name,
975 const char *dst_name)
980 surfxml_bufferstack_push(1);
982 parse_make_temporary_route(src_name, dst_name, route_action);
983 surfxml_call_cb_functions(STag_surfxml_route_cb_list);
984 DEBUG2("\tADDING ROUTE: %s -> %s", src_name, dst_name);
985 /* Build link list */
986 xbt_dynar_foreach(links, cpt, value) {
987 if (strcmp(value, src) == 0)
988 val = xbt_strdup(src_name);
989 else if (strcmp(value, dst) == 0)
990 val = xbt_strdup(dst_name);
991 else if (strcmp(value, "$dst") == 0)
992 val = xbt_strdup(dst_name);
993 else if (strcmp(value, "$src") == 0)
994 val = xbt_strdup(src_name);
996 val = xbt_strdup(value);
997 DEBUG1("\t\tELEMENT: %s", val);
998 xbt_dynar_push(route_link_list, &val);
1000 surfxml_call_cb_functions(ETag_surfxml_route_cb_list);
1001 surfxml_bufferstack_pop(1);
1004 static void convert_route_multi_to_routes(void)
1006 xbt_dict_cursor_t cursor_w;
1008 unsigned int cpt, cpt2, cursor;
1009 char *src_host_name, *dst_host_name, *key, *src, *dst, *val, *key_w,
1011 const char *sep = "#";
1012 xbt_dict_t set = NULL;
1013 xbt_dynar_t src_names = NULL, dst_names = NULL, links;
1015 if (!route_multi_elements)
1019 set = surf_model_resource_set(surf_cpu_model);
1020 if (surf_workstation_model != NULL &&
1021 surf_model_resource_set(surf_workstation_model) != NULL &&
1022 xbt_dict_length(surf_model_resource_set(surf_workstation_model)) > 0)
1023 set = surf_model_resource_set(surf_workstation_model);
1026 surfxml_bufferstack_push(0);
1027 /* Get all routes in the exact order they were entered in the platform file */
1028 xbt_dynar_foreach(route_multi_elements, cursor, key) {
1029 /* Get links for the route */
1030 links = (xbt_dynar_t) xbt_dict_get_or_null(route_multi_table, key);
1031 keys = xbt_str_split_str(key, sep);
1032 /* Get route ends */
1033 src = xbt_dynar_get_as(keys, 0, char *);
1034 dst = xbt_dynar_get_as(keys, 1, char *);
1035 route_action = atoi(xbt_dynar_get_as(keys, 2, char *));
1036 symmetric = atoi(xbt_dynar_get_as(keys, 3, char *));
1038 /* Create the dynar of src and dst hosts for the new routes */
1039 /* NOTE: src and dst can be either set names or simple host names */
1040 src_names = (xbt_dynar_t) xbt_dict_get_or_null(set_list, src);
1041 dst_names = (xbt_dynar_t) xbt_dict_get_or_null(set_list, dst);
1042 /* Add to dynar even if they are simple names */
1043 if (src_names == NULL) {
1044 src_names = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
1045 val = xbt_strdup(src);
1046 xbt_dynar_push(src_names, &val);
1047 if (strcmp(val, "$*") != 0 && NULL == xbt_dict_get_or_null(set, val))
1048 THROW3(unknown_error, 0,
1049 "(In route:multi (%s -> %s) source %s does not exist (not a set or a host)",
1052 if (dst_names == NULL) {
1053 dst_names = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
1054 val = xbt_strdup(dst);
1055 if (strcmp(val, "$*") != 0 && NULL == xbt_dict_get_or_null(set, val))
1056 THROW3(unknown_error, 0,
1057 "(In route:multi (%s -> %s) destination %s does not exist (not a set or a host)",
1059 xbt_dynar_push(dst_names, &val);
1062 /* Build the routes */
1063 DEBUG2("ADDING MULTI ROUTE: %s -> %s", xbt_dynar_get_as(keys, 0, char *),
1064 xbt_dynar_get_as(keys, 1, char *));
1065 xbt_dynar_foreach(src_names, cpt, src_host_name) {
1066 xbt_dynar_foreach(dst_names, cpt2, dst_host_name) {
1067 /* If dst is $* then set this route to have its dst point to all hosts */
1068 if (strcmp(src_host_name, "$*") != 0
1069 && strcmp(dst_host_name, "$*") == 0) {
1070 xbt_dict_foreach(set, cursor_w, key_w, data_w) {
1071 //int n = xbt_dynar_member(src_names, (char*)key_w);
1072 add_multi_links(src, dst, links, src_host_name, key_w);
1075 /* If src is $* then set this route to have its dst point to all hosts */
1076 if (strcmp(src_host_name, "$*") == 0
1077 && strcmp(dst_host_name, "$*") != 0) {
1078 xbt_dict_foreach(set, cursor_w, key_w, data_w) {
1079 // if (!symmetric || (symmetric && !contains(dst_names, key_w)))
1080 add_multi_links(src, dst, links, key_w, dst_host_name);
1083 /* if none of them are equal to $* */
1084 if (strcmp(src_host_name, "$*") != 0
1085 && strcmp(dst_host_name, "$*") != 0) {
1086 add_multi_links(src, dst, links, src_host_name, dst_host_name);
1090 xbt_dynar_free(&keys);
1092 surfxml_bufferstack_pop(0);
1096 /* Trace management functions */
1098 static double trace_periodicity = -1.0;
1099 static char *trace_file = NULL;
1100 static char *trace_id;
1102 static void parse_Stag_trace(void)
1104 trace_id = strdup(A_surfxml_trace_id);
1105 trace_file = strdup(A_surfxml_trace_file);
1106 surf_parse_get_double(&trace_periodicity, A_surfxml_trace_periodicity);
1109 static void parse_Etag_trace(void)
1112 if (!trace_file || strcmp(trace_file, "") != 0) {
1113 trace = tmgr_trace_new(trace_file);
1115 if (strcmp(surfxml_pcdata, "") == 0)
1119 tmgr_trace_new_from_string(trace_id, surfxml_pcdata,
1122 xbt_dict_set(traces_set_list, trace_id, (void *) trace, NULL);
1125 static void parse_Stag_trace_c_connect(void)
1127 xbt_assert2(xbt_dict_get_or_null
1128 (traces_set_list, A_surfxml_trace_c_connect_trace),
1129 "Cannot connect trace %s to %s: trace unknown",
1130 A_surfxml_trace_c_connect_trace,
1131 A_surfxml_trace_c_connect_element);
1133 switch (A_surfxml_trace_c_connect_kind) {
1134 case A_surfxml_trace_c_connect_kind_HOST_AVAIL:
1135 xbt_dict_set(trace_connect_list_host_avail,
1136 A_surfxml_trace_c_connect_trace,
1137 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1139 case A_surfxml_trace_c_connect_kind_POWER:
1140 xbt_dict_set(trace_connect_list_power, A_surfxml_trace_c_connect_trace,
1141 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1143 case A_surfxml_trace_c_connect_kind_LINK_AVAIL:
1144 xbt_dict_set(trace_connect_list_link_avail,
1145 A_surfxml_trace_c_connect_trace,
1146 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1148 case A_surfxml_trace_c_connect_kind_BANDWIDTH:
1149 xbt_dict_set(trace_connect_list_bandwidth,
1150 A_surfxml_trace_c_connect_trace,
1151 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1153 case A_surfxml_trace_c_connect_kind_LATENCY:
1154 xbt_dict_set(trace_connect_list_latency, A_surfxml_trace_c_connect_trace,
1155 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1158 xbt_die(bprintf("Cannot connect trace %s to %s: kind of trace unknown",
1159 A_surfxml_trace_c_connect_trace,
1160 A_surfxml_trace_c_connect_element));
1164 /* Random tag functions */
1166 double get_cpu_power(const char *power)
1168 double power_scale = 0.0;
1171 random_data_t random = NULL;
1172 /* randomness is inserted like this: power="$rand(my_random)" */
1173 if (((p = strstr(power, "$rand(")) != NULL)
1174 && ((q = strstr(power, ")")) != NULL)) {
1176 generator = xbt_malloc(q - (p + 6) + 1);
1177 memcpy(generator, p + 6, q - (p + 6));
1178 generator[q - (p + 6)] = '\0';
1179 xbt_assert1((random =
1180 xbt_dict_get_or_null(random_data_list, generator)),
1181 "Random generator %s undefined", generator);
1182 power_scale = random_generate(random);
1185 surf_parse_get_double(&power_scale, power);
1190 double random_min, random_max, random_mean, random_std_deviation,
1194 static void init_randomness(void)
1196 random_id = A_surfxml_random_id;
1197 surf_parse_get_double(&random_min, A_surfxml_random_min);
1198 surf_parse_get_double(&random_max, A_surfxml_random_max);
1199 surf_parse_get_double(&random_mean, A_surfxml_random_mean);
1200 surf_parse_get_double(&random_std_deviation,
1201 A_surfxml_random_std_deviation);
1202 random_generator = A_surfxml_random_generator;
1205 static void add_randomness(void)
1207 /* If needed aditional properties can be added by using the prop tag */
1208 random_data_t random =
1209 random_new(random_generator, 0, random_min, random_max, random_mean,
1210 random_std_deviation);
1211 xbt_dict_set(random_data_list, random_id, (void *) random, NULL);
1215 * create CPU resource via CPU Model
1217 void surf_host_create_resource(char *name, double power_peak,
1219 tmgr_trace_t power_trace,
1220 e_surf_resource_state_t state_initial,
1221 tmgr_trace_t state_trace,
1222 xbt_dict_t cpu_properties)
1224 return surf_cpu_model->extension.cpu.
1225 create_resource(name,power_peak,power_scale,power_trace,state_initial,state_trace,cpu_properties);
1229 * create CPU resource via worsktation_ptask_L07 model
1232 void surf_wsL07_host_create_resource(char *name, double power_peak,
1234 tmgr_trace_t power_trace,
1235 e_surf_resource_state_t state_initial,
1236 tmgr_trace_t state_trace,
1237 xbt_dict_t cpu_properties)
1239 surf_workstation_model->extension.workstation.
1240 cpu_create_resource(name,power_peak,power_scale,power_trace,state_initial,state_trace,cpu_properties);
1243 * create link resource via network Model
1245 void surf_link_create_resource(char *name,
1247 tmgr_trace_t bw_trace,
1249 tmgr_trace_t lat_trace,
1250 e_surf_resource_state_t
1252 tmgr_trace_t state_trace,
1253 e_surf_link_sharing_policy_t policy,
1254 xbt_dict_t properties)
1256 return surf_network_model->extension.network.
1257 create_resource(name,bw_initial,bw_trace,lat_initial,lat_trace,
1258 state_initial,state_trace,policy,properties);
1263 * create link resource via workstation_ptask_L07 model
1266 void surf_wsL07_link_create_resource(char *name,
1268 tmgr_trace_t bw_trace,
1270 tmgr_trace_t lat_trace,
1271 e_surf_resource_state_t
1273 tmgr_trace_t state_trace,
1274 e_surf_link_sharing_policy_t
1275 policy, xbt_dict_t properties)
1277 return surf_workstation_model->extension.workstation.
1278 link_create_resource(name,bw_initial,bw_trace,lat_initial,lat_trace,
1279 state_initial,state_trace,policy,properties);
1284 * Route: add route element bypassing the parser :
1285 * same job as parse_route_elem
1288 void surf_add_route_element(char* link_ctn_id)
1291 val = xbt_strdup(link_ctn_id);
1292 xbt_dynar_push(route_link_list,&val);
1297 void surf_route_set_resource(char *source_id,char *destination_id,xbt_dynar_t links_id,int action)
1299 route_link_list = xbt_dynar_new(sizeof(char *), NULL);
1300 //routing_add_route(source_id,destination_id,links_id,action); // COMMENTED BY DAVID
1305 * add host to routing host list
1307 void surf_route_add_host(char *host_id)
1309 //routing_add_host(host_id); // COMMENTED BY DAVID
1315 void surf_add_host_traces(void)
1317 return surf_cpu_model->extension.cpu.
1321 void surf_add_link_traces(void)
1323 return surf_network_model->extension.network.
1327 void surf_wsL07_add_traces(void)
1329 return surf_workstation_model->extension.workstation.
1335 void surf_set_routes(void)
1337 //routing_set_routes(); // COMMENTED BY DAVID