Commit bbf4cc31 authored by frtabu's avatar frtabu

improve flexibility of measure implementation

parent eb6e5ffe
......@@ -50,18 +50,27 @@
#include "openair2/LAYER2/MAC/mac.h"
#include "openair1/PHY/phy_extern.h"
static telnet_measurgroupdef_t *measurgroups[TELNET_MAXMEASURGROUPS];
static int telnet_num_measurgroups=0;
void measurcmd_display_macstats(telnet_printfunc_t prnt);
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt);
void measurcmd_display_rlcstats(telnet_printfunc_t prnt);
static telnet_measurgroupdef_t measurgroups[] = {
{"enb", GROUP_LTESTATS,0, measurcmd_display_macstats, {NULL}},
{"enbues",GROUP_LTESTATS,0, measurcmd_display_macstats_ue,{NULL}},
{"rlc", GROUP_LTESTATS,0, measurcmd_display_rlcstats, {NULL}},
};
#define TELNET_NUM_MEASURGROUPS (sizeof(measurgroups)/sizeof(telnet_measurgroupdef_t))
static int eNB_id =0;
static char *grouptypes[] = {"ltemac","cpustats"};
static char *grouptypes[] = {"ltestats","cpustats"};
#define TELNET_NUM_MEASURTYPES (sizeof(grouptypes)/sizeof(char *))
#define HDR "---------------------------------"
void measurcmd_display_groups(telnet_printfunc_t prnt) {
prnt(" %*s %10s %s\n",TELNET_MAXMEASURNAME_LEN-1,"name","type","nombre de mesures");
for(int i=0; i<telnet_num_measurgroups; i++)
prnt("%02d %*s %10s %i\n",i,TELNET_MAXMEASURNAME_LEN-1,measurgroups[i]->groupname,
grouptypes[measurgroups[i]->type], measurgroups[i]->size);
for(int i=0; i<TELNET_NUM_MEASURGROUPS; i++)
prnt("%02d %*s %10s %i\n",i,TELNET_MAXMEASURNAME_LEN-1,measurgroups[i].groupname,
grouptypes[measurgroups[i].type], measurgroups[i].size);
} /* measurcmd_display_groups */
uint64_t measurcmd_getstatvalue(telnet_ltemeasurdef_t *measur,telnet_printfunc_t prnt) {
......@@ -105,7 +114,7 @@ void measurcmd_display_macstats_ue(telnet_printfunc_t prnt) {
for (int i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
int CC_id = UE_list->ordered_CCids[i][UE_id];
prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
eNB_UE_STATS *macstatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
eNB_UE_STATS *macuestatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
}
......@@ -178,19 +187,28 @@ int idx1, idx2;
if (s>0) {
if ( strcmp(subcmd,"groups") == 0)
measurcmd_display_groups(prnt);
else if ( strcmp(subcmd,"lte") == 0) {
measurcmd_display_macstats(prnt);
measurcmd_display_macstats_ue(prnt);
measurcmd_display_rlcstats(prnt);
else {
for (int i=0; i<TELNET_NUM_MEASURTYPES; i++) {
if(strcmp(subcmd,grouptypes[i]) == 0) {
for(int j=0; j<TELNET_NUM_MEASURGROUPS; j++) {
if(i == measurgroups[j].type) {
measurgroups[j].displayfunc(prnt);
}
else
prnt("%s: Unknown command\n",buf);
free(subcmd);
} /* for j...*/
}
}/* for i...*/
for (int i=0; i<TELNET_NUM_MEASURGROUPS; i++) {
if(strcmp(subcmd,measurgroups[i].groupname) == 0) {
measurgroups[i].displayfunc(prnt);
break;
}
}
}
free(subcmd);
} /* s>0 */
return 0;
}
/*-------------------------------------------------------------------------------------*/
void add_measur_cmds(void)
......
......@@ -56,12 +56,14 @@ typedef struct ltemeasurdef {
unsigned int statemask;
} telnet_ltemeasurdef_t;
#define GROUP_LTEMACSTATS 0
#define GROUP_LTESTATS 0
#define GROUP_CPUSTATS 1
typedef void(*measur_dislayfunc_t)(telnet_printfunc_t prnt);
typedef struct mesurgroupdef {
char groupname[TELNET_MAXMEASURNAME_LEN];
unsigned char type;
unsigned char size;
measur_dislayfunc_t displayfunc;
union {
telnet_cpumeasurdef_t *cpustats;
telnet_ltemeasurdef_t *ltestats;
......@@ -106,29 +108,29 @@ typedef struct mesurgroupdef {
#define LTEMAC_UEMEASURE \
{ \
{"dlsch_mcs1", &(macstatptr->dlsch_mcs1),TELNET_VARTYPE_INT8,0},\
{"dlsch_mcs2", &(macstatptr->dlsch_mcs2),TELNET_VARTYPE_INT8,0},\
{"rbs_used", &(macstatptr->rbs_used),TELNET_VARTYPE_INT32,0},\
{"rbs_used_retx", &(macstatptr->rbs_used_retx),TELNET_VARTYPE_INT16,0},\
{"total_rbs_used", &(macstatptr->total_rbs_used),TELNET_VARTYPE_INT16,0},\
{"ncce_used", &(macstatptr->ncce_used),TELNET_VARTYPE_INT16,0},\
{"ncce_used_retx", &(macstatptr->ncce_used_retx),TELNET_VARTYPE_INT16,0},\
{"TBS", &(macstatptr->TBS),TELNET_VARTYPE_INT32,0},\
{"total_pdu_bytes", &(macstatptr->total_pdu_bytes),TELNET_VARTYPE_INT64,0},\
{"total_num_pdus", &(macstatptr->total_num_pdus),TELNET_VARTYPE_INT32,0},\
{"overhead_bytes", &(macstatptr->overhead_bytes),TELNET_VARTYPE_INT64,0},\
{"crnti", &(macstatptr->crnti),TELNET_VARTYPE_INT16,0},\
{"normalized_rx_power", &(macstatptr->normalized_rx_power),TELNET_VARTYPE_INT32,0},\
{"target_rx_power", &(macstatptr->target_rx_power),TELNET_VARTYPE_INT32,0},\
{"ulsch_mcs1", &(macstatptr->ulsch_mcs1),TELNET_VARTYPE_INT8,0},\
{"ulsch_mcs2", &(macstatptr->ulsch_mcs2),TELNET_VARTYPE_INT8,0},\
{"rbs_used_rx", &(macstatptr->rbs_used_rx),TELNET_VARTYPE_INT32,0},\
{"rbs_used_retx_rx", &(macstatptr->rbs_used_retx_rx),TELNET_VARTYPE_INT32,0},\
{"total_rbs_used_rx", &(macstatptr->total_rbs_used_rx),TELNET_VARTYPE_INT32,0},\
{"ulsch_TBS", &(macstatptr->ulsch_TBS),TELNET_VARTYPE_INT32,0},\
{"total_pdu_bytes_rx", &(macstatptr->total_pdu_bytes_rx),TELNET_VARTYPE_INT64,0},\
{"total_num_pdus_rx", &(macstatptr->total_num_pdus_rx),TELNET_VARTYPE_INT32,0},\
{"num_errors_rx", &(macstatptr->num_errors_rx),TELNET_VARTYPE_INT32,0},\
{"dlsch_mcs1", &(macuestatptr->dlsch_mcs1),TELNET_VARTYPE_INT8,0},\
{"dlsch_mcs2", &(macuestatptr->dlsch_mcs2),TELNET_VARTYPE_INT8,0},\
{"rbs_used", &(macuestatptr->rbs_used),TELNET_VARTYPE_INT32,0},\
{"rbs_used_retx", &(macuestatptr->rbs_used_retx),TELNET_VARTYPE_INT16,0},\
{"total_rbs_used", &(macuestatptr->total_rbs_used),TELNET_VARTYPE_INT16,0},\
{"ncce_used", &(macuestatptr->ncce_used),TELNET_VARTYPE_INT16,0},\
{"ncce_used_retx", &(macuestatptr->ncce_used_retx),TELNET_VARTYPE_INT16,0},\
{"TBS", &(macuestatptr->TBS),TELNET_VARTYPE_INT32,0},\
{"total_pdu_bytes", &(macuestatptr->total_pdu_bytes),TELNET_VARTYPE_INT64,0},\
{"total_num_pdus", &(macuestatptr->total_num_pdus),TELNET_VARTYPE_INT32,0},\
{"overhead_bytes", &(macuestatptr->overhead_bytes),TELNET_VARTYPE_INT64,0},\
{"crnti", &(macuestatptr->crnti),TELNET_VARTYPE_INT16,0},\
{"normalized_rx_power", &(macuestatptr->normalized_rx_power),TELNET_VARTYPE_INT32,0},\
{"target_rx_power", &(macuestatptr->target_rx_power),TELNET_VARTYPE_INT32,0},\
{"ulsch_mcs1", &(macuestatptr->ulsch_mcs1),TELNET_VARTYPE_INT8,0},\
{"ulsch_mcs2", &(macuestatptr->ulsch_mcs2),TELNET_VARTYPE_INT8,0},\
{"rbs_used_rx", &(macuestatptr->rbs_used_rx),TELNET_VARTYPE_INT32,0},\
{"rbs_used_retx_rx", &(macuestatptr->rbs_used_retx_rx),TELNET_VARTYPE_INT32,0},\
{"total_rbs_used_rx", &(macuestatptr->total_rbs_used_rx),TELNET_VARTYPE_INT32,0},\
{"ulsch_TBS", &(macuestatptr->ulsch_TBS),TELNET_VARTYPE_INT32,0},\
{"total_pdu_bytes_rx", &(macuestatptr->total_pdu_bytes_rx),TELNET_VARTYPE_INT64,0},\
{"total_num_pdus_rx", &(macuestatptr->total_num_pdus_rx),TELNET_VARTYPE_INT32,0},\
{"num_errors_rx", &(macuestatptr->num_errors_rx),TELNET_VARTYPE_INT32,0},\
}
#define LTE_RLCMEASURE \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment