Commit bd1c609c authored by laurent's avatar laurent

issue 359 dlsim CPU measurements

parent f34e735e
...@@ -9,4 +9,5 @@ set(MU_RECIEVER False) ...@@ -9,4 +9,5 @@ set(MU_RECIEVER False)
set(NAS_UE False) set(NAS_UE False)
set(MESSAGE_CHART_GENERATOR False) set(MESSAGE_CHART_GENERATOR False)
set(RRC_ASN1_VERSION "Rel14") set(RRC_ASN1_VERSION "Rel14")
set (UE_TIMING_TRACE True)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
...@@ -847,6 +847,7 @@ typedef struct { ...@@ -847,6 +847,7 @@ typedef struct {
time_stats_t pdsch_procedures_stat[RX_NB_TH]; time_stats_t pdsch_procedures_stat[RX_NB_TH];
time_stats_t pdsch_procedures_per_slot_stat[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; time_stats_t pdsch_procedures_per_slot_stat[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME];
time_stats_t dlsch_procedures_stat[RX_NB_TH]; time_stats_t dlsch_procedures_stat[RX_NB_TH];
time_stats_t crnti_procedures_stats;
time_stats_t ofdm_demod_stats; time_stats_t ofdm_demod_stats;
time_stats_t dlsch_rx_pdcch_stats; time_stats_t dlsch_rx_pdcch_stats;
......
...@@ -1074,12 +1074,12 @@ typedef struct PHY_VARS_eNB_s { ...@@ -1074,12 +1074,12 @@ typedef struct PHY_VARS_eNB_s {
int hw_timing_advance; int hw_timing_advance;
time_stats_t phy_proc;
time_stats_t phy_proc_tx; time_stats_t phy_proc_tx;
time_stats_t phy_proc_rx; time_stats_t phy_proc_rx;
time_stats_t rx_prach; time_stats_t rx_prach;
time_stats_t ofdm_mod_stats; time_stats_t ofdm_mod_stats;
time_stats_t dlsch_common_and_dci;
time_stats_t dlsch_encoding_stats; time_stats_t dlsch_encoding_stats;
time_stats_t dlsch_modulation_stats; time_stats_t dlsch_modulation_stats;
time_stats_t dlsch_scrambling_stats; time_stats_t dlsch_scrambling_stats;
......
...@@ -484,6 +484,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -484,6 +484,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+(eNB->CC_id),1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+(eNB->CC_id),1);
if (do_meas==1) start_meas(&eNB->phy_proc_tx); if (do_meas==1) start_meas(&eNB->phy_proc_tx);
if (do_meas==1) start_meas(&eNB->dlsch_common_and_dci);
// clear the transmit data array for the current subframe // clear the transmit data array for the current subframe
for (aa=0; aa<fp->nb_antenna_ports_eNB; aa++) { for (aa=0; aa<fp->nb_antenna_ports_eNB; aa++) {
...@@ -578,6 +579,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -578,6 +579,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
subframe); subframe);
} }
if (do_meas==1) stop_meas(&eNB->dlsch_common_and_dci);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
......
This diff is collapsed.
static int cmpdouble(const void *p1, const void *p2) {
return *(double *)p1 > *(double *)p2;
}
double median(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize);
}
double q1(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(input->size/4)*input->atomSize);
}
double q3(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(3*input->size/4)*input->atomSize);
}
void dumpVarArray(varArray_t *input) {
double *ptr=dataArray(input);
printf("dumping size=%ld\n", input->size);
for (int i=0; i < input->size; i++)
printf("%.1f:", *ptr++);
printf("\n");
}
void sumUpStats(time_stats_t * res, time_stats_t * src, int lastActive) {
reset_meas(res);
for (int i=0; i<RX_NB_TH; i++) {
res->diff+=src[i].diff;
res->diff_square+=src[i].diff_square;
res->trials+=src[i].trials;
if (src[i].max > res->max)
res->max=src[i].max;
}
res->p_time=src[lastActive].p_time;
}
void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastActive) {
reset_meas(res);
for (int i=0; i<RX_NB_TH; i++) {
res->diff+=src[i][0].diff+src[i][1].diff;
res->diff_square+=src[i][0].diff_square+src[i][1].diff_square;
res->trials+=src[i][0].trials+src[i][1].trials;
if (src[i][0].max > res->max)
res->max=src[i][0].max;
if (src[i][1].max > res->max)
res->max=src[i][1].max;}
int last=src[lastActive][0].in < src[lastActive][1].in? 1 : 0 ;
res->p_time=src[lastActive][last].p_time;
}
void printStatIndent(time_stats_t *ptr, char *txt) {
printf("|__ %-50s %.2f us (%d trials)\n",
txt,
ptr->trials?inMicroS(ptr->diff/ptr->trials):0,
ptr->trials);
}
void printStatIndent2(time_stats_t *ptr, char *txt, int turbo_iter) {
double timeBase=1/(1000*cpu_freq_GHz);
printf(" |__ %-45s %.2f us (cycles/block %ld, %5d trials)\n",
txt,
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
turbo_iter?(uint64_t)round(((double)ptr->diff)/turbo_iter):0,
ptr->trials);
}
double squareRoot(time_stats_t *ptr) {
double timeBase=1/(1000*cpu_freq_GHz);
return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials -
pow((double)ptr->diff/ptr->trials*timeBase,2));
}
void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) {
double timeBase=1/(1000*cpu_freq_GHz);
printf("%-50s :%.2f us (%d trials)\n",
txt,
(double)ptr->diff/ptr->trials*timeBase,
ptr->trials);
printf("|__ Statistics std=%.2f, median=%.2f, q1=%.2f, q3=%.2f µs (on %ld trials)\n",
squareRoot(ptr), median(sortedList),q1(sortedList),q3(sortedList), sortedList->size);
}
void logDistribution(FILE* fd, time_stats_t *ptr, varArray_t *sortedList, int dropped) {
fprintf(fd,"%f;%f;%f;%f;%f;%f;%d;",
squareRoot(ptr),
(double)ptr->max, *(double*)dataArray(sortedList),
median(sortedList),q1(sortedList),q3(sortedList),
dropped);
}
struct option * parse_oai_options(paramdef_t *options) {
int l;
for(l=0; options[l].optname[0]!=0; l++) {};
struct option *long_options=calloc(sizeof(struct option),l);
for(int i=0; options[i].optname[0]!=0; i++) {
long_options[i].name=options[i].optname;
long_options[i].has_arg=options[i].paramflags==PARAMFLAG_BOOL?no_argument:required_argument;
if ( options[i].voidptr)
switch (options[i].type) {
case TYPE_INT:
*options[i].iptr=options[i].defintval;
break;
case TYPE_DOUBLE:
*options[i].dblptr=options[i].defdblval;
break;
case TYPE_UINT8:
*options[i].u8ptr=options[i].defintval;
break;
case TYPE_UINT16:
*options[i].u16ptr=options[i].defintval;
break;
default:
printf("not parsed type for default value %s\n", options[i].optname );
exit(1);
}
continue;
};
return long_options;
}
void display_options_values(paramdef_t *options, int verbose) {
for(paramdef_t * ptr=options; ptr->optname[0]!=0; ptr++) {
char varText[256]="need specific display";
if (ptr->voidptr != NULL) {
if ( (ptr->paramflags & PARAMFLAG_BOOL) )
strcpy(varText, *(bool *)ptr->iptr ? "True": "False" );
else switch (ptr->type) {
case TYPE_INT:
sprintf(varText,"%d",*ptr->iptr);
break;
case TYPE_DOUBLE:
sprintf(varText,"%.2f",*ptr->dblptr);
break;
case TYPE_UINT8:
sprintf(varText,"%d",(int)*ptr->u8ptr);
break;
case TYPE_UINT16:
sprintf(varText,"%d",(int)*ptr->u16ptr);
break;
default:
printf("not decoded type\n");
exit(1);
}
}
printf("--%-20s set to %s\n",ptr->optname, varText);
if (verbose) printf("%s\n",ptr->helpstr);
}
}
This diff is collapsed.
/* /*
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file * the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License. * except in compliance with the License.
You may obtain a copy of the License at * You may obtain a copy of the License at
*
http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
*
Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
limitations under the License. * limitations under the License.
------------------------------------------------------------------------------- *-------------------------------------------------------------------------------
For more information about the OpenAirInterface (OAI) Software Alliance: * For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file ulsim.c /*! \file ulsim.c
\brief Top-level UL simulator \brief Top-level UL simulator
...@@ -60,32 +60,7 @@ ...@@ -60,32 +60,7 @@
double cpuf; double cpuf;
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) #define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
//#define MCS_COUNT 23//added for PHY abstraction //#define MCS_COUNT 23//added for PHY abstraction
static int cmpdouble(const void *p1, const void *p2) { #include <openair1/SIMULATION/LTE_PHY/common_sim.h>
return *(double *)p1 > *(double *)p2;
}
double median(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize);
}
double q1(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(input->size/4)*input->atomSize);
}
double q3(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(3*input->size/4)*input->atomSize);
}
void dumpVarArray(varArray_t *input) {
double *ptr=dataArray(input);
printf("dumping size=%ld\n", input->size);
for (int i=0; i < input->size; i++)
printf("%.1f:", *ptr++);
printf("\n");
}
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX]; channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
//Added for PHY abstractionopenair1/PHY/TOOLS/lte_phy_scope.h //Added for PHY abstractionopenair1/PHY/TOOLS/lte_phy_scope.h
...@@ -348,48 +323,8 @@ void fill_ulsch_dci(PHY_VARS_eNB *eNB, ...@@ -348,48 +323,8 @@ void fill_ulsch_dci(PHY_VARS_eNB *eNB,
ul_req->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; ul_req->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
} }
void printStatIndent(time_stats_t *ptr, char *txt) {
printf("|__ %-50s %.2f us (%d trials)\n",
txt,
inMicroS(ptr->diff/ptr->trials),
ptr->trials);
}
void printStatIndent2(time_stats_t *ptr, char *txt, int turbo_iter) {
double timeBase=1/(1000*cpu_freq_GHz);
printf(" |__ %-45s %.2f us (cycles/block %7g, %5d trials)\n",
txt,
((double)ptr->diff)/ptr->trials*timeBase,
round(((double)ptr->diff)/turbo_iter),
ptr->trials);
}
double squareRoot(time_stats_t *ptr) {
double timeBase=1/(1000*cpu_freq_GHz);
return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials -
pow((double)ptr->diff/ptr->trials*timeBase,2));
}
void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) {
double timeBase=1/(1000*cpu_freq_GHz);
printf("%-50s :%.2f us (%d trials)\n",
txt,
(double)ptr->diff/ptr->trials*timeBase,
ptr->trials);
printf("|__ Statistics std=%.2f, median=%.2f, q1=%.2f, q3=%.2f µs (on %ld trials)\n",
squareRoot(ptr), median(sortedList),q1(sortedList),q3(sortedList), sortedList->size);
}
void logDistribution(FILE* fd, time_stats_t *ptr, varArray_t *sortedList, int dropped) {
fprintf(fd,"%f;%f;%f;%f;%f;%f;%d;",
squareRoot(ptr),
(double)ptr->max, *(double*)dataArray(sortedList),
median(sortedList),q1(sortedList),q3(sortedList),
dropped);
}
enum eTypes { eBool, eInt, eFloat, eText }; enum eTypes { eBool, eInt, eFloat, eText };
static int verbose,disable_bundling=0,cqi_flag=0, extended_prefix_flag=0, test_perf=0, subframe=3, transmission_m=1,n_rx=1; static int verbose,help,disable_bundling=0,cqi_flag=0, extended_prefix_flag=0, test_perf=0, subframe=3, transmission_m=1,n_rx=1;
int main(int argc, char **argv) { int main(int argc, char **argv) {
int i,j,aa,u; int i,j,aa,u;
...@@ -505,13 +440,13 @@ int main(int argc, char **argv) { ...@@ -505,13 +440,13 @@ int main(int argc, char **argv) {
//set_glog(LOG_DEBUG,LOG_MED); //set_glog(LOG_DEBUG,LOG_MED);
//hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:LF //hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:LF
static paramdef_t options[] = { static paramdef_t options[] = {
{ "awgn", "Additive white gaussian noise", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL }, { "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL },
{ "BnbRBs", "The LTE bandwith in RBs (100 is 20MHz)",0, iptr:&N_RB_DL, defintval:25, TYPE_INT, 0 }, { "BnbRBs", "The LTE bandwith in RBs (100 is 20MHz)",0, iptr:&N_RB_DL, defintval:25, TYPE_INT, 0 },
{ "mcs", "The MCS to use", 0, iptr:&mcs, defintval:10, TYPE_INT, 0 }, { "mcs", "The MCS to use", 0, iptr:&mcs, defintval:10, TYPE_INT, 0 },
{ "nb_frame", "number of frame in a test",0, iptr:&n_frames, defintval:1, TYPE_INT, 0 }, { "nb_frame", "number of frame in a test",0, iptr:&n_frames, defintval:1, TYPE_INT, 0 },
{ "snr", "starting snr", 0, dblptr:&snr0, defdblval:-2.9, TYPE_DOUBLE, 0 }, { "snr", "starting snr", 0, dblptr:&snr0, defdblval:-2.9, TYPE_DOUBLE, 0 },
{ "wsnrInterrupt", "snr int ?", 0, dblptr:&snr_int, defdblval:30, TYPE_DOUBLE, 0 }, { "wsnrInterrupt", "snr int ?", 0, dblptr:&snr_int, defdblval:30, TYPE_DOUBLE, 0 },
{ "e_snr_step", "step increasint snr",0, dblptr:&input_snr_step, defdblval:0.2, TYPE_DOUBLE, 0 }, { "e_snr_step", "step increasing snr",0, dblptr:&input_snr_step, defdblval:0.2, TYPE_DOUBLE, 0 },
{ "rb_dynamic", "number of rb in dynamic allocation",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, { "rb_dynamic", "number of rb in dynamic allocation",0, iptr:NULL, defintval:0, TYPE_INT, 0 },
{ "first_rb", "first rb used in dynamic allocation",0, iptr:&first_rb, defintval:0, TYPE_INT, 0 }, { "first_rb", "first rb used in dynamic allocation",0, iptr:&first_rb, defintval:0, TYPE_INT, 0 },
{ "osrs", "enable srs generation",PARAMFLAG_BOOL, iptr:&srs_flag, defintval:0, TYPE_INT, 0 }, { "osrs", "enable srs generation",PARAMFLAG_BOOL, iptr:&srs_flag, defintval:0, TYPE_INT, 0 },
...@@ -538,37 +473,12 @@ int main(int argc, char **argv) { ...@@ -538,37 +473,12 @@ int main(int argc, char **argv) {
{ "bundling_disable", "bundling disable",PARAMFLAG_BOOL, iptr:&disable_bundling, defintval:0, TYPE_INT, 0 }, { "bundling_disable", "bundling disable",PARAMFLAG_BOOL, iptr:&disable_bundling, defintval:0, TYPE_INT, 0 },
{ "Y", "n_ch_rlz",0, iptr:&n_ch_rlz, defintval:1, TYPE_INT, 0 }, { "Y", "n_ch_rlz",0, iptr:&n_ch_rlz, defintval:1, TYPE_INT, 0 },
{ "X", "abstx", PARAMFLAG_BOOL, iptr:&abstx, defintval:0, TYPE_INT, 0 }, { "X", "abstx", PARAMFLAG_BOOL, iptr:&abstx, defintval:0, TYPE_INT, 0 },
{ "Operf", "test perf mode ?",0, iptr:&test_perf, defintval:0, TYPE_INT, 0 }, { "Operf", "Set the percentage of effective rate to testbench the modem performance (typically 30 and 70, range 1-100)",0, iptr:&test_perf, defintval:0, TYPE_INT, 0 },
{ "verbose", "display debug text", PARAMFLAG_BOOL, iptr:&verbose, defintval:0, TYPE_INT, 0 }, { "verbose", "display debug text", PARAMFLAG_BOOL, iptr:&verbose, defintval:0, TYPE_INT, 0 },
{ "help", "display help and exit", PARAMFLAG_BOOL, iptr:&help, defintval:0, TYPE_INT, 0 },
{ "", "",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, { "", "",0, iptr:NULL, defintval:0, TYPE_INT, 0 },
}; };
int l; struct option * long_options = parse_oai_options(options);
for(l=0; options[l].optname[0]!=0; l++) {};
struct option *long_options=calloc(sizeof(struct option),l);
for(int i=0; options[i].optname[0]!=0; i++) {
long_options[i].name=options[i].optname;
long_options[i].has_arg=options[i].paramflags==PARAMFLAG_BOOL?no_argument:required_argument;
if ( options[i].voidptr)
switch (options[i].type) {
case TYPE_INT:
*options[i].iptr=options[i].defintval;
break;
case TYPE_DOUBLE:
*options[i].dblptr=options[i].defdblval;
break;
default:
printf("not parsed type for default value %s\n", options[i].optname );
exit(1);
}
continue;
};
int option_index; int option_index;
...@@ -587,6 +497,14 @@ int main(int argc, char **argv) { ...@@ -587,6 +497,14 @@ int main(int argc, char **argv) {
*(double *)options[option_index].dblptr=atof(optarg); *(double *)options[option_index].dblptr=atof(optarg);
break; break;
case TYPE_UINT8:
*(uint8_t *)options[option_index].dblptr=atoi(optarg);
break;
case TYPE_UINT16:
*(uint16_t *)options[option_index].dblptr=atoi(optarg);
break;
default: default:
printf("not decoded type.\n"); printf("not decoded type.\n");
exit(1); exit(1);
...@@ -683,7 +601,7 @@ int main(int argc, char **argv) { ...@@ -683,7 +601,7 @@ int main(int argc, char **argv) {
break; break;
default: default:
printf("Wrong option\n"); printf("Wrong option: %s\n",long_options[option_index].name);
exit(1); exit(1);
break; break;
} }
...@@ -694,34 +612,12 @@ int main(int argc, char **argv) { ...@@ -694,34 +612,12 @@ int main(int argc, char **argv) {
exit(1); exit(1);
} }
paramdef_t *ptr=options ;
for( ptr=options; ptr->optname[0]!=0; ptr++) {
char varText[256]="need specific display";
if (ptr->voidptr != NULL) {
if ( (ptr->paramflags & PARAMFLAG_BOOL) )
strcpy(varText, *(bool *)ptr->iptr ? "True": "False" );
else switch (ptr->type) {
case TYPE_INT:
sprintf(varText,"%d",*ptr->iptr);
break;
case TYPE_DOUBLE: if (help || verbose )
sprintf(varText,"%.2f",*ptr->dblptr); display_options_values(options, true);
break; if (help)
exit(0);
default:
printf("not decoded type\n");
exit(1);
}
}
printf("Option: %20s set to %s\n",ptr->optname, varText);
if (verbose)
printf("%s\n",ptr->helpstr);
}
set_parallel_conf("PARALLEL_RU_L1_TRX_SPLIT"); set_parallel_conf("PARALLEL_RU_L1_TRX_SPLIT");
set_worker_conf("WORKER_ENABLE"); set_worker_conf("WORKER_ENABLE");
RC.nb_L1_inst = 1; RC.nb_L1_inst = 1;
......
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