1 /* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011. 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.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 int ETag_surfxml_include_state(void);
19 #include "simgrid_dtd.c"
24 void surf_parse_error(const char *msg) {
25 xbt_die("Parse error on line %d: %s\n", surf_parse_lineno, msg);
28 double surf_parse_get_double(const char *string) {
30 int ret = sscanf(string, "%lg", &res);
32 surf_parse_error(bprintf("%s is not a double", string));
36 int surf_parse_get_int(const char *string) {
38 int ret = sscanf(string, "%d", &res);
40 surf_parse_error(bprintf("%s is not an integer", string));
46 * All the callback lists that can be overiden anywhere.
47 * (this list should probably be reduced to the bare minimum to allow the models to work)
50 /* make sure these symbols are defined as strong ones in this file so that the linker can resolve them */
51 xbt_dynar_t STag_surfxml_route_cb_list = NULL;
52 xbt_dynar_t ETag_surfxml_route_cb_list = NULL;
53 xbt_dynar_t STag_surfxml_link_ctn_cb_list = NULL;
54 xbt_dynar_t ETag_surfxml_link_ctn_cb_list = NULL;
55 xbt_dynar_t STag_surfxml_process_cb_list = NULL;
56 xbt_dynar_t ETag_surfxml_process_cb_list = NULL;
57 xbt_dynar_t STag_surfxml_argument_cb_list = NULL;
58 xbt_dynar_t ETag_surfxml_argument_cb_list = NULL;
59 xbt_dynar_t STag_surfxml_prop_cb_list = NULL;
60 xbt_dynar_t ETag_surfxml_prop_cb_list = NULL;
61 xbt_dynar_t STag_surfxml_peer_cb_list = NULL;
62 xbt_dynar_t ETag_surfxml_peer_cb_list = NULL;
63 xbt_dynar_t STag_surfxml_trace_cb_list = NULL;
64 xbt_dynar_t ETag_surfxml_trace_cb_list = NULL;
65 xbt_dynar_t STag_surfxml_trace_connect_cb_list = NULL;
66 xbt_dynar_t ETag_surfxml_trace_connect_cb_list = NULL;
67 xbt_dynar_t STag_surfxml_random_cb_list = NULL;
68 xbt_dynar_t ETag_surfxml_random_cb_list = NULL;
69 xbt_dynar_t STag_surfxml_ASroute_cb_list = NULL;
70 xbt_dynar_t ETag_surfxml_ASroute_cb_list = NULL;
71 xbt_dynar_t STag_surfxml_bypassRoute_cb_list = NULL;
72 xbt_dynar_t ETag_surfxml_bypassRoute_cb_list = NULL;
73 xbt_dynar_t STag_surfxml_include_cb_list = NULL;
74 xbt_dynar_t ETag_surfxml_include_cb_list = NULL;
76 /* The default current property receiver. Setup in the corresponding opening callbacks. */
77 xbt_dict_t current_property_set = NULL;
78 /* dictionary of random generator data */
79 xbt_dict_t random_data_list = NULL;
81 /* Call all the callbacks of a specific SAX event */
82 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t);
84 YY_BUFFER_STATE surf_input_buffer;
85 FILE *surf_file_to_parse = NULL;
87 static void init_randomness(void);
88 static void add_randomness(void);
91 * Stuff relative to the <include> tag
94 static xbt_dynar_t surf_input_buffer_stack = NULL;
95 static xbt_dynar_t surf_file_to_parse_stack = NULL;
97 void STag_surfxml_include(void)
99 XBT_INFO("STag_surfxml_include '%s'",A_surfxml_include_file);
100 xbt_dynar_push(surf_file_to_parse_stack, &surf_file_to_parse); //save old filename
102 surf_file_to_parse = surf_fopen(A_surfxml_include_file, "r"); // read new filename
103 xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n",
104 A_surfxml_include_file);
105 xbt_dynar_push(surf_input_buffer_stack,&surf_input_buffer);
106 surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
107 surf_parse_push_buffer_state(surf_input_buffer);
111 void ETag_surfxml_include(void) {
112 /* Nothing to do when done with reading the include tag.
113 * Instead, the handling should be deferred until the EOF of current buffer -- see below */
116 /** @brief When reaching EOF, check whether we are in an include tag, and behave accordingly if yes
118 * This function is called automatically by sedding the parser in buildtools/Cmake/MaintainerMode.cmake
119 * Every FAIL on "Premature EOF" is preceded by a call to this function, which role is to restore the
120 * previous buffer if we reached the EOF /of an include file/. Its return code is used to avoid the
121 * error message in that case.
123 * Yeah, that's terribly hackish, but it works. A better solution should be dealed with in flexml
124 * directly: a command line flag could instruct it to do the correct thing when #include is encountered
127 int ETag_surfxml_include_state(void)
130 XBT_INFO("ETag_surfxml_include_state '%s'",A_surfxml_include_file);
131 if(!xbt_dynar_is_empty(surf_input_buffer_stack))
133 fclose(surf_file_to_parse);
134 xbt_dynar_pop(surf_file_to_parse_stack, &surf_file_to_parse);
135 surf_parse_pop_buffer_state();
136 xbt_dynar_pop(surf_input_buffer_stack,surf_input_buffer);
141 void surf_parse_init_callbacks(void)
143 sg_platf_init(); // FIXME: move to a proper place?
145 STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
146 ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
147 STag_surfxml_link_ctn_cb_list =
148 xbt_dynar_new(sizeof(void_f_void_t), NULL);
149 ETag_surfxml_link_ctn_cb_list =
150 xbt_dynar_new(sizeof(void_f_void_t), NULL);
151 STag_surfxml_process_cb_list =
152 xbt_dynar_new(sizeof(void_f_void_t), NULL);
153 ETag_surfxml_process_cb_list =
154 xbt_dynar_new(sizeof(void_f_void_t), NULL);
155 STag_surfxml_argument_cb_list =
156 xbt_dynar_new(sizeof(void_f_void_t), NULL);
157 ETag_surfxml_argument_cb_list =
158 xbt_dynar_new(sizeof(void_f_void_t), NULL);
159 STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
160 ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
161 STag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
162 ETag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
163 STag_surfxml_trace_connect_cb_list =
164 xbt_dynar_new(sizeof(void_f_void_t), NULL);
165 ETag_surfxml_trace_connect_cb_list =
166 xbt_dynar_new(sizeof(void_f_void_t), NULL);
167 STag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
168 ETag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
169 STag_surfxml_ASroute_cb_list =
170 xbt_dynar_new(sizeof(void_f_void_t), NULL);
171 ETag_surfxml_ASroute_cb_list =
172 xbt_dynar_new(sizeof(void_f_void_t), NULL);
173 STag_surfxml_bypassRoute_cb_list =
174 xbt_dynar_new(sizeof(void_f_void_t), NULL);
175 ETag_surfxml_bypassRoute_cb_list =
176 xbt_dynar_new(sizeof(void_f_void_t), NULL);
177 STag_surfxml_peer_cb_list =
178 xbt_dynar_new(sizeof(void_f_void_t), NULL);
179 ETag_surfxml_peer_cb_list =
180 xbt_dynar_new(sizeof(void_f_void_t), NULL);
181 STag_surfxml_include_cb_list =
182 xbt_dynar_new(sizeof(void_f_void_t), NULL);
183 ETag_surfxml_include_cb_list =
184 xbt_dynar_new(sizeof(void_f_void_t), NULL);
187 void surf_parse_reset_callbacks(void)
189 surf_parse_free_callbacks();
190 surf_parse_init_callbacks();
193 void surf_parse_free_callbacks(void)
195 sg_platf_exit(); // FIXME: better place?
197 xbt_dynar_free(&STag_surfxml_route_cb_list);
198 xbt_dynar_free(&ETag_surfxml_route_cb_list);
199 xbt_dynar_free(&STag_surfxml_link_ctn_cb_list);
200 xbt_dynar_free(&ETag_surfxml_link_ctn_cb_list);
201 xbt_dynar_free(&STag_surfxml_process_cb_list);
202 xbt_dynar_free(&ETag_surfxml_process_cb_list);
203 xbt_dynar_free(&STag_surfxml_argument_cb_list);
204 xbt_dynar_free(&ETag_surfxml_argument_cb_list);
205 xbt_dynar_free(&STag_surfxml_prop_cb_list);
206 xbt_dynar_free(&ETag_surfxml_prop_cb_list);
207 xbt_dynar_free(&STag_surfxml_trace_cb_list);
208 xbt_dynar_free(&ETag_surfxml_trace_cb_list);
209 xbt_dynar_free(&STag_surfxml_trace_connect_cb_list);
210 xbt_dynar_free(&ETag_surfxml_trace_connect_cb_list);
211 xbt_dynar_free(&STag_surfxml_random_cb_list);
212 xbt_dynar_free(&ETag_surfxml_random_cb_list);
213 xbt_dynar_free(&STag_surfxml_ASroute_cb_list);
214 xbt_dynar_free(&ETag_surfxml_ASroute_cb_list);
215 xbt_dynar_free(&STag_surfxml_bypassRoute_cb_list);
216 xbt_dynar_free(&ETag_surfxml_bypassRoute_cb_list);
217 xbt_dynar_free(&STag_surfxml_peer_cb_list);
218 xbt_dynar_free(&ETag_surfxml_peer_cb_list);
219 xbt_dynar_free(&STag_surfxml_include_cb_list);
220 xbt_dynar_free(&ETag_surfxml_include_cb_list);
223 /* Stag and Etag parse functions */
224 void ETag_surfxml_router(void) { /* ignored -- do not add content here */ }
226 void STag_surfxml_platform(void) {
227 _XBT_GNUC_UNUSED double version = surf_parse_get_double(A_surfxml_platform_version);
229 xbt_assert((version >= 1.0), "******* BIG FAT WARNING *********\n "
230 "You're using an ancient XML file.\n"
231 "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
232 "instead of MBytes, MFlops and seconds.\n"
234 "Use simgrid_update_xml to update your file automatically. "
235 "This program is installed automatically with SimGrid, or "
236 "available in the tools/ directory of the source archive.\n"
238 "Please check also out the SURF section of the ChangeLog for "
239 "the 3.1 version for more information. \n"
241 "Last, do not forget to also update your values for "
242 "the calls to MSG_task_create (if any).");
243 xbt_assert((version >= 3.0), "******* BIG FAT WARNING *********\n "
244 "You're using an old XML file.\n"
245 "Use simgrid_update_xml to update your file automatically. "
246 "This program is installed automatically with SimGrid, or "
247 "available in the tools/ directory of the source archive.");
251 void ETag_surfxml_platform(void){
255 void STag_surfxml_host(void){
256 s_sg_platf_host_cbarg_t host;
257 memset(&host,0,sizeof(host));
259 xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
260 host.properties = current_property_set = xbt_dict_new_homogeneous(xbt_free_f);
262 host.id = A_surfxml_host_id;
263 host.power_peak = get_cpu_power(A_surfxml_host_power);
264 host.power_scale = surf_parse_get_double( A_surfxml_host_availability);
265 host.core_amount = surf_parse_get_int(A_surfxml_host_core);
266 host.power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
267 host.state_trace = tmgr_trace_new(A_surfxml_host_state_file);
268 xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
269 (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state");
270 if (A_surfxml_host_state == A_surfxml_host_state_ON)
271 host.initial_state = SURF_RESOURCE_ON;
272 if (A_surfxml_host_state == A_surfxml_host_state_OFF)
273 host.initial_state = SURF_RESOURCE_OFF;
274 host.coord = A_surfxml_host_coordinates;
276 sg_platf_new_host(&host);
278 void ETag_surfxml_host(void) {
279 current_property_set = NULL;
282 void STag_surfxml_router(void){
283 s_sg_platf_router_cbarg_t router;
284 memset(&router, 0, sizeof(router));
286 router.id = A_surfxml_router_id;
287 router.coord = A_surfxml_router_coordinates;
289 sg_platf_new_router(&router);
292 void STag_surfxml_cluster(void){
293 s_sg_platf_cluster_cbarg_t cluster;
294 memset(&cluster,0,sizeof(cluster));
295 cluster.id = A_surfxml_cluster_id;
296 cluster.prefix = A_surfxml_cluster_prefix;
297 cluster.suffix = A_surfxml_cluster_suffix;
298 cluster.radical = A_surfxml_cluster_radical;
299 cluster.power= surf_parse_get_double(A_surfxml_cluster_power);
300 cluster.core_amount = surf_parse_get_int(A_surfxml_cluster_core);
301 cluster.bw = surf_parse_get_double(A_surfxml_cluster_bw);
302 cluster.lat = surf_parse_get_double(A_surfxml_cluster_lat);
303 if(strcmp(A_surfxml_cluster_bb_bw,""))
304 cluster.bb_bw = surf_parse_get_double(A_surfxml_cluster_bb_bw);
305 if(strcmp(A_surfxml_cluster_bb_lat,""))
306 cluster.bb_lat = surf_parse_get_double(A_surfxml_cluster_bb_lat);
307 cluster.router_id = A_surfxml_cluster_router_id;
309 switch (AX_surfxml_cluster_sharing_policy) {
310 case A_surfxml_cluster_sharing_policy_SHARED:
311 cluster.sharing_policy = SURF_LINK_SHARED;
313 case A_surfxml_cluster_sharing_policy_FULLDUPLEX:
314 cluster.sharing_policy = SURF_LINK_FULLDUPLEX;
316 case A_surfxml_cluster_sharing_policy_FATPIPE:
317 cluster.sharing_policy = SURF_LINK_FATPIPE;
320 surf_parse_error(bprintf
321 ("Invalid cluster sharing policy for cluster %s",
325 switch (AX_surfxml_cluster_bb_sharing_policy) {
326 case A_surfxml_cluster_bb_sharing_policy_FATPIPE:
327 cluster.bb_sharing_policy = SURF_LINK_FATPIPE;
329 case A_surfxml_cluster_bb_sharing_policy_SHARED:
330 cluster.bb_sharing_policy = SURF_LINK_SHARED;
333 surf_parse_error(bprintf
334 ("Invalid bb sharing policy in cluster %s",
339 cluster.availability_trace = A_surfxml_cluster_availability_file;
340 cluster.state_trace = A_surfxml_cluster_state_file;
341 sg_platf_new_cluster(&cluster);
343 void ETag_surfxml_cluster(void){
344 /* nothing I can think of */
347 void STag_surfxml_peer(void){
348 s_sg_platf_peer_cbarg_t peer;
349 memset(&peer,0,sizeof(peer));
350 peer.id = A_surfxml_peer_id;
351 peer.power = surf_parse_get_double(A_surfxml_peer_power);
352 peer.bw_in = surf_parse_get_double(A_surfxml_peer_bw_in);
353 peer.bw_out = surf_parse_get_double(A_surfxml_peer_bw_out);
354 peer.lat = surf_parse_get_double(A_surfxml_peer_lat);
355 peer.coord = A_surfxml_peer_coordinates;
356 peer.availability_trace = tmgr_trace_new(A_surfxml_peer_availability_file);
357 peer.state_trace = tmgr_trace_new(A_surfxml_peer_state_file);
359 surfxml_call_cb_functions(STag_surfxml_peer_cb_list);
360 sg_platf_new_peer(&peer);
362 void ETag_surfxml_peer(void){
363 /* nothing to do here */
365 void STag_surfxml_link(void){
366 s_sg_platf_link_cbarg_t link;
367 memset(&link,0,sizeof(link));
369 xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
370 link.properties = current_property_set = xbt_dict_new_homogeneous(xbt_free_f);
372 link.id = A_surfxml_link_id;
373 link.bandwidth = surf_parse_get_double(A_surfxml_link_bandwidth);
374 link.bandwidth_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
375 link.latency = surf_parse_get_double(A_surfxml_link_latency);
376 link.latency_trace = tmgr_trace_new(A_surfxml_link_latency_file);
378 switch (A_surfxml_link_state) {
379 case A_surfxml_link_state_ON:
380 link.state = SURF_RESOURCE_ON;
382 case A_surfxml_link_state_OFF:
383 link.state = SURF_RESOURCE_OFF;
386 surf_parse_error(bprintf("invalid state for link %s",link.id));
388 link.state_trace = tmgr_trace_new(A_surfxml_link_state_file);
390 switch (A_surfxml_link_sharing_policy) {
391 case A_surfxml_link_sharing_policy_SHARED:
392 link.policy = SURF_LINK_SHARED;
394 case A_surfxml_link_sharing_policy_FATPIPE:
395 link.policy = SURF_LINK_FATPIPE;
397 case A_surfxml_link_sharing_policy_FULLDUPLEX:
398 link.policy = SURF_LINK_FULLDUPLEX;
401 surf_parse_error(bprintf("Invalid sharing policy in link %s",link.id));
404 sg_platf_new_link(&link);
406 void ETag_surfxml_link(void){
407 current_property_set = NULL;
410 void STag_surfxml_route(void){
411 surfxml_call_cb_functions(STag_surfxml_route_cb_list);
413 void STag_surfxml_link_ctn(void){
414 surfxml_call_cb_functions(STag_surfxml_link_ctn_cb_list);
416 void STag_surfxml_process(void){
417 surfxml_call_cb_functions(STag_surfxml_process_cb_list);
419 void STag_surfxml_argument(void){
420 surfxml_call_cb_functions(STag_surfxml_argument_cb_list);
422 void STag_surfxml_prop(void){
423 surfxml_call_cb_functions(STag_surfxml_prop_cb_list);
425 void STag_surfxml_trace(void){
426 surfxml_call_cb_functions(STag_surfxml_trace_cb_list);
428 void STag_surfxml_trace_connect(void){
429 surfxml_call_cb_functions(STag_surfxml_trace_connect_cb_list);
431 void STag_surfxml_AS(void){
432 sg_platf_new_AS_begin(A_surfxml_AS_id,A_surfxml_AS_routing);
434 void ETag_surfxml_AS(void){
435 sg_platf_new_AS_end();
437 void STag_surfxml_ASroute(void){
438 surfxml_call_cb_functions(STag_surfxml_ASroute_cb_list);
440 void STag_surfxml_bypassRoute(void){
441 surfxml_call_cb_functions(STag_surfxml_bypassRoute_cb_list);
443 void STag_surfxml_config(void){
444 XBT_DEBUG("START configuration name = %s",A_surfxml_config_id);
445 xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
446 current_property_set = xbt_dict_new_homogeneous(xbt_free_f);
449 void ETag_surfxml_config(void){
450 xbt_dict_cursor_t cursor = NULL;
454 xbt_dict_foreach(current_property_set, cursor, key, elem) {
455 cfg = bprintf("%s:%s",key,elem);
456 if(xbt_cfg_is_default_value(_surf_cfg_set, key))
457 xbt_cfg_set_parse(_surf_cfg_set, cfg);
459 XBT_INFO("The custom configuration '%s' is already defined by user!",key);
462 XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
463 xbt_dict_free(¤t_property_set);
465 void STag_surfxml_random(void){
466 surfxml_call_cb_functions(STag_surfxml_random_cb_list);
469 #define parse_method(type,name) \
470 void type##Tag_surfxml_##name(void) \
471 { surfxml_call_cb_functions(type##Tag_surfxml_##name##_cb_list); }
472 parse_method(E, route);
473 parse_method(E, link_ctn);
474 parse_method(E, process);
475 parse_method(E, argument);
476 parse_method(E, prop);
477 parse_method(E, trace);
478 parse_method(E, trace_connect);
479 parse_method(E, random);
480 parse_method(E, ASroute);
481 parse_method(E, bypassRoute);
483 /* Open and Close parse file */
485 void surf_parse_open(const char *file)
487 static int warned = 0; /* warn only once */
491 ("Bypassing the XML parser since surf_parse_open received a NULL pointer. "
492 "If it is not what you want, go fix your code.");
498 if (!surf_input_buffer_stack)
499 surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE), NULL);
500 if (!surf_file_to_parse_stack)
501 surf_file_to_parse_stack = xbt_dynar_new(sizeof(FILE *), NULL);
503 surf_file_to_parse = surf_fopen(file, "r");
504 xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n", file);
505 surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
506 surf_parse__switch_to_buffer(surf_input_buffer);
507 surf_parse_lineno = 1;
510 void surf_parse_close(void)
512 xbt_dynar_free(&surf_input_buffer_stack);
513 xbt_dynar_free(&surf_file_to_parse_stack);
515 if (surf_file_to_parse) {
516 surf_parse__delete_buffer(surf_input_buffer);
517 fclose(surf_file_to_parse);
518 surf_file_to_parse = NULL; //Must be reset for Bypass
522 /* Call the lexer to parse the currently opened file. This pointer to function enables bypassing of the parser */
524 static int _surf_parse(void) {
525 return surf_parse_lex();
527 int_f_void_t surf_parse = _surf_parse;
530 /* Aux parse functions */
532 void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
534 xbt_dynar_push(cb_list, &function);
537 void surfxml_del_callback(xbt_dynar_t cb_list, void_f_void_t function)
541 void_f_void_t null_f=NULL;
544 it = xbt_dynar_search(cb_list,&function);
547 if (e.category == not_found_error) {
549 xbt_die("Trying to remove a callback that is not here! This should not happen");
554 xbt_dynar_replace(cb_list, it,&null_f);
557 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
559 unsigned int iterator;
561 xbt_dynar_foreach(cb_list, iterator, fun) {
567 /* Prop tag functions */
572 void parse_properties(void)
574 if (!current_property_set)
575 current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error
577 xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), NULL);
581 /* Random tag functions */
583 double get_cpu_power(const char *power)
585 double power_scale = 0.0;
588 random_data_t random = NULL;
589 /* randomness is inserted like this: power="$rand(my_random)" */
590 if (((p = strstr(power, "$rand(")) != NULL)
591 && ((q = strstr(power, ")")) != NULL)) {
593 generator = xbt_malloc(q - (p + 6) + 1);
594 memcpy(generator, p + 6, q - (p + 6));
595 generator[q - (p + 6)] = '\0';
596 random = xbt_dict_get_or_null(random_data_list, generator);
597 xbt_assert(random, "Random generator %s undefined", generator);
598 power_scale = random_generate(random);
601 power_scale = surf_parse_get_double(power);
606 double random_min, random_max, random_mean, random_std_deviation,
610 static void init_randomness(void)
612 random_id = A_surfxml_random_id;
613 random_min = surf_parse_get_double(A_surfxml_random_min);
614 random_max = surf_parse_get_double(A_surfxml_random_max);
615 random_mean = surf_parse_get_double(A_surfxml_random_mean);
616 random_std_deviation = surf_parse_get_double(A_surfxml_random_std_deviation);
617 random_generator = A_surfxml_random_generator;
620 static void add_randomness(void)
622 /* If needed aditional properties can be added by using the prop tag */
623 random_data_t random =
624 random_new(random_generator, 0, random_min, random_max, random_mean,
625 random_std_deviation);
626 xbt_dict_set(random_data_list, random_id, (void *) random,