summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-06-14 09:28:27 +0200
committerDave Barach <openvpp@barachs.net>2018-06-15 12:07:40 +0000
commit1ec0ea85c3f57f4638e32a00396057f80d958ec9 (patch)
treefba386994bf101d4fda3a87af7d5e1a783cdf4c1 /src/vnet/interface.c
parentc22f87b8763c844e09177e30bbb92830cd928812 (diff)
STATS: Add more hierarchy to counters.
Put error counters under node_index. /err/<node-name>/<error-name> E.g: /err/ip4-lookup/Hash table collisions /err/ip6-rewrite/Buffer allocation error Error names are not globally unique, and this allows for walking all errors for a particular node. Put interface counters under the directory /if. E.g. /if/rx Put system counters under the directory /sys. E.g. /sys/vector_rate Change-Id: I5b794d16698f61bcb2063a8cd77a7c4ae36419b8 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vnet/interface.c')
-rw-r--r--src/vnet/interface.c44
1 files changed, 13 insertions, 31 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index 7a2c3abd2d4..34ad292a728 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -1297,38 +1297,20 @@ vnet_interface_init (vlib_main_t * vm)
CLIB_CACHE_LINE_BYTES);
im->sw_if_counter_lock[0] = 1; /* should be no need */
- /*
- * $$$$ add stat segment name(s) if desired
- * set xxx.stat_segment_name = "whatever"...
- */
vec_validate (im->sw_if_counters, VNET_N_SIMPLE_INTERFACE_COUNTER - 1);
- im->sw_if_counters[VNET_INTERFACE_COUNTER_DROP].name = "drops";
- im->sw_if_counters[VNET_INTERFACE_COUNTER_PUNT].name = "punts";
- im->sw_if_counters[VNET_INTERFACE_COUNTER_IP4].name = "ip4";
- im->sw_if_counters[VNET_INTERFACE_COUNTER_IP6].name = "ip6";
- im->sw_if_counters[VNET_INTERFACE_COUNTER_RX_NO_BUF].name = "rx-no-buf";
- im->sw_if_counters[VNET_INTERFACE_COUNTER_RX_MISS].name = "rx-miss";
- im->sw_if_counters[VNET_INTERFACE_COUNTER_RX_ERROR].name = "rx-error";
- im->sw_if_counters[VNET_INTERFACE_COUNTER_TX_ERROR].name = "tx-error";
-
- vec_validate (im->combined_sw_if_counters,
- VNET_N_COMBINED_INTERFACE_COUNTER - 1);
- im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX].name = "rx";
- im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_UNICAST].name =
- "rx-unicast";
- im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_MULTICAST].name =
- "rx-multicast";
- im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_BROADCAST].name =
- "rx-broadcast";
- im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX].name = "tx";
- im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_UNICAST].name =
- "tx-unicast";
- im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_MULTICAST].name =
- "tx-multicast";
- im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_BROADCAST].name =
- "tx-broadcast";
-
- im->sw_if_counter_lock[0] = 0;
+#define _(E,n,p) \
+ im->sw_if_counters[VNET_INTERFACE_COUNTER_##E].name = #n; \
+ im->sw_if_counters[VNET_INTERFACE_COUNTER_##E].stat_segment_name = "/" #p "/" #n;
+ foreach_simple_interface_counter_name
+#undef _
+ vec_validate (im->combined_sw_if_counters,
+ VNET_N_COMBINED_INTERFACE_COUNTER - 1);
+#define _(E,n,p) \
+ im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_##E].name = #n; \
+ im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_##E].stat_segment_name = "/" #p "/" #n;
+ foreach_combined_interface_counter_name
+#undef _
+ im->sw_if_counter_lock[0] = 0;
im->device_class_by_name = hash_create_string ( /* size */ 0,
sizeof (uword));