stats: add boot time in stats segment

Write time into /sys/boottime on VPP start.
This allows a stateless control plane agent to validate if it's reconnecting to the same
VPP instance.

Type: improvement
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: Iba7f334339c46142045e43da6efab11612e7b9c0
Signed-off-by: Ole Troan <ot@cisco.com>
This commit is contained in:
Ole Troan
2022-11-28 13:13:24 +01:00
committed by Andrew Yourtchenko
parent e1f2058b54
commit 5010bbd3c4
2 changed files with 5 additions and 1 deletions

View File

@ -169,6 +169,8 @@ stat_segment_collector_process (vlib_main_t *vm, vlib_node_runtime_t *rt,
} }
} }
sm->directory_vector[STAT_COUNTER_BOOTTIME].value = unix_time_now ();
while (1) while (1)
{ {
do_stat_segment_updates (vm, sm); do_stat_segment_updates (vm, sm);

View File

@ -21,12 +21,14 @@ typedef enum
{ {
STAT_COUNTER_HEARTBEAT = 0, STAT_COUNTER_HEARTBEAT = 0,
STAT_COUNTER_LAST_STATS_CLEAR, STAT_COUNTER_LAST_STATS_CLEAR,
STAT_COUNTER_BOOTTIME,
STAT_COUNTERS STAT_COUNTERS
} stat_segment_counter_t; } stat_segment_counter_t;
#define foreach_stat_segment_counter_name \ #define foreach_stat_segment_counter_name \
_ (LAST_STATS_CLEAR, SCALAR_INDEX, last_stats_clear, "/sys") \ _ (LAST_STATS_CLEAR, SCALAR_INDEX, last_stats_clear, "/sys") \
_ (HEARTBEAT, SCALAR_INDEX, heartbeat, "/sys") _ (HEARTBEAT, SCALAR_INDEX, heartbeat, "/sys") \
_ (BOOTTIME, SCALAR_INDEX, boottime, "/sys")
typedef struct typedef struct
{ {