aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-03-26 10:18:37 +0100
committerlaforge <laforge@osmocom.org>2021-04-07 18:38:54 +0000
commit61401943473f448917ccab6e67ca75750747c234 (patch)
tree2f74cc0cb5aaa53782119828af2b40c192f4927a /tests
parent2d1a9fabcc9fb394fee6a857de797fe802fa4291 (diff)
stat_item: make value ids item specific
Fix counting of values missed because of FIFO overflow in osmo_stat_item_get_next(), by assigning a new item value id effectively as item->value[n + 1].id = item->value[n].id + 1, instead of increasing a global_value_id that is shared between all items and groups. With global_value_id, the count of values missed was wrong for one item, as soon as a new value was added to another item. This partially reverts b27b352e ("stats: Use a global index for stat item values") from 2015, right after stats was added to libosmocore. It was supposed to make multiple readers (reporters) possible, which could read independently from stat_item (and later added comments explain it like that). But this remained unused, stats has implemented multiple reporters by reading all stat_items once and sending the same data to all enabled reporters. The patch caused last_value_index in struct osmo_stat_item to always remain at -1. Replace this unused last_value_index with stats_next_id, so stats can store the item-specific next_id in the struct again. It appears that stats is the only direct user of osmo_stat_item, but if there are others, they can bring their own item-specific next_id: functions in stat_item.c still accept a next_id argument. Related: OS#5088 Change-Id: Ie65dcdf52c8fc3d916e20d7f0455f6223be6b64f
Diffstat (limited to 'tests')
-rw-r--r--tests/stats/stats_test.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/tests/stats/stats_test.c b/tests/stats/stats_test.c
index e5f7f20f..b6b4be9d 100644
--- a/tests/stats/stats_test.c
+++ b/tests/stats/stats_test.c
@@ -234,21 +234,6 @@ static void stat_test(void)
rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &next_id_a, &value);
OSMO_ASSERT(rc == 0);
- /* Test Discard (all items) */
- osmo_stat_item_set(statg->items[TEST_A_ITEM], 99);
- osmo_stat_item_set(statg->items[TEST_A_ITEM], 100);
- osmo_stat_item_set(statg->items[TEST_A_ITEM], 101);
- osmo_stat_item_set(statg->items[TEST_B_ITEM], 99);
- osmo_stat_item_set(statg->items[TEST_B_ITEM], 100);
-
- rc = osmo_stat_item_discard_all(&next_id_a);
- rc = osmo_stat_item_discard_all(&next_id_b);
-
- rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &next_id_a, &value);
- OSMO_ASSERT(rc == 0);
- rc = osmo_stat_item_get_next(statg->items[TEST_B_ITEM], &next_id_b, &value);
- OSMO_ASSERT(rc == 0);
-
osmo_stat_item_group_free(statg);
sgrp2 = osmo_stat_item_get_group_by_name_idx("test.one", 0);