Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] remove version, otherwise we'll have to updates tesh'es at every release
[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 #include "xbt/graph.h"
13
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
15
16 extern xbt_dict_t defined_types; /* from instr_interface.c */
17
18 static int platform_created = 0;            /* indicate whether the platform file has been traced */
19 static xbt_dynar_t currentContainer = NULL; /* push and pop, used only in creation */
20
21 static const char *instr_node_name (xbt_node_t node)
22 {
23   void *data = xbt_graph_node_get_data(node);
24   char *str = (char*)data;
25   return str;
26 }
27
28
29 static container_t lowestCommonAncestor (container_t a1, container_t a2)
30 {
31   //this is only an optimization (since most of a1 and a2 share the same parent)
32   if (a1->father == a2->father) return a1->father;
33
34   //create an array with all ancestors of a1
35   xbt_dynar_t ancestors_a1 = xbt_dynar_new(sizeof(container_t), NULL);
36   container_t p;
37   p = a1->father;
38   while (p){
39     xbt_dynar_push_as (ancestors_a1, container_t, p);
40     p = p->father;
41   }
42
43   //create an array with all ancestors of a2
44   xbt_dynar_t ancestors_a2 = xbt_dynar_new(sizeof(container_t), NULL);
45   p = a2->father;
46   while (p){
47     xbt_dynar_push_as (ancestors_a2, container_t, p);
48     p = p->father;
49   }
50
51   //find the lowest ancestor
52   p = NULL;
53   int i = xbt_dynar_length (ancestors_a1) - 1;
54   int j = xbt_dynar_length (ancestors_a2) - 1;
55   while (i >= 0 && j >= 0){
56     container_t a1p = *(container_t*)xbt_dynar_get_ptr (ancestors_a1, i);
57     container_t a2p = *(container_t*)xbt_dynar_get_ptr (ancestors_a2, j);
58     if (a1p == a2p){
59       p = a1p;
60     }else{
61       break;
62     }
63     i--;
64     j--;
65   }
66   xbt_dynar_free (&ancestors_a1);
67   xbt_dynar_free (&ancestors_a2);
68   return p;
69 }
70
71 static void linkContainers (container_t src, container_t dst, xbt_dict_t filter)
72 {
73   //ignore loopback
74   if (strcmp (src->name, "__loopback__") == 0 || strcmp (dst->name, "__loopback__") == 0)
75     return;
76
77   //find common father
78   container_t father = lowestCommonAncestor (src, dst);
79   if (!father){
80     xbt_die ("common father unknown, this is a tracing problem");
81   }
82
83   if (filter != NULL){
84     //check if we already register this pair (we only need one direction)
85     char aux1[INSTR_DEFAULT_STR_SIZE], aux2[INSTR_DEFAULT_STR_SIZE];
86     snprintf (aux1, INSTR_DEFAULT_STR_SIZE, "%s%s", src->name, dst->name);
87     snprintf (aux2, INSTR_DEFAULT_STR_SIZE, "%s%s", dst->name, src->name);
88     if (xbt_dict_get_or_null (filter, aux1)) return;
89     if (xbt_dict_get_or_null (filter, aux2)) return;
90
91     //ok, not found, register it
92     xbt_dict_set (filter, aux1, xbt_strdup ("1"), NULL);
93     xbt_dict_set (filter, aux2, xbt_strdup ("1"), NULL);
94   }
95
96   //declare type
97   char link_typename[INSTR_DEFAULT_STR_SIZE];
98   snprintf (link_typename, INSTR_DEFAULT_STR_SIZE, "%s-%s%s-%s%s",
99             father->type->name,
100             src->type->name, src->type->id,
101             dst->type->name, dst->type->id);
102   type_t link_type = PJ_type_get_or_null (link_typename, father->type);
103   if (link_type == NULL){
104     link_type = PJ_type_link_new (link_typename, father->type, src->type, dst->type);
105   }
106
107   //register EDGE types for triva configuration
108   xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), NULL);
109
110   //create the link
111   static long long counter = 0;
112   char key[INSTR_DEFAULT_STR_SIZE];
113   snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", counter++);
114   new_pajeStartLink(SIMIX_get_clock(), father, link_type, src, "G", key);
115   new_pajeEndLink(SIMIX_get_clock(), father, link_type, dst, "G", key);
116 }
117
118 static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t filter)
119 {
120   if (!xbt_dict_is_empty(rc->routing_sons)){
121     xbt_dict_cursor_t cursor = NULL;
122     AS_t rc_son;
123     char *child_name;
124     //bottom-up recursion
125     xbt_dict_foreach(rc->routing_sons, cursor, child_name, rc_son) {
126       container_t child_container = xbt_dict_get (container->children, rc_son->name);
127       recursiveGraphExtraction (rc_son, child_container, filter);
128     }
129   }
130
131   //let's get routes
132   xbt_dict_cursor_t cursor1 = NULL, cursor2 = NULL;
133   container_t child1, child2;
134   const char *child1_name, *child2_name;
135   xbt_dict_foreach(container->children, cursor1, child1_name, child1) {
136     //if child1 is not a link, a smpi node, a msg process or a msg task
137     if (child1->kind == INSTR_LINK || child1->kind == INSTR_SMPI || child1->kind == INSTR_MSG_PROCESS || child1->kind == INSTR_MSG_TASK) continue;
138
139     xbt_dict_foreach(container->children, cursor2, child2_name, child2) {
140       //if child2 is not a link, a smpi node, a msg process or a msg task
141       if (child2->kind == INSTR_LINK || child2->kind == INSTR_SMPI || child2->kind == INSTR_MSG_PROCESS || child2->kind == INSTR_MSG_TASK) continue;
142
143       //if child1 is not child2
144       if (strcmp (child1_name, child2_name) == 0) continue;
145
146       //get the route
147       sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
148       route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
149       rc->get_route_and_latency(rc, child1->net_elm, child2->net_elm,
150                                 route, NULL);
151
152       //user might want to extract a graph using routes with only one link
153       //see --cfg=tracing/onelink_only:1 or --help-tracing for details
154       if (TRACE_onelink_only() && xbt_dynar_length (route->link_list) > 1){
155         generic_free_route(route);
156         continue;
157       }
158
159       //traverse the route connecting the containers
160       unsigned int cpt;
161       void *link;
162       container_t current, previous;
163       if (route->gw_src){
164         previous = PJ_container_get(route->gw_src->name);
165       }else{
166         previous = child1;
167       }
168
169       xbt_dynar_foreach (route->link_list, cpt, link) {
170         char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
171         current = PJ_container_get(link_name);
172         linkContainers(previous, current, filter);
173         previous = current;
174       }
175       if (route->gw_dst){
176         current = PJ_container_get(route->gw_dst->name);
177       }else{
178         current = child2;
179       }
180       linkContainers(previous, current, filter);
181       generic_free_route(route);
182     }
183   }
184 }
185
186 /*
187  * Callbacks
188  */
189 static void instr_routing_parse_start_AS (sg_platf_AS_cbarg_t AS)
190 {
191   const char*id = AS->id;
192
193   if (PJ_container_get_root() == NULL){
194     PJ_container_alloc ();
195     PJ_type_alloc();
196     container_t root = PJ_container_new (id, INSTR_AS, NULL);
197     PJ_container_set_root (root);
198
199     if (TRACE_smpi_is_enabled()) {
200       if (!TRACE_smpi_is_grouped()){
201         type_t mpi = PJ_type_get_or_null ("MPI", root->type);
202         if (mpi == NULL){
203           mpi = PJ_type_container_new("MPI", root->type);
204           PJ_type_state_new ("MPI_STATE", mpi);
205           PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
206         }
207       }
208     }
209
210     if (TRACE_needs_platform()){
211       currentContainer = xbt_dynar_new (sizeof(container_t), NULL);
212       xbt_dynar_push (currentContainer, &root);
213     }
214     return;
215   }
216
217   if (TRACE_needs_platform()){
218     container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
219     container_t new = PJ_container_new (id, INSTR_AS, father);
220     xbt_dynar_push (currentContainer, &new);
221   }
222 }
223
224 static void instr_routing_parse_end_AS ()
225 {
226   if (TRACE_needs_platform()){
227     xbt_dynar_pop_ptr (currentContainer);
228   }
229 }
230
231 static void instr_routing_parse_start_link (sg_platf_link_cbarg_t link)
232 {
233   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
234
235   double bandwidth_value = link->bandwidth;
236   double latency_value = link->latency;
237   xbt_dynar_t links_to_create = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
238
239   if (link->policy == SURF_LINK_FULLDUPLEX){
240     char *up = bprintf("%s_UP", link->id);
241     char *down = bprintf("%s_DOWN", link->id);
242     xbt_dynar_push_as (links_to_create, char*, xbt_strdup(up));
243     xbt_dynar_push_as (links_to_create, char*, xbt_strdup(down));
244     free (up);
245     free (down);
246   }else{
247     xbt_dynar_push_as (links_to_create, char*, strdup(link->id));
248   }
249
250   char *link_name = NULL;
251   unsigned int i;
252   xbt_dynar_foreach (links_to_create, i, link_name){
253
254     container_t new = PJ_container_new (link_name, INSTR_LINK, father);
255
256     if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()){
257       type_t bandwidth = PJ_type_get_or_null ("bandwidth", new->type);
258       if (bandwidth == NULL){
259         bandwidth = PJ_type_variable_new ("bandwidth", NULL, new->type);
260       }
261       type_t latency = PJ_type_get_or_null ("latency", new->type);
262       if (latency == NULL){
263         latency = PJ_type_variable_new ("latency", NULL, new->type);
264       }
265       new_pajeSetVariable (0, new, bandwidth, bandwidth_value);
266       new_pajeSetVariable (0, new, latency, latency_value);
267     }
268     if (TRACE_uncategorized()){
269       type_t bandwidth_used = PJ_type_get_or_null ("bandwidth_used", new->type);
270       if (bandwidth_used == NULL){
271         bandwidth_used = PJ_type_variable_new ("bandwidth_used", "0.5 0.5 0.5", new->type);
272       }
273     }
274   }
275
276   xbt_dynar_free (&links_to_create);
277 }
278
279 static void instr_routing_parse_start_host (sg_platf_host_cbarg_t host)
280 {
281   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
282   container_t new = PJ_container_new (host->id, INSTR_HOST, father);
283
284   if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) {
285     type_t power = PJ_type_get_or_null ("power", new->type);
286     if (power == NULL){
287       power = PJ_type_variable_new ("power", NULL, new->type);
288     }
289     new_pajeSetVariable (0, new, power, host->power_peak);
290   }
291   if (TRACE_uncategorized()){
292     type_t power_used = PJ_type_get_or_null ("power_used", new->type);
293     if (power_used == NULL){
294       power_used = PJ_type_variable_new ("power_used", "0.5 0.5 0.5", new->type);
295     }
296   }
297
298   if (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()){
299     type_t mpi = PJ_type_get_or_null ("MPI", new->type);
300     if (mpi == NULL){
301       mpi = PJ_type_container_new("MPI", new->type);
302       PJ_type_state_new ("MPI_STATE", mpi);
303       PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
304     }
305   }
306
307   if (TRACE_msg_process_is_enabled()) {
308     type_t msg_process = PJ_type_get_or_null ("MSG_PROCESS", new->type);
309     if (msg_process == NULL){
310       msg_process = PJ_type_container_new("MSG_PROCESS", new->type);
311       type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
312       PJ_value_new ("suspend", "1 0 1", state);
313       PJ_value_new ("sleep", "1 1 0", state);
314       PJ_value_new ("receive", "1 0 0", state);
315       PJ_value_new ("send", "0 0 1", state);
316       PJ_value_new ("task_execute", "0 1 1", state);
317       PJ_type_link_new ("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process);
318       PJ_type_link_new ("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process);
319     }
320   }
321 }
322
323 static void instr_routing_parse_start_router (sg_platf_router_cbarg_t router)
324 {
325   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
326   PJ_container_new (router->id, INSTR_ROUTER, father);
327 }
328
329 static void instr_routing_parse_end_platform ()
330 {
331   xbt_dynar_free(&currentContainer);
332   currentContainer = NULL;
333   xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free);
334   recursiveGraphExtraction (routing_platf->root, PJ_container_get_root(), filter);
335   xbt_dict_free(&filter);
336   platform_created = 1;
337   TRACE_paje_dump_buffer(1);
338 }
339
340 void instr_routing_define_callbacks ()
341 {
342   if (!TRACE_is_enabled()) return;
343   //always need the call backs to ASes (we need only the root AS),
344   //to create the rootContainer and the rootType properly
345   sg_platf_AS_begin_add_cb(instr_routing_parse_start_AS);
346   sg_platf_AS_end_add_cb(instr_routing_parse_end_AS);
347   if (!TRACE_needs_platform()) return;
348   sg_platf_link_add_cb(instr_routing_parse_start_link);
349   sg_platf_host_add_cb(instr_routing_parse_start_host);
350   sg_platf_router_add_cb(instr_routing_parse_start_router);
351
352   sg_platf_postparse_add_cb(instr_routing_parse_end_platform);
353 }
354
355 /*
356  * user categories support
357  */
358 static void recursiveNewVariableType (const char *new_typename, const char *color, type_t root)
359 {
360   if (!strcmp (root->name, "HOST")){
361     char tnstr[INSTR_DEFAULT_STR_SIZE];
362     snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename);
363     PJ_type_variable_new (tnstr, color, root);
364   }
365   if (!strcmp (root->name, "LINK")){
366     char tnstr[INSTR_DEFAULT_STR_SIZE];
367     snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename);
368     PJ_type_variable_new (tnstr, color, root);
369   }
370   xbt_dict_cursor_t cursor = NULL;
371   type_t child_type;
372   char *name;
373   xbt_dict_foreach(root->children, cursor, name, child_type) {
374     recursiveNewVariableType (new_typename, color, child_type);
375   }
376 }
377
378 void instr_new_variable_type (const char *new_typename, const char *color)
379 {
380   recursiveNewVariableType (new_typename, color, PJ_type_get_root());
381 }
382
383 static void recursiveNewUserVariableType (const char *father_type, const char *new_typename, const char *color, type_t root)
384 {
385   if (!strcmp (root->name, father_type)){
386     PJ_type_variable_new (new_typename, color, root);
387   }
388   xbt_dict_cursor_t cursor = NULL;
389   type_t child_type;
390   char *name;
391   xbt_dict_foreach(root->children, cursor, name, child_type) {
392     recursiveNewUserVariableType (father_type, new_typename, color, child_type);
393   }
394 }
395
396 void instr_new_user_variable_type  (const char *father_type, const char *new_typename, const char *color)
397 {
398   recursiveNewUserVariableType (father_type, new_typename, color, PJ_type_get_root());
399 }
400
401 static void recursiveNewUserStateType (const char *father_type, const char *new_typename, type_t root)
402 {
403   if (!strcmp (root->name, father_type)){
404     PJ_type_state_new (new_typename, root);
405   }
406   xbt_dict_cursor_t cursor = NULL;
407   type_t child_type;
408   char *name;
409   xbt_dict_foreach(root->children, cursor, name, child_type) {
410     recursiveNewUserStateType (father_type, new_typename, child_type);
411   }
412 }
413
414 void instr_new_user_state_type (const char *father_type, const char *new_typename)
415 {
416   recursiveNewUserStateType (father_type, new_typename, PJ_type_get_root());
417 }
418
419 static void recursiveNewValueForUserStateType (const char *typename, const char *value, const char *color, type_t root)
420 {
421   if (!strcmp (root->name, typename)){
422     PJ_value_new (value, color, root);
423   }
424   xbt_dict_cursor_t cursor = NULL;
425   type_t child_type;
426   char *name;
427   xbt_dict_foreach(root->children, cursor, name, child_type) {
428     recursiveNewValueForUserStateType (typename, value, color, child_type);
429   }
430 }
431
432 void instr_new_value_for_user_state_type (const char *typename, const char *value, const char *color)
433 {
434   recursiveNewValueForUserStateType (typename, value, color, PJ_type_get_root());
435 }
436
437 int instr_platform_traced ()
438 {
439   return platform_created;
440 }
441
442 #define GRAPHICATOR_SUPPORT_FUNCTIONS
443
444
445 static xbt_node_t new_xbt_graph_node (xbt_graph_t graph, const char *name, xbt_dict_t nodes)
446 {
447   xbt_node_t ret = xbt_dict_get_or_null (nodes, name);
448   if (ret) return ret;
449
450   ret = xbt_graph_new_node (graph, xbt_strdup(name));
451   xbt_dict_set (nodes, name, ret, NULL);
452   return ret;
453 }
454
455 static xbt_edge_t new_xbt_graph_edge (xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt_dict_t edges)
456 {
457   xbt_edge_t ret;
458
459   const char *sn = instr_node_name (s);
460   const char *dn = instr_node_name (d);
461   int len = strlen(sn)+strlen(dn)+1;
462   char *name = (char*)malloc(len * sizeof(char));
463
464
465   snprintf (name, len, "%s%s", sn, dn);
466   ret = xbt_dict_get_or_null (edges, name);
467   if (ret == NULL){
468     snprintf (name, len, "%s%s", dn, sn);
469     ret = xbt_dict_get_or_null (edges, name);
470   }
471
472   if (ret == NULL){
473     ret = xbt_graph_new_edge(graph, s, d, NULL);
474     xbt_dict_set (edges, name, ret, NULL);
475   }
476   free (name);
477   return ret;
478 }
479
480 static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges,
481     AS_t rc, container_t container)
482 {
483   if (!xbt_dict_is_empty(rc->routing_sons)){
484     xbt_dict_cursor_t cursor = NULL;
485     AS_t rc_son;
486     char *child_name;
487     //bottom-up recursion
488     xbt_dict_foreach(rc->routing_sons, cursor, child_name, rc_son) {
489       container_t child_container = xbt_dict_get (container->children, rc_son->name);
490       recursiveXBTGraphExtraction (graph, nodes, edges, rc_son, child_container);
491     }
492   }
493
494   //let's get routes
495   xbt_dict_cursor_t cursor1 = NULL, cursor2 = NULL;
496   container_t child1, child2;
497   const char *child1_name, *child2_name;
498   xbt_dict_foreach(container->children, cursor1, child1_name, child1) {
499     //if child1 is not a link, a smpi node, a msg process or a msg task
500     if (child1->kind == INSTR_LINK || child1->kind == INSTR_SMPI || child1->kind == INSTR_MSG_PROCESS || child1->kind == INSTR_MSG_TASK) continue;
501
502     xbt_dict_foreach(container->children, cursor2, child2_name, child2) {
503       //if child2 is not a link, a smpi node, a msg process or a msg task
504       if (child2->kind == INSTR_LINK || child2->kind == INSTR_SMPI || child2->kind == INSTR_MSG_PROCESS || child2->kind == INSTR_MSG_TASK) continue;
505
506       //if child1 is not child2
507       if (strcmp (child1_name, child2_name) == 0) continue;
508
509       //get the route
510       sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
511       route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
512       rc->get_route_and_latency(rc, child1->net_elm, child2->net_elm,
513                                 route, NULL);
514
515       //user might want to extract a graph using routes with only one link
516       //see --cfg=tracing/onelink_only:1 or --help-tracing for details
517       if (TRACE_onelink_only() && xbt_dynar_length (route->link_list) > 1) continue;
518
519       //traverse the route connecting the containers
520       unsigned int cpt;
521       void *link;
522       xbt_node_t current, previous;
523       if (route->gw_src){
524         previous = new_xbt_graph_node(graph, route->gw_src->name, nodes);
525       }else{
526         previous = new_xbt_graph_node(graph, child1_name, nodes);
527       }
528
529       xbt_dynar_foreach (route->link_list, cpt, link) {
530         char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
531         current = new_xbt_graph_node(graph, link_name, nodes);
532         new_xbt_graph_edge (graph, previous, current, edges);
533         //previous -> current
534         previous = current;
535       }
536       if (route->gw_dst){
537         current = new_xbt_graph_node(graph, route->gw_dst->name, nodes);
538       }else{
539         current = new_xbt_graph_node(graph, child2_name, nodes);
540       }
541       new_xbt_graph_edge (graph, previous, current, edges);
542       generic_free_route(route);
543     }
544   }
545
546 }
547
548 xbt_graph_t instr_routing_platform_graph (void)
549 {
550   xbt_graph_t ret = xbt_graph_new_graph (0, NULL);
551   xbt_dict_t nodes = xbt_dict_new_homogeneous(NULL);
552   xbt_dict_t edges = xbt_dict_new_homogeneous(NULL);
553   recursiveXBTGraphExtraction (ret, nodes, edges, routing_platf->root, PJ_container_get_root());
554   xbt_dict_free (&nodes);
555   xbt_dict_free (&edges);
556   return ret;
557 }
558
559 void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename)
560 {
561   unsigned int cursor = 0;
562   xbt_node_t node = NULL;
563   xbt_edge_t edge = NULL;
564   FILE *file = NULL;
565
566   file = fopen(filename, "w");
567   xbt_assert(file, "Failed to open %s \n", filename);
568
569   if (g->directed)
570     fprintf(file, "digraph test {\n");
571   else
572     fprintf(file, "graph test {\n");
573
574   fprintf(file, "  graph [overlap=scale]\n");
575
576   fprintf(file, "  node [shape=box, style=filled]\n");
577   fprintf(file,
578           "  node [width=.3, height=.3, style=filled, color=skyblue]\n\n");
579
580   xbt_dynar_foreach(g->nodes, cursor, node) {
581     fprintf(file, "  \"%s\";\n", instr_node_name(node));
582   }
583   xbt_dynar_foreach(g->edges, cursor, edge) {
584     const char *src_s = instr_node_name (edge->src);
585     const char *dst_s = instr_node_name (edge->dst);
586     if (g->directed)
587       fprintf(file, "  \"%s\" -> \"%s\";\n", src_s, dst_s);
588     else
589       fprintf(file, "  \"%s\" -- \"%s\";\n", src_s, dst_s);
590   }
591   fprintf(file, "}\n");
592   fclose(file);
593
594 }
595
596 #endif /* HAVE_TRACING */
597