stats: Store token rx and tx timestamps as 64-bit

Token rx and tx timestamps were computed and stored as 32-bit unsigned
integer but substracted in other parts of code from 64-bit integer.
Result was, that node with uptime larger than 49.71 days
(2^32/(1000*60*60*24)) reported wrong numbers for
stats.srp.time_since_token_last_received and in log message during long
pause (function timer_function_orf_token_warning).

Solution is to store rx and tx data as 64-bit integer.

Fixes #761

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
This commit is contained in:
Jan Friesse 2024-10-22 18:43:15 +02:00
parent 8b9d5e7051
commit 3785829935
2 changed files with 4 additions and 5 deletions

View File

@ -770,10 +770,9 @@ static int pause_flush (struct totemsrp_instance *instance)
static int token_event_stats_collector (enum totem_callback_token_type type, const void *void_instance)
{
struct totemsrp_instance *instance = (struct totemsrp_instance *)void_instance;
uint32_t time_now;
unsigned long long nano_secs = qb_util_nano_current_get ();
uint64_t time_now;
time_now = (nano_secs / QB_TIME_NS_IN_MSEC);
time_now = (qb_util_nano_current_get() / QB_TIME_NS_IN_MSEC);
if (type == TOTEM_CALLBACK_TOKEN_RECEIVED) {
/* incr latest token the index */

View File

@ -45,8 +45,8 @@ typedef struct {
} totemnet_stats_t;
typedef struct {
uint32_t rx;
uint32_t tx;
uint64_t rx;
uint64_t tx;
int backlog_calc;
} totemsrp_token_stats_t;