ns2: Introduce a per-bind stat_item group with backlog length
The backlog length indicates the instantaneous length of the backlog.
Change-Id: I1c55b4619b1221d7e607ace58649323407faf86b
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index c32bce8..49e92ae 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -47,6 +47,7 @@
#include <osmocom/gprs/frame_relay.h>
#include <osmocom/core/byteswap.h>
+#include <osmocom/core/stat_item.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
@@ -327,6 +328,7 @@
{
struct priv_bind *priv = bind->priv;
llist_add(&msg->list, &priv->backlog.list);
+ osmo_stat_item_inc(bind->statg->items[NS2_BIND_STAT_BACKLOG_LEN], 1);
osmo_timer_schedule(&priv->backlog.timer, 0, priv->backlog.retry_us);
}
@@ -334,6 +336,7 @@
{
struct priv_bind *priv = bind->priv;
llist_add_tail(&msg->list, &priv->backlog.list);
+ osmo_stat_item_inc(bind->statg->items[NS2_BIND_STAT_BACKLOG_LEN], 1);
osmo_timer_schedule(&priv->backlog.timer, 0, priv->backlog.retry_us);
}
@@ -402,6 +405,7 @@
llist_add(&msg->list, &priv->backlog.list);
break;
}
+ osmo_stat_item_dec(bind->statg->items[NS2_BIND_STAT_BACKLOG_LEN], 1);
}
/* re-start timer if we still have data in the queue */