bts: Start creating statistics inside the BTS code
This commit is contained in:
parent
61a0a04d26
commit
f537298cca
33
src/bts.cpp
33
src/bts.cpp
|
@ -43,6 +43,26 @@ extern void *tall_pcu_ctx;
|
|||
|
||||
static BTS s_bts;
|
||||
|
||||
/**
|
||||
* For gcc-4.4 compat do not use extended initializer list but keep the
|
||||
* order from the enum here. Once we support GCC4.7 and up we can change
|
||||
* the code below.
|
||||
*/
|
||||
static const struct rate_ctr_desc bts_ctr_description[] = {
|
||||
{ "tbf.dl.alloc", "TBF DL Allocated "},
|
||||
{ "tbf.dl.freed", "TBF DL Freed "},
|
||||
{ "tbf.ul.alloc", "TBF UL Allocated "},
|
||||
{ "tbf.ul.freed", "TBF UL Freed "},
|
||||
{ "decode.errors", "Decode Errors "},
|
||||
};
|
||||
|
||||
static const struct rate_ctr_group_desc bts_ctrg_desc = {
|
||||
"bts",
|
||||
"BTS Statistics",
|
||||
ARRAY_SIZE(bts_ctr_description),
|
||||
bts_ctr_description,
|
||||
};
|
||||
|
||||
BTS* BTS::main_bts()
|
||||
{
|
||||
return &s_bts;
|
||||
|
@ -58,6 +78,11 @@ struct gprs_rlcmac_bts *bts_main_data()
|
|||
return BTS::main_bts()->bts_data();
|
||||
}
|
||||
|
||||
struct rate_ctr_group *bts_main_data_stats()
|
||||
{
|
||||
return BTS::main_bts()->rate_counters();
|
||||
}
|
||||
|
||||
BTS::BTS()
|
||||
: m_cur_fn(0)
|
||||
, m_pollController(*this)
|
||||
|
@ -80,8 +105,16 @@ BTS::BTS()
|
|||
pdch->trx = trx;
|
||||
}
|
||||
}
|
||||
|
||||
m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
|
||||
}
|
||||
|
||||
BTS::~BTS()
|
||||
{
|
||||
rate_ctr_group_free(m_ratectrs);
|
||||
}
|
||||
|
||||
|
||||
void BTS::set_current_frame_number(int fn)
|
||||
{
|
||||
m_cur_fn = fn;
|
||||
|
|
31
src/bts.h
31
src/bts.h
|
@ -24,6 +24,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
}
|
||||
|
||||
|
@ -147,7 +148,16 @@ struct gprs_rlcmac_bts {
|
|||
*/
|
||||
struct BTS {
|
||||
public:
|
||||
enum {
|
||||
CTR_TBF_DL_ALLOCATED,
|
||||
CTR_TBF_DL_FREED,
|
||||
CTR_TBF_UL_ALLOCATED,
|
||||
CTR_TBF_UL_FREED,
|
||||
CTR_DECODE_ERRORS,
|
||||
};
|
||||
|
||||
BTS();
|
||||
~BTS();
|
||||
|
||||
static BTS* main_bts();
|
||||
|
||||
|
@ -174,12 +184,27 @@ public:
|
|||
void trigger_dl_ass(gprs_rlcmac_tbf *tbf, gprs_rlcmac_tbf *old_tbf, const char *imsi);
|
||||
void snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi);
|
||||
|
||||
/*
|
||||
* Statistics
|
||||
*/
|
||||
void tbf_dl_created();
|
||||
void tbf_dl_freed();
|
||||
void tbf_ul_created();
|
||||
void tbf_ul_freed();
|
||||
void decode_error();
|
||||
|
||||
/*
|
||||
* Below for C interface for the VTY
|
||||
*/
|
||||
struct rate_ctr_group *rate_counters() const;
|
||||
|
||||
private:
|
||||
int m_cur_fn;
|
||||
struct gprs_rlcmac_bts m_bts;
|
||||
PollController m_pollController;
|
||||
SBAController m_sba;
|
||||
TimingAdvance m_ta;
|
||||
struct rate_ctr_group *m_ratectrs;
|
||||
|
||||
private:
|
||||
/* disable copying to avoid slicing */
|
||||
|
@ -207,6 +232,11 @@ inline BTS *gprs_rlcmac_pdch::bts() const
|
|||
return trx->bts;
|
||||
}
|
||||
|
||||
inline struct rate_ctr_group *BTS::rate_counters() const
|
||||
{
|
||||
return m_ratectrs;
|
||||
}
|
||||
|
||||
inline gprs_rlcmac_bts *gprs_rlcmac_pdch::bts_data() const
|
||||
{
|
||||
return trx->bts->bts_data();
|
||||
|
@ -222,6 +252,7 @@ inline uint8_t gprs_rlcmac_pdch::trx_no() const
|
|||
extern "C" {
|
||||
#endif
|
||||
struct gprs_rlcmac_bts *bts_main_data();
|
||||
struct rate_ctr_group *bts_main_data_stats();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
|
|
|
@ -274,6 +274,15 @@ DEFUN(cfg_pcu_gamma,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(show_bts_stats,
|
||||
show_bts_stats_cmd,
|
||||
"show bts statistics",
|
||||
SHOW_STR "BTS related functionality\nStatistics\n")
|
||||
{
|
||||
vty_out_rate_ctr_group(vty, "", bts_main_data_stats());
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static const char pcu_copyright[] =
|
||||
"Copyright (C) 2012 by Ivan Kluchnikov <kluchnikovi@gmail.com> and \r\n"
|
||||
" Andreas Eversberg <jolly@eversberg.eu>\r\n"
|
||||
|
@ -311,5 +320,7 @@ int pcu_vty_init(const struct log_info *cat)
|
|||
install_element(PCU_NODE, &cfg_pcu_gamma_cmd);
|
||||
install_element(PCU_NODE, &ournode_end_cmd);
|
||||
|
||||
install_element_ve(&show_bts_stats_cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue