Commit 2960dba6 authored by frtabu's avatar frtabu

Merge branch 'NRUE_usedlschparallel' of...

Merge branch 'NRUE_usedlschparallel' of https://gitlab.eurecom.fr/oai/openairinterface5g into NRUE_usedlschparallel
parents 2708f1cb 165aca4b
......@@ -158,7 +158,13 @@ int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt) {
int s = sscanf(buf,"%ms %i-%i\n",&subcmd, &idx1,&idx2);
if (s>0) {
if ( strcmp(subcmd,"groups") == 0) {
if ( strcmp(subcmd,"inq") == 0) {
notifiedFIFO_elt_t *msg =newNotifiedFIFO_elt(sizeof(time_stats_msg_t),0,NULL,NULL);
time_stats_msg_t *msgdata=NotifiedFifoData(msg);
msgdata->msgid = TIMESTAT_MSGID_DISPLAY;
msgdata->displayFunc = (void (*)(void *))prnt;
pushNotifiedFIFO(&measur_fifo, msg);
} else if ( strcmp(subcmd,"groups") == 0){
measurcmd_display_groups(prnt,measurgroups,num_measurgroups);
badcmd=0;
} else {
......
......@@ -63,6 +63,7 @@ typedef struct ltemeasurdef {
#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];
......@@ -83,7 +84,7 @@ typedef struct mesurgroupdef {
int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt);
int measurcmd_cpustats(char *buf, int debug, telnet_printfunc_t prnt);
telnetshell_cmddef_t measur_cmdarray[] = {
{"show", "groups | <group name>" , measurcmd_show},
{"show", "groups | <group name> | inq" , measurcmd_show},
{"cpustats","[enable | disable]",measurcmd_cpustats},
{"","",NULL}
};
......
......@@ -184,15 +184,37 @@ void run_cpumeasur(void) {
measur_table[tsm->timestat_id]->diff += measur_table[tsm->timestat_id]->p_time;
if ( measur_table[tsm->timestat_id]->p_time > measur_table[tsm->timestat_id]->max )
measur_table[tsm->timestat_id]->max = measur_table[tsm->timestat_id]->p_time;
break;
case TIMESTAT_MSGID_DISPLAY:
{
char aline[256];
int start, stop;
if (tsm->displayFunc != NULL) {
if(tsm->timestat_id >= 0) {
start=tsm->timestat_id ;
stop=start+1;
}
else {
start=0;
stop=max_cpumeasur ;
}
for (int i=start ; i<stop ; i++) {
if (measur_table[i] != NULL) {
sprintf(aline,"%s: %15.3f us ",measur_table[i]->meas_name, measur_table[i]->trials==0?0:( (measur_table[i]->trials/measur_table[i]->diff )/ cpu_freq_GHz /1000 ));
tsm->displayFunc(aline);
}
}
}
}
break;
default:
break;
}
delNotifiedFIFO_elt(msg);
}
}
void init_meas(void)
{
pthread_t thid;
......
......@@ -59,11 +59,15 @@ typedef struct {
#define TIMESTAT_MSGID_START 0
#define TIMESTAT_MSGID_STOP 1
#define TIMESTAT_MSGID_DISPLAY 2
typedef struct {
int msgid; /*!< \brief message id, as defined by TIMESTAT_MSGID_X macros */
int timestat_id; /*!< \brief points to the time_stats_t entry in cpumeas table */
OAI_CPUTIME_TYPE ts; /*!< \brief time stamp */
void (*displayFunc)(void *); /*!< \brief function to call when DISPLAY message is received*/
} time_stats_msg_t;
static inline void start_meas(time_stats_t *ts) __attribute__((always_inline));
static inline void stop_meas(time_stats_t *ts) __attribute__((always_inline));
......@@ -128,20 +132,6 @@ static inline void stop_meas(time_stats_t *ts) {
}
}
static inline void send_meas(int measur_idx) {
if (opp_enabled) {
extern notifiedFIFO_t measur_fifo;
notifiedFIFO_elt_t *msg =newNotifiedFIFO_elt(sizeof(time_stats_msg_t),0,NULL,NULL);
time_stats_msg_t *tsm = (time_stats_msg_t *)NotifiedFifoData(msg);
tsm->ts = rdtsc_oai();
pushNotifiedFIFO(&measur_fifo, msg);
}
}
static inline void reset_meas(time_stats_t *ts) {
ts->in=0;
ts->diff=0;
......@@ -161,6 +151,7 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) {
}
#ifndef PHYSIM
extern notifiedFIFO_t measur_fifo;
#define CPUMEASUR_SECTION "cpumeasur"
#define CPUMEASUR_PARAMS_DESC { \
......@@ -169,5 +160,14 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) {
void init_meas(void);
int register_meas(char *name, time_stats_t *ts);
static inline void send_meas(int measur_idx) {
if (opp_enabled) {
notifiedFIFO_elt_t *msg =newNotifiedFIFO_elt(sizeof(time_stats_msg_t),0,NULL,NULL);
time_stats_msg_t *tsm = (time_stats_msg_t *)NotifiedFifoData(msg);
tsm->ts = rdtsc_oai();
pushNotifiedFIFO(&measur_fifo, msg);
}
}
#endif //ifndef PHYSIM
#endif
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