Neels Hofmeyr | e90c717 | 2021-09-14 14:37:38 +0200 | [diff] [blame] | 1 | /*! \file stat_item_internal.h |
| 2 | * internal definitions for the osmo_stat_item API */ |
| 3 | #pragma once |
| 4 | |
| 5 | /*! \addtogroup osmo_stat_item |
| 6 | * @{ |
| 7 | */ |
| 8 | |
| 9 | struct osmo_stat_item_period { |
| 10 | /*! Number of osmo_stat_item_set() that occurred during the reporting period, zero if none. */ |
| 11 | uint32_t n; |
| 12 | /*! Smallest value seen in a reporting period. */ |
| 13 | int32_t min; |
| 14 | /*! Most recent value passed to osmo_stat_item_set(), or the item->desc->default_value if none. */ |
| 15 | int32_t last; |
| 16 | /*! Largest value seen in a reporting period. */ |
| 17 | int32_t max; |
| 18 | /*! Sum of all values passed to osmo_stat_item_set() in the reporting period. */ |
| 19 | int64_t sum; |
| 20 | }; |
| 21 | |
| 22 | /*! data we keep for each actual item */ |
| 23 | struct osmo_stat_item { |
| 24 | /*! back-reference to the item description */ |
| 25 | const struct osmo_stat_item_desc *desc; |
| 26 | |
| 27 | /*! Current reporting period / current value. */ |
| 28 | struct osmo_stat_item_period value; |
| 29 | |
| 30 | /*! The results of the previous reporting period. According to these, the stats reporter decides whether to |
| 31 | * re-send values or omit an unchanged value from a report. */ |
| 32 | struct osmo_stat_item_period reported; |
| 33 | }; |
| 34 | |
| 35 | /*! @} */ |