graph: implement node debug routines
Adding node debug API implementation support to dump single or all the node objects to the given file. Signed-off-by: Jerin Jacob <jerinj@marvell.com> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
This commit is contained in:
parent
c59dac2ca1
commit
9027182689
@ -16,6 +16,7 @@ EXPORT_MAP := rte_graph_version.map
|
||||
# all source are stored in SRCS-y
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += node.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += graph.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += graph_debug.c
|
||||
|
||||
# install header files
|
||||
SYMLINK-$(CONFIG_RTE_LIBRTE_GRAPH)-include += rte_graph.h
|
||||
|
24
lib/librte_graph/graph_debug.c
Normal file
24
lib/librte_graph/graph_debug.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright(C) 2020 Marvell International Ltd.
|
||||
*/
|
||||
|
||||
#include <rte_common.h>
|
||||
#include <rte_debug.h>
|
||||
|
||||
#include "graph_private.h"
|
||||
|
||||
void
|
||||
node_dump(FILE *f, struct node *n)
|
||||
{
|
||||
rte_edge_t i;
|
||||
|
||||
fprintf(f, "node <%s>\n", n->name);
|
||||
fprintf(f, " id=%" PRIu32 "\n", n->id);
|
||||
fprintf(f, " flags=0x%" PRIx64 "\n", n->flags);
|
||||
fprintf(f, " addr=%p\n", n);
|
||||
fprintf(f, " process=%p\n", n->process);
|
||||
fprintf(f, " nb_edges=%d\n", n->nb_edges);
|
||||
|
||||
for (i = 0; i < n->nb_edges; i++)
|
||||
fprintf(f, " edge[%d] <%s>\n", i, n->next_nodes[i]);
|
||||
}
|
@ -82,4 +82,16 @@ void graph_spinlock_lock(void);
|
||||
*/
|
||||
void graph_spinlock_unlock(void);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Dump internal node object data.
|
||||
*
|
||||
* @param f
|
||||
* FILE pointer to dump the info.
|
||||
* @param g
|
||||
* Pointer to the internal node object.
|
||||
*/
|
||||
void node_dump(FILE *f, struct node *n);
|
||||
|
||||
#endif /* _RTE_GRAPH_PRIVATE_H_ */
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
name = 'graph'
|
||||
|
||||
sources = files('node.c', 'graph.c')
|
||||
sources = files('node.c', 'graph.c', 'graph_debug.c')
|
||||
headers = files('rte_graph.h')
|
||||
|
||||
deps += ['eal']
|
||||
|
@ -377,6 +377,38 @@ rte_node_edge_get(rte_node_t id, char *next_nodes[])
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
node_scan_dump(FILE *f, rte_node_t id, bool all)
|
||||
{
|
||||
struct node *node;
|
||||
|
||||
RTE_ASSERT(f != NULL);
|
||||
NODE_ID_CHECK(id);
|
||||
|
||||
STAILQ_FOREACH(node, &node_list, next) {
|
||||
if (all == true) {
|
||||
node_dump(f, node);
|
||||
} else if (node->id == id) {
|
||||
node_dump(f, node);
|
||||
return;
|
||||
}
|
||||
}
|
||||
fail:
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
rte_node_dump(FILE *f, rte_node_t id)
|
||||
{
|
||||
node_scan_dump(f, id, false);
|
||||
}
|
||||
|
||||
void
|
||||
rte_node_list_dump(FILE *f)
|
||||
{
|
||||
node_scan_dump(f, 0, true);
|
||||
}
|
||||
|
||||
rte_node_t
|
||||
rte_node_max_count(void)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ EXPERIMENTAL {
|
||||
__rte_node_register;
|
||||
|
||||
rte_node_clone;
|
||||
rte_node_dump;
|
||||
rte_node_edge_count;
|
||||
rte_node_edge_get;
|
||||
rte_node_edge_shrink;
|
||||
|
Loading…
Reference in New Issue
Block a user