Update per-trunk global packet/byte counters in real-time
We used to update only the per-connection rx/tx packet/byte counters
on-the-fly, but not the per-trunk global counters. The latter would
only be updated at the end of a connection. As MGCP connections
can last quite long (think of a long phone call) this is maybe
not the best of ideas.
Note: The all_rtp:err_tstmp_in and all_rt:err_tstmp_out are still
only updated at the end of a connection.
Change-Id: Ib3866cb8149d3257fcf39733846c97c33881c4ee
Related: OS#4437
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 60a1700..7a86274 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -259,7 +259,6 @@
{
struct rate_ctr_group *all_stats = trunk->all_rtp_conn_stats;
struct rate_ctr_group *conn_stats = conn_rtp->rate_ctr_group;
- int i;
if (all_stats == NULL || conn_stats == NULL)
return;
@@ -269,8 +268,11 @@
* All other counters in both counter groups correspond to each other. */
OSMO_ASSERT(conn_stats->desc->num_ctr + 1 == all_stats->desc->num_ctr);
- for (i = 0; i < conn_stats->desc->num_ctr; i++)
- rate_ctr_add(&all_stats->ctr[i], conn_stats->ctr[i].current);
+ /* all other counters are [now] updated in real-time */
+ rate_ctr_add(&all_stats->ctr[IN_STREAM_ERR_TSTMP_CTR],
+ conn_stats->ctr[IN_STREAM_ERR_TSTMP_CTR].current);
+ rate_ctr_add(&all_stats->ctr[OUT_STREAM_ERR_TSTMP_CTR],
+ conn_stats->ctr[OUT_STREAM_ERR_TSTMP_CTR].current);
rate_ctr_inc(&all_stats->ctr[RTP_NUM_CONNECTIONS]);
}