Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e490915eec93a2b841dd13992223fd02172e07fd
[simgrid.git] / src / instr / instr_routing.c
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include "instr/instr_private.h"
8
9 #ifdef HAVE_TRACING
10 #include "surf/surf_private.h"
11 #include "surf/network_private.h"
12
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
14
15 extern xbt_dict_t defined_types; /* from instr_interface.c */
16
17 static int platform_created = 0;            /* indicate whether the platform file has been traced */
18 static type_t rootType = NULL;              /* the root type */
19 static container_t rootContainer = NULL;    /* the root container */
20 static xbt_dynar_t currentContainer = NULL; /* push and pop, used only in creation */
21 static xbt_dict_t allContainers = NULL;     /* all created containers indexed by name */
22 xbt_dynar_t allLinkTypes = NULL;     /* all link types defined */
23 xbt_dynar_t allHostTypes = NULL;     /* all host types defined */
24
25 static void instr_routing_parse_start_AS (void);
26 static void instr_routing_parse_end_AS (void);
27 static void instr_routing_parse_start_link (void);
28 static void instr_routing_parse_end_link (void);
29 static void instr_routing_parse_start_host (void);
30 static void instr_routing_parse_end_host (void);
31 static void instr_routing_parse_start_router (void);
32 static void instr_routing_parse_end_router (void);
33 static void instr_routing_parse_end_platform (void);
34
35 static long long int newTypeId ()
36 {
37   static long long int counter = 0;
38   return counter++;
39 }
40
41 static type_t newType (const char *typename, e_entity_types kind, type_t father)
42 {
43   type_t ret = xbt_new0(s_type_t, 1);
44   ret->name = xbt_strdup (typename);
45   ret->father = father;
46   ret->kind = kind;
47   ret->children = xbt_dict_new ();
48
49   long long int id = newTypeId();
50   char str_id[INSTR_DEFAULT_STR_SIZE];
51   snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", id);
52   ret->id = xbt_strdup (str_id);
53
54   if (father != NULL){
55     xbt_dict_set (father->children, typename, ret, NULL);
56   }
57   return ret;
58 }
59
60 type_t newContainerType (const char *typename, e_entity_types kind, type_t father)
61 {
62   type_t ret = newType (typename, kind, father);
63 //  if (father) INFO4("ContainerType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
64   if (father) pajeDefineContainerType(ret->id, ret->father->id, ret->name);
65   return ret;
66 }
67
68 type_t newEventType (const char *typename, e_entity_types kind, const char *color, type_t father)
69 {
70   type_t ret = newType (typename, kind, father);
71 //  INFO4("EventType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
72   if (color){
73     pajeDefineEventTypeWithColor (ret->id, ret->father->id, ret->name, color);
74   }else{
75     pajeDefineEventType(ret->id, ret->father->id, ret->name);
76   }
77   return ret;
78 }
79
80 type_t newVariableType (const char *typename, e_entity_types kind, const char *color, type_t father)
81 {
82   type_t ret = newType (typename, kind, father);
83 //  INFO4("VariableType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
84   if (color){
85     pajeDefineVariableTypeWithColor(ret->id, ret->father->id, ret->name, color);
86   }else{
87     pajeDefineVariableType(ret->id, ret->father->id, ret->name);
88   }
89   return ret;
90 }
91
92 type_t newLinkType (const char *typename, e_entity_types kind, type_t father, type_t source, type_t dest)
93 {
94   type_t ret = newType (typename, kind, father);
95 //  INFO8("LinkType %s(%s), child of %s(%s)  %s(%s)->%s(%s)", ret->name, ret->id, father->name, father->id, source->name, source->id, dest->name, dest->id);
96   pajeDefineLinkType(ret->id, ret->father->id, source->id, dest->id, ret->name);
97   return ret;
98 }
99
100 type_t newStateType (const char *typename, e_entity_types kind, type_t father)
101 {
102   type_t ret = newType (typename, kind, father);
103 //  INFO4("StateType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
104   pajeDefineStateType(ret->id, ret->father->id, ret->name);
105   return ret;
106 }
107
108 static type_t getContainerType (const char *typename, type_t father)
109 {
110   type_t ret;
111   if (father == NULL){
112     ret = newContainerType (typename, TYPE_CONTAINER, father);
113     rootType = ret;
114   }else{
115     //check if my father type already has my typename
116     ret = (type_t)xbt_dict_get_or_null (father->children, typename);
117     if (ret == NULL){
118       ret = newContainerType (typename, TYPE_CONTAINER, father);
119     }
120   }
121   return ret;
122 }
123
124 static type_t getEventType (const char *typename, const char *color, type_t father)
125 {
126   type_t ret = xbt_dict_get_or_null (father->children, typename);
127   if (ret == NULL){
128     ret = newEventType (typename, TYPE_EVENT, color, father);
129   }
130   return ret;
131 }
132
133 static type_t getVariableType (const char *typename, const char *color, type_t father)
134 {
135   type_t ret = xbt_dict_get_or_null (father->children, typename);
136   if (ret == NULL){
137     ret = newVariableType (typename, TYPE_VARIABLE, color, father);
138   }
139   return ret;
140 }
141
142 static type_t getLinkType (const char *typename, type_t father, type_t source, type_t dest)
143 {
144   type_t ret = xbt_dict_get_or_null (father->children, typename);
145   if (ret == NULL){
146     ret = newLinkType (typename, TYPE_LINK, father, source, dest);
147   }
148   return ret;
149 }
150
151 static type_t getStateType (const char *typename, type_t father)
152 {
153   type_t ret = xbt_dict_get_or_null (father->children, typename);
154   if (ret == NULL){
155     ret = newStateType (typename, TYPE_STATE, father);
156   }
157   return ret;
158 }
159
160 void instr_routing_define_callbacks ()
161 {
162   if (!TRACE_is_active())
163     return;
164   surfxml_add_callback(STag_surfxml_AS_cb_list, &instr_routing_parse_start_AS);
165   surfxml_add_callback(ETag_surfxml_AS_cb_list, &instr_routing_parse_end_AS);
166   surfxml_add_callback(STag_surfxml_link_cb_list, &instr_routing_parse_start_link);
167   surfxml_add_callback(ETag_surfxml_link_cb_list, &instr_routing_parse_end_link);
168   surfxml_add_callback(STag_surfxml_host_cb_list, &instr_routing_parse_start_host);
169   surfxml_add_callback(ETag_surfxml_host_cb_list, &instr_routing_parse_end_host);
170   surfxml_add_callback(STag_surfxml_router_cb_list, &instr_routing_parse_start_router);
171   surfxml_add_callback(ETag_surfxml_router_cb_list, &instr_routing_parse_end_router);
172   surfxml_add_callback(ETag_surfxml_platform_cb_list, &instr_routing_parse_end_platform);
173 }
174
175 static long long int newContainedId ()
176 {
177   static long long counter = 0;
178   return counter++;
179 }
180
181 container_t newContainer (const char *name, e_container_types kind, container_t father)
182 {
183   long long int counter = newContainedId();
184   char id_str[INSTR_DEFAULT_STR_SIZE];
185   snprintf (id_str, INSTR_DEFAULT_STR_SIZE, "%lld", counter);
186
187   container_t new = xbt_new0(s_container_t, 1);
188   new->name = xbt_strdup (name); // name of the container
189   new->id = xbt_strdup (id_str); // id (or alias) of the container
190   new->father = father;
191   // level depends on level of father
192   if (new->father){
193     new->level = new->father->level+1;
194   }else{
195     new->level = 0;
196   }
197   // type definition (method depends on kind of this new container)
198   new->kind = kind;
199   if (new->kind == INSTR_AS){
200     //if this container is of an AS, its type name depends on its level
201     char as_typename[INSTR_DEFAULT_STR_SIZE];
202     snprintf (as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", new->level);
203     if (new->father){
204       new->type = getContainerType (as_typename, new->father->type);
205     }else{
206       new->type = getContainerType ("0", NULL);
207     }
208   }else{
209     //otherwise, the name is its kind
210     switch (new->kind){
211       case INSTR_HOST: new->type = getContainerType ("HOST", new->father->type); break;
212       case INSTR_LINK: new->type = getContainerType ("LINK", new->father->type); break;
213       case INSTR_ROUTER: new->type = getContainerType ("ROUTER", new->father->type); break;
214       case INSTR_SMPI: new->type = getContainerType ("MPI", new->father->type); break;
215       case INSTR_MSG_PROCESS: new->type = getContainerType ("MSG_PROCESS", new->father->type); break;
216       case INSTR_MSG_TASK: new->type = getContainerType ("MSG_TASK", new->father->type); break;
217       default: xbt_die ("Congratulations, you have found a bug on newContainer function of instr_routing.c"); break;
218     }
219   }
220   new->children = xbt_dict_new();
221   if (new->father){
222     xbt_dict_set(new->father->children, new->name, new, NULL);
223     pajeCreateContainer (SIMIX_get_clock(), new->id, new->type->id, new->father->id, new->name);
224   }
225
226   //register hosts, routers, links containers
227   if (new->kind == INSTR_HOST || new->kind == INSTR_LINK || new->kind == INSTR_ROUTER) {
228     xbt_dict_set (allContainers, new->name, new, NULL);
229   }
230
231   //register the host container types
232   if (new->kind == INSTR_HOST){
233     xbt_dynar_push_as (allHostTypes, type_t, new->type);
234   }
235
236   //register the link container types
237   if (new->kind == INSTR_LINK){
238     xbt_dynar_push_as(allLinkTypes, type_t, new->type);
239   }
240   return new;
241 }
242
243 static container_t recursiveGetContainer (const char *name, container_t root)
244 {
245   if (strcmp (root->name, name) == 0) return root;
246
247   xbt_dict_cursor_t cursor = NULL;
248   container_t child;
249   char *child_name;
250   xbt_dict_foreach(root->children, cursor, child_name, child) {
251     container_t ret = recursiveGetContainer(name, child);
252     if (ret) return ret;
253   }
254   return NULL;
255 }
256
257 container_t getContainer (const char *name)
258 {
259   return recursiveGetContainer(name, rootContainer);
260 }
261
262 static type_t recursiveGetType (const char *name, type_t root)
263 {
264   if (strcmp (root->name, name) == 0) return root;
265
266   xbt_dict_cursor_t cursor = NULL;
267   type_t child;
268   char *child_name;
269   xbt_dict_foreach(root->children, cursor, child_name, child) {
270     type_t ret = recursiveGetType(name, child);
271     if (ret) return ret;
272   }
273   return NULL;
274 }
275
276 type_t getType (const char *name)
277 {
278   return recursiveGetType (name, rootType);
279 }
280
281 void destroyContainer (container_t container)
282 {
283   //remove me from my father
284   if (container->father){
285     xbt_dict_remove(container->father->children, container->name);
286   }
287
288   //trace my destruction
289   pajeDestroyContainer(SIMIX_get_clock(), container->type->id, container->id);
290
291   //free
292   xbt_free (container->name);
293   xbt_free (container->id);
294   xbt_free (container->children);
295   xbt_free (container);
296   container = NULL;
297 }
298
299 static container_t findChild (container_t root, container_t a1)
300 {
301   if (root == a1) return root;
302
303   xbt_dict_cursor_t cursor = NULL;
304   container_t child;
305   char *child_name;
306   xbt_dict_foreach(root->children, cursor, child_name, child) {
307     if (findChild (child, a1)) return child;
308   }
309   return NULL;
310 }
311
312 static container_t findCommonFather (container_t root, container_t a1, container_t a2)
313 {
314   if (a1->father == a2->father) return a1->father;
315
316   xbt_dict_cursor_t cursor = NULL;
317   container_t child;
318   char *child_name;
319   container_t a1_try = NULL;
320   container_t a2_try = NULL;
321   xbt_dict_foreach(root->children, cursor, child_name, child) {
322     a1_try = findChild (child, a1);
323     a2_try = findChild (child, a2);
324     if (a1_try && a2_try) return child;
325   }
326   return NULL;
327 }
328
329 static void linkContainers (const char *a1, const char *a2)
330 {
331   //ignore loopback
332   if (strcmp (a1, "__loopback__") == 0 || strcmp (a2, "__loopback__") == 0)
333     return;
334
335   container_t a1_container = ((container_t)xbt_dict_get (allContainers, a1));
336   type_t a1_type = a1_container->type;
337
338   container_t a2_container = ((container_t)xbt_dict_get (allContainers, a2));
339   type_t a2_type = a2_container->type;
340
341   container_t container = findCommonFather (rootContainer, a1_container, a2_container);
342   xbt_assert0 (container != NULL, "common father not found");
343
344   //declare type
345   char link_typename[INSTR_DEFAULT_STR_SIZE];
346   snprintf (link_typename, INSTR_DEFAULT_STR_SIZE, "%s-%s", a1_type->name, a2_type->name);
347   type_t link_type = getLinkType (link_typename, container->type, a1_type, a2_type);
348
349   //create the link
350   static long long counter = 0;
351   char key[INSTR_DEFAULT_STR_SIZE];
352   snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", counter++);
353   pajeStartLink(SIMIX_get_clock(), link_type->id, container->id, "G", a1_container->id, key);
354   pajeEndLink(SIMIX_get_clock(), link_type->id, container->id, "G", a2_container->id, key);
355 }
356
357 static void recursiveGraphExtraction (container_t container)
358 {
359   if (xbt_dict_length(container->children)){
360     xbt_dict_cursor_t cursor = NULL;
361     container_t child;
362     char *child_name;
363     //bottom-up recursion
364     xbt_dict_foreach(container->children, cursor, child_name, child) {
365       recursiveGraphExtraction (child);
366     }
367
368     //let's get routes
369     xbt_dict_cursor_t cursor1 = NULL, cursor2 = NULL;
370     container_t child1, child2;
371     const char *child_name1, *child_name2;
372
373     xbt_dict_t filter = xbt_dict_new ();
374
375     xbt_dict_foreach(container->children, cursor1, child_name1, child1) {
376       xbt_dict_foreach(container->children, cursor2, child_name2, child2) {
377         //check if we already register this pair (we only need one direction)
378         char aux1[INSTR_DEFAULT_STR_SIZE], aux2[INSTR_DEFAULT_STR_SIZE];
379         snprintf (aux1, INSTR_DEFAULT_STR_SIZE, "%s%s", child_name1, child_name2);
380         snprintf (aux2, INSTR_DEFAULT_STR_SIZE, "%s%s", child_name2, child_name1);
381         if (xbt_dict_get_or_null (filter, aux1)) continue;
382         if (xbt_dict_get_or_null (filter, aux2)) continue;
383
384         //ok, not found, register it
385         xbt_dict_set (filter, aux1, xbt_strdup ("1"), xbt_free);
386         xbt_dict_set (filter, aux2, xbt_strdup ("1"), xbt_free);
387
388         if ((child1->kind == INSTR_HOST || child1->kind == INSTR_ROUTER) &&
389             (child2->kind == INSTR_HOST  || child2->kind == INSTR_ROUTER)){
390
391           //getting route
392           xbt_dynar_t route = NULL;
393           xbt_ex_t exception;
394           TRY {
395             route = global_routing->get_route (child_name1, child_name2);
396           }CATCH(exception) {
397             //no route between them, that's possible
398             continue;
399           }
400
401           //link the route members
402           unsigned int cpt;
403           void *link;
404           char *previous_entity_name = (char*)child_name1;
405           xbt_dynar_foreach (route, cpt, link) {
406             char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
407             linkContainers (previous_entity_name, link_name);
408             previous_entity_name = link_name;
409           }
410           linkContainers (previous_entity_name, child_name2);
411         }else if (child1->kind == INSTR_AS &&
412                   child2->kind == INSTR_AS &&
413                   strcmp(child_name1, child_name2) != 0){
414
415           //getting route
416           routing_component_t root = global_routing->root;
417           route_extended_t route = NULL;
418           xbt_ex_t exception;
419           TRY {
420             route = root->get_route (root, child_name1, child_name2);
421           }CATCH(exception) {
422             //no route between them, that's possible
423             continue;
424           }
425           xbt_assert2(route!=NULL,
426               "there is no ASroute between %s and %s", child_name1, child_name2);
427           unsigned int cpt;
428           void *link;
429           char *previous_entity_name = route->src_gateway;
430           xbt_dynar_foreach (route->generic_route.link_list, cpt, link) {
431             char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
432             linkContainers (previous_entity_name, link_name);
433             previous_entity_name = link_name;
434           }
435           linkContainers (previous_entity_name, route->dst_gateway);
436         }
437       }
438     }
439     xbt_dict_free(&filter);
440   }
441 }
442
443 /*
444  * Callbacks
445  */
446 static void instr_routing_parse_start_AS ()
447 {
448   if (rootContainer == NULL){
449     currentContainer = xbt_dynar_new (sizeof(container_t), NULL);
450     allContainers = xbt_dict_new ();
451     allLinkTypes = xbt_dynar_new (sizeof(s_type_t), NULL);
452     allHostTypes = xbt_dynar_new (sizeof(s_type_t), NULL);
453
454     rootContainer = newContainer ("0", INSTR_AS, NULL);
455     xbt_dynar_push (currentContainer, &rootContainer);
456
457     if (TRACE_smpi_is_enabled()) {
458       if (!TRACE_smpi_is_grouped()){
459         container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
460         type_t mpi = getContainerType("MPI", father->type);
461         getStateType ("MPI_STATE", mpi);
462         getLinkType ("MPI_LINK", rootType, mpi, mpi);
463       }
464     }
465   }
466   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
467   container_t new = newContainer (A_surfxml_AS_id, INSTR_AS, father);
468
469   //push
470   xbt_dynar_push (currentContainer, &new);
471 }
472
473 static void instr_routing_parse_end_AS ()
474 {
475   xbt_dynar_pop_ptr (currentContainer);
476 }
477
478 static void instr_routing_parse_start_link ()
479 {
480   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
481   container_t new = newContainer (A_surfxml_link_id, INSTR_LINK, father);
482
483   type_t bandwidth = getVariableType ("bandwidth", NULL, new->type);
484   type_t latency = getVariableType ("latency", NULL, new->type);
485   pajeSetVariable (0, bandwidth->id, new->id, A_surfxml_link_bandwidth);
486   pajeSetVariable (0, latency->id, new->id, A_surfxml_link_latency);
487   if (TRACE_uncategorized()){
488     getVariableType ("bandwidth_used", "0.5 0.5 0.5", new->type);
489   }
490 }
491
492 static void instr_routing_parse_end_link ()
493 {
494 }
495
496 static void instr_routing_parse_start_host ()
497 {
498   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
499   container_t new = newContainer (A_surfxml_host_id, INSTR_HOST, father);
500
501   type_t power = getVariableType ("power", NULL, new->type);
502   pajeSetVariable (0, power->id, new->id, A_surfxml_host_power);
503   if (TRACE_uncategorized()){
504     getVariableType ("power_used", "0.5 0.5 0.5", new->type);
505   }
506
507   if (TRACE_smpi_is_enabled()) {
508     if (TRACE_smpi_is_grouped()){
509       type_t mpi = getContainerType("MPI", new->type);
510       getStateType ("MPI_STATE", mpi);
511       getLinkType ("MPI_LINK", rootType, mpi, mpi);
512     }
513   }
514
515   if (TRACE_msg_process_is_enabled()) {
516     type_t msg_process = getContainerType("MSG_PROCESS", new->type);
517     getStateType ("MSG_PROCESS_STATE", msg_process);
518     getLinkType ("MSG_PROCESS_LINK", rootType, msg_process, msg_process);
519   }
520
521   if (TRACE_msg_task_is_enabled()) {
522     type_t msg_task = getContainerType ("MSG_TASK", new->type);
523     getStateType ("MSG_TASK_STATE", msg_task);
524     getLinkType ("MSG_TASK_LINK", rootType, msg_task, msg_task);
525   }
526 }
527
528 static void instr_routing_parse_end_host ()
529 {
530 }
531
532 static void instr_routing_parse_start_router ()
533 {
534   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
535   newContainer (A_surfxml_router_id, INSTR_ROUTER, father);
536 }
537
538 static void instr_routing_parse_end_router ()
539 {
540 }
541
542 static void instr_routing_parse_end_platform ()
543 {
544   xbt_dynar_free(&currentContainer);
545   currentContainer = NULL;
546   recursiveGraphExtraction (rootContainer);
547   platform_created = 1;
548 }
549
550 /*
551  * Support functions
552  */
553 int instr_link_is_traced (const char *name)
554 {
555   if (((container_t)xbt_dict_get_or_null (allContainers, name))){
556     return 1;
557   } else {
558     return 0;
559   }
560 }
561
562 char *instr_variable_type (const char *name, const char *resource)
563 {
564   container_t container = (container_t)xbt_dict_get (allContainers, resource);
565   xbt_dict_cursor_t cursor = NULL;
566   type_t type;
567   char *type_name;
568   xbt_dict_foreach(container->type->children, cursor, type_name, type) {
569     if (strcmp (name, type->name) == 0) return type->id;
570   }
571   return NULL;
572 }
573
574 char *instr_resource_type (const char *resource_name)
575 {
576   return ((container_t)xbt_dict_get_or_null (allContainers, resource_name))->id;
577 }
578
579 static void recursiveDestroyContainer (container_t container)
580 {
581   xbt_dict_cursor_t cursor = NULL;
582   container_t child;
583   char *child_name;
584   xbt_dict_foreach(container->children, cursor, child_name, child) {
585     recursiveDestroyContainer (child);
586   }
587   destroyContainer (container);
588 }
589
590 static void recursiveDestroyType (type_t type)
591 {
592   xbt_dict_cursor_t cursor = NULL;
593   type_t child;
594   char *child_name;
595   xbt_dict_foreach(type->children, cursor, child_name, child) {
596     recursiveDestroyType (child);
597   }
598   xbt_free (type->name);
599   xbt_free (type->id);
600   xbt_free (type->children);
601   xbt_free (type);
602   type = NULL;
603 }
604
605 void instr_destroy_platform ()
606 {
607   if (rootContainer) recursiveDestroyContainer (rootContainer);
608   if (rootType) recursiveDestroyType (rootType);
609 }
610
611 /*
612  * user categories support
613  */
614 static void recursiveNewUserVariableType (const char *new_typename, const char *color, type_t root)
615 {
616   if (!strcmp (root->name, "HOST") || !strcmp (root->name, "LINK")){
617     getVariableType(new_typename, color, root);
618   }
619   xbt_dict_cursor_t cursor = NULL;
620   type_t child_type;
621   char *name;
622   xbt_dict_foreach(root->children, cursor, name, child_type) {
623     recursiveNewUserVariableType (new_typename, color, child_type);
624   }
625 }
626
627 void instr_new_user_variable_type (const char *new_typename, const char *color)
628 {
629   recursiveNewUserVariableType (new_typename, color, rootType);
630 }
631
632 static void recursiveNewUserLinkVariableType (const char *new_typename, const char *color, type_t root)
633 {
634   if (!strcmp (root->name, "LINK")){
635     getVariableType(new_typename, color, root);
636   }
637   xbt_dict_cursor_t cursor = NULL;
638   type_t child_type;
639   char *name;
640   xbt_dict_foreach(root->children, cursor, name, child_type) {
641     recursiveNewUserLinkVariableType (new_typename, color, child_type);
642   }
643 }
644
645 void instr_new_user_link_variable_type  (const char *new_typename, const char *color)
646 {
647   recursiveNewUserLinkVariableType (new_typename, color, rootType);
648 }
649
650
651 static void recursiveNewUserHostVariableType (const char *new_typename, const char *color, type_t root)
652 {
653   if (!strcmp (root->name, "HOST")){
654     getVariableType(new_typename, color, root);
655   }
656   xbt_dict_cursor_t cursor = NULL;
657   type_t child_type;
658   char *name;
659   xbt_dict_foreach(root->children, cursor, name, child_type) {
660     recursiveNewUserHostVariableType (new_typename, color, child_type);
661   }
662 }
663
664 void instr_new_user_host_variable_type  (const char *new_typename, const char *color)
665 {
666   recursiveNewUserHostVariableType (new_typename, color, rootType);
667 }
668
669 int instr_platform_traced ()
670 {
671   return platform_created;
672 }
673
674 #endif /* HAVE_TRACING */
675