summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vpp/stats/stat_segment.c27
-rw-r--r--src/vpp/stats/stat_segment.h5
2 files changed, 31 insertions, 1 deletions
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c
index aa32aede3a5..8496f840aaf 100644
--- a/src/vpp/stats/stat_segment.c
+++ b/src/vpp/stats/stat_segment.c
@@ -416,6 +416,33 @@ update_node_counters (stat_segment_main_t * sm)
stat_validate_counter_vector (&sm->directory_vector
[STAT_COUNTER_NODE_SUSPENDS], l);
+ vec_validate (sm->nodes, l);
+ stat_segment_directory_entry_t *ep;
+ ep = &sm->directory_vector[STAT_COUNTER_NODE_NAMES];
+ ep->offset = stat_segment_offset (shared_header, sm->nodes);
+
+ int i;
+ u64 *offset_vector =
+ ep->offset_vector ? stat_segment_pointer (shared_header,
+ ep->offset_vector) : 0;
+ /* Update names dictionary */
+ vec_validate (offset_vector, l);
+ vlib_node_t **nodes = node_dups[0];
+ for (i = 0; i < vec_len (nodes); i++)
+ {
+ vlib_node_t *n = nodes[i];
+ u8 *s = 0;
+ s = format (s, "%v%c", n->name, 0);
+ if (sm->nodes[n->index])
+ vec_free (sm->nodes[n->index]);
+ sm->nodes[n->index] = s;
+ offset_vector[i] =
+ sm->nodes[i] ? stat_segment_offset (shared_header,
+ sm->nodes[i]) : 0;
+
+ }
+ ep->offset_vector = stat_segment_offset (shared_header, offset_vector);
+
vlib_stat_segment_unlock ();
clib_mem_set_heap (oldheap);
no_max_nodes = l;
diff --git a/src/vpp/stats/stat_segment.h b/src/vpp/stats/stat_segment.h
index 917b512aecb..6e75e6338d4 100644
--- a/src/vpp/stats/stat_segment.h
+++ b/src/vpp/stats/stat_segment.h
@@ -33,6 +33,7 @@ typedef enum
STAT_COUNTER_NODE_CALLS,
STAT_COUNTER_NODE_SUSPENDS,
STAT_COUNTER_INTERFACE_NAMES,
+ STAT_COUNTER_NODE_NAMES,
STAT_COUNTERS
} stat_segment_counter_t;
@@ -46,7 +47,8 @@ typedef enum
_(NODE_VECTORS, COUNTER_VECTOR_SIMPLE, vectors, /sys/node) \
_(NODE_CALLS, COUNTER_VECTOR_SIMPLE, calls, /sys/node) \
_(NODE_SUSPENDS, COUNTER_VECTOR_SIMPLE, suspends, /sys/node) \
- _(INTERFACE_NAMES, NAME_VECTOR, names, /if)
+ _(INTERFACE_NAMES, NAME_VECTOR, names, /if) \
+ _(NODE_NAMES, NAME_VECTOR, names, /sys/node)
typedef struct
{
@@ -104,6 +106,7 @@ typedef struct
uword *directory_vector_by_name;
stat_segment_directory_entry_t *directory_vector;
u8 **interfaces;
+ u8 **nodes;
clib_spinlock_t *stat_segment_lockp;
clib_socket_t *socket;