Change in libosmocore[master]: vty 'stats reset': do not reset stat_items

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at

neels gerrit-no-reply at
Mon Aug 23 20:34:39 UTC 2021

neels has submitted this change. ( )

Change subject: vty 'stats reset': do not reset stat_items

vty 'stats reset': do not reset stat_items

Exempt all stat_item statistics from 'stats reset'. Only reset rate_ctr
statistics to zero.

The rate_ctr statistics have an implicit time scale, counting occurences
per time unit. For them it makes sense to reset all ratings and start
from zero, for example in a test suite (e.g. our TTCN3 BSC_Tests).

In contrast, stat_item statistics count number of objects or nr of
specific object stati at any given time, and they do not deteriorate
over time. Many stat items depend on increment/decrement to be sane.

For example, in osmo-bsc, if the nr of connected BTS is 3, that does not
make sense to be reset to zero. There are still 3 BTS connected, only
the stat_item would suddenly reflect zero. >From then on, it'd be wrong.

All stat_items are by definition wrong after a 'stats reset'.
- Those that depend on increment/decrement will be wrong until the
  program exits, and
- those that are set to absolute values will be wrong up until the next
  value is set. That could be seconds or hours later, depending.

Related: SYS#5542
Change-Id: If2134768b1076e7af189276c45f2a09a4944303e
M src/vty/stats_vty.c
1 file changed, 1 insertion(+), 8 deletions(-)

  neels: Looks good to me, approved
  Jenkins Builder: Verified

diff --git a/src/vty/stats_vty.c b/src/vty/stats_vty.c
index ba45e1e..c9ae0fb 100644
--- a/src/vty/stats_vty.c
+++ b/src/vty/stats_vty.c
@@ -586,19 +586,12 @@
         return 0;
-static int reset_osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *sctx_)
-        osmo_stat_item_group_reset(statg);
-        return 0;
       "stats reset",
-      STATS_STR "Reset all stats\n")
+      STATS_STR "Reset all rate counter stats\n")
         rate_ctr_for_each_group(reset_rate_ctr_group_handler, NULL);
-        osmo_stat_item_for_each_group(reset_osmo_stat_item_group_handler, NULL);
 	return CMD_SUCCESS;

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If2134768b1076e7af189276c45f2a09a4944303e
Gerrit-Change-Number: 25214
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at>
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: neels <nhofmeyr at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-CC: dexter <pmaier at>
Gerrit-CC: osmith <osmith at>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list