STATS: Add more hierarchy to counters.
[vpp.git] / src / vpp / stats / stat_segment.c
index 6fb9c83..08f1d30 100644 (file)
@@ -186,8 +186,8 @@ vlib_stats_pop_heap2 (u64 * counter_vector, u32 thread_index, void *oldheap)
   ssvm_pop_heap (oldheap);
 }
 
-static clib_error_t *
-map_stat_segment_init (vlib_main_t * vm)
+clib_error_t *
+vlib_map_stat_segment_init (void)
 {
   stats_main_t *sm = &stats_main;
   ssvm_private_t *ssvmp = &sm->stat_segment;
@@ -232,28 +232,28 @@ map_stat_segment_init (vlib_main_t * vm)
   sm->last_runtime_ptr = (scalar_data + 2);
   sm->last_runtime_stats_clear_ptr = (scalar_data + 3);
 
-  name = format (0, "vector_rate%c", 0);
+  name = format (0, "/sys/vector_rate%c", 0);
   ep = clib_mem_alloc (sizeof (*ep));
   ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
   ep->value = sm->vector_rate_ptr;
 
   hash_set_mem (sm->counter_vector_by_name, name, ep);
 
-  name = format (0, "input_rate%c", 0);
+  name = format (0, "/sys/input_rate%c", 0);
   ep = clib_mem_alloc (sizeof (*ep));
   ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
   ep->value = sm->input_rate_ptr;
 
   hash_set_mem (sm->counter_vector_by_name, name, ep);
 
-  name = format (0, "last_update%c", 0);
+  name = format (0, "/sys/last_update%c", 0);
   ep = clib_mem_alloc (sizeof (*ep));
   ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
   ep->value = sm->last_runtime_ptr;
 
   hash_set_mem (sm->counter_vector_by_name, name, ep);
 
-  name = format (0, "last_stats_clear%c", 0);
+  name = format (0, "/sys/last_stats_clear%c", 0);
   ep = clib_mem_alloc (sizeof (*ep));
   ep->type = STAT_DIR_TYPE_SCALAR_POINTER;
   ep->value = sm->last_runtime_stats_clear_ptr;
@@ -269,8 +269,6 @@ map_stat_segment_init (vlib_main_t * vm)
   return 0;
 }
 
-VLIB_INIT_FUNCTION (map_stat_segment_init);
-
 typedef struct
 {
   u8 *name;