Change in osmo-pcu[master]: bts: Drop specific functions to add values to stats
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/18228 ) Change subject: bts: Drop specific functions to add values to stats .. bts: Drop specific functions to add values to stats Change-Id: I877a9c9a35b6c94c3dd6b1ab3019bc57f6c8568a --- M src/bts.h M src/gprs_ms_storage.cpp 2 files changed, 11 insertions(+), 25 deletions(-) Approvals: laforge: Looks good to me, approved neels: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/bts.h b/src/bts.h index 5090f58..15dd482 100644 --- a/src/bts.h +++ b/src/bts.h @@ -263,6 +263,10 @@ CTR_EGPRS_UL_MCS9, }; +enum { + STAT_MS_PRESENT, +}; + #ifdef __cplusplus /** * I represent a GSM BTS. I have one or more TRX, I know the current @@ -271,10 +275,6 @@ */ struct BTS { public: - enum { - STAT_MS_PRESENT, - }; - BTS(); ~BTS(); void cleanup(); @@ -318,19 +318,13 @@ const uint8_t *data, unsigned int len); /* -* Statistics -*/ - - void ms_present(int32_t n); - int32_t ms_present_get(); - - /* * Below for C interface for the VTY */ struct rate_ctr_group *rate_counters() const; struct osmo_stat_item_group *stat_items() const; void do_rate_ctr_inc(unsigned int ctr_id); void do_rate_ctr_add(unsigned int ctr_id, int inc); + void stat_item_add(unsigned int stat_id, int inc); LListHead& ul_tbfs(); LListHead& dl_tbfs(); @@ -408,18 +402,10 @@ rate_ctr_add(&m_ratectrs->ctr[ctr_id], inc); } - -#define CREATE_STAT_INLINE(func_name, func_name_get, stat_name) \ - inline void BTS::func_name(int32_t val) {\ - osmo_stat_item_set(m_statg->items[stat_name], val); \ - } \ - inline int32_t BTS::func_name_get() {\ - return osmo_stat_item_get_last(m_statg->items[stat_name]); \ - } - -CREATE_STAT_INLINE(ms_present, ms_present_get, STAT_MS_PRESENT); - -#undef CREATE_STAT_INLINE +inline void BTS::stat_item_add(unsigned int stat_id, int inc) { + int32_t val = osmo_stat_item_get_last(m_statg->items[stat_id]); + osmo_stat_item_set(m_statg->items[stat_id], val + inc); +} #endif diff --git a/src/gprs_ms_storage.cpp b/src/gprs_ms_storage.cpp index 04518c5..19b6e1c 100644 --- a/src/gprs_ms_storage.cpp +++ b/src/gprs_ms_storage.cpp @@ -55,7 +55,7 @@ { llist_del(&ms->list()); if (m_bts) - m_bts->ms_present(m_bts->ms_present_get() - 1); + m_bts->stat_item_add(STAT_MS_PRESENT, -1); if (ms->is_idle()) delete ms; } @@ -102,7 +102,7 @@ ms->set_callback(this); llist_add(&ms->list(), &m_list); if (m_bts) - m_bts->ms_present(m_bts->ms_present_get() + 1); + m_bts->stat_item_add(STAT_MS_PRESENT, 1); return ms; } -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/18228 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I877a9c9a35b6c94c3dd6b1ab3019bc57f6c8568a Gerrit-Change-Number: 18228 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: pespin Gerrit-MessageType: merged
Change in osmo-pcu[master]: bts: Drop specific functions to add values to stats
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/18228 ) Change subject: bts: Drop specific functions to add values to stats .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/18228 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I877a9c9a35b6c94c3dd6b1ab3019bc57f6c8568a Gerrit-Change-Number: 18228 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Comment-Date: Wed, 13 May 2020 16:40:59 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-pcu[master]: bts: Drop specific functions to add values to stats
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/18228 ) Change subject: bts: Drop specific functions to add values to stats .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/18228 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I877a9c9a35b6c94c3dd6b1ab3019bc57f6c8568a Gerrit-Change-Number: 18228 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels Gerrit-Comment-Date: Wed, 13 May 2020 12:53:07 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-pcu[master]: bts: Drop specific functions to add values to stats
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/18228 ) Change subject: bts: Drop specific functions to add values to stats .. bts: Drop specific functions to add values to stats Change-Id: I877a9c9a35b6c94c3dd6b1ab3019bc57f6c8568a --- M src/bts.h M src/gprs_ms_storage.cpp 2 files changed, 11 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/28/18228/1 diff --git a/src/bts.h b/src/bts.h index 5090f58..15dd482 100644 --- a/src/bts.h +++ b/src/bts.h @@ -263,6 +263,10 @@ CTR_EGPRS_UL_MCS9, }; +enum { + STAT_MS_PRESENT, +}; + #ifdef __cplusplus /** * I represent a GSM BTS. I have one or more TRX, I know the current @@ -271,10 +275,6 @@ */ struct BTS { public: - enum { - STAT_MS_PRESENT, - }; - BTS(); ~BTS(); void cleanup(); @@ -318,19 +318,13 @@ const uint8_t *data, unsigned int len); /* -* Statistics -*/ - - void ms_present(int32_t n); - int32_t ms_present_get(); - - /* * Below for C interface for the VTY */ struct rate_ctr_group *rate_counters() const; struct osmo_stat_item_group *stat_items() const; void do_rate_ctr_inc(unsigned int ctr_id); void do_rate_ctr_add(unsigned int ctr_id, int inc); + void stat_item_add(unsigned int stat_id, int inc); LListHead& ul_tbfs(); LListHead& dl_tbfs(); @@ -408,18 +402,10 @@ rate_ctr_add(&m_ratectrs->ctr[ctr_id], inc); } - -#define CREATE_STAT_INLINE(func_name, func_name_get, stat_name) \ - inline void BTS::func_name(int32_t val) {\ - osmo_stat_item_set(m_statg->items[stat_name], val); \ - } \ - inline int32_t BTS::func_name_get() {\ - return osmo_stat_item_get_last(m_statg->items[stat_name]); \ - } - -CREATE_STAT_INLINE(ms_present, ms_present_get, STAT_MS_PRESENT); - -#undef CREATE_STAT_INLINE +inline void BTS::stat_item_add(unsigned int stat_id, int inc) { + int32_t val = osmo_stat_item_get_last(m_statg->items[stat_id]); + osmo_stat_item_set(m_statg->items[stat_id], val + inc); +} #endif diff --git a/src/gprs_ms_storage.cpp b/src/gprs_ms_storage.cpp index 04518c5..19b6e1c 100644 --- a/src/gprs_ms_storage.cpp +++ b/src/gprs_ms_storage.cpp @@ -55,7 +55,7 @@ { llist_del(&ms->list()); if (m_bts) - m_bts->ms_present(m_bts->ms_present_get() - 1); + m_bts->stat_item_add(STAT_MS_PRESENT, -1); if (ms->is_idle()) delete ms; } @@ -102,7 +102,7 @@ ms->set_callback(this); llist_add(&ms->list(), &m_list); if (m_bts) - m_bts->ms_present(m_bts->ms_present_get() + 1); + m_bts->stat_item_add(STAT_MS_PRESENT, 1); return ms; } -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/18228 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I877a9c9a35b6c94c3dd6b1ab3019bc57f6c8568a Gerrit-Change-Number: 18228 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-MessageType: newchange