doc: fix build when sphinx reports version to stderr
[dpdk.git] / lib / librte_graph / graph_debug.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2020 Marvell International Ltd.
3  */
4
5 #include <rte_common.h>
6 #include <rte_debug.h>
7
8 #include "graph_private.h"
9
10 void
11 graph_dump(FILE *f, struct graph *g)
12 {
13         struct graph_node *graph_node;
14         rte_edge_t i = 0;
15
16         fprintf(f, "graph <%s>\n", g->name);
17         fprintf(f, "  id=%" PRIu32 "\n", g->id);
18         fprintf(f, "  cir_start=%" PRIu32 "\n", g->cir_start);
19         fprintf(f, "  cir_mask=%" PRIu32 "\n", g->cir_mask);
20         fprintf(f, "  addr=%p\n", g);
21         fprintf(f, "  graph=%p\n", g->graph);
22         fprintf(f, "  mem_sz=%zu\n", g->mem_sz);
23         fprintf(f, "  node_count=%" PRIu32 "\n", g->node_count);
24         fprintf(f, "  src_node_count=%" PRIu32 "\n", g->src_node_count);
25
26         STAILQ_FOREACH(graph_node, &g->node_list, next)
27                 fprintf(f, "     node[%d] <%s>\n", i++, graph_node->node->name);
28 }
29
30 void
31 node_dump(FILE *f, struct node *n)
32 {
33         rte_edge_t i;
34
35         fprintf(f, "node <%s>\n", n->name);
36         fprintf(f, "  id=%" PRIu32 "\n", n->id);
37         fprintf(f, "  flags=0x%" PRIx64 "\n", n->flags);
38         fprintf(f, "  addr=%p\n", n);
39         fprintf(f, "  process=%p\n", n->process);
40         fprintf(f, "  nb_edges=%d\n", n->nb_edges);
41
42         for (i = 0; i < n->nb_edges; i++)
43                 fprintf(f, "     edge[%d] <%s>\n", i, n->next_nodes[i]);
44 }
45
46 void
47 rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
48 {
49         rte_node_t count;
50         rte_graph_off_t off;
51         struct rte_node *n;
52         rte_edge_t i;
53
54         fprintf(f, "graph <%s> @ %p\n", g->name, g);
55         fprintf(f, "  id=%" PRIu32 "\n", g->id);
56         fprintf(f, "  head=%" PRId32 "\n", (int32_t)g->head);
57         fprintf(f, "  tail=%" PRId32 "\n", (int32_t)g->tail);
58         fprintf(f, "  cir_mask=0x%" PRIx32 "\n", g->cir_mask);
59         fprintf(f, "  nb_nodes=%" PRId32 "\n", g->nb_nodes);
60         fprintf(f, "  socket=%d\n", g->socket);
61         fprintf(f, "  fence=0x%" PRIx64 "\n", g->fence);
62         fprintf(f, "  nodes_start=0x%" PRIx32 "\n", g->nodes_start);
63         fprintf(f, "  cir_start=%p\n", g->cir_start);
64
65         rte_graph_foreach_node(count, off, g, n) {
66                 if (!all && n->idx == 0)
67                         continue;
68                 fprintf(f, "     node[%d] <%s>\n", count, n->name);
69                 fprintf(f, "       fence=0x%" PRIx64 "\n", n->fence);
70                 fprintf(f, "       objs=%p\n", n->objs);
71                 fprintf(f, "       process=%p\n", n->process);
72                 fprintf(f, "       id=0x%" PRIx32 "\n", n->id);
73                 fprintf(f, "       offset=0x%" PRIx32 "\n", n->off);
74                 fprintf(f, "       nb_edges=%" PRId32 "\n", n->nb_edges);
75                 fprintf(f, "       realloc_count=%d\n", n->realloc_count);
76                 fprintf(f, "       size=%d\n", n->size);
77                 fprintf(f, "       idx=%d\n", n->idx);
78                 fprintf(f, "       total_objs=%" PRId64 "\n", n->total_objs);
79                 fprintf(f, "       total_calls=%" PRId64 "\n", n->total_calls);
80                 for (i = 0; i < n->nb_edges; i++)
81                         fprintf(f, "          edge[%d] <%s>\n", i,
82                                 n->nodes[i]->name);
83         }
84 }