Commit fc9c5084 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/nr-ue-pdsch-time-stats-fix' into integration_2024_w31

parents 89aad980 b242a483
......@@ -2124,7 +2124,7 @@ target_link_libraries(nr-uesoftmodem PRIVATE
ITTI LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU SIMU_ETH shlib_loader
-Wl,--end-group z dl)
target_link_libraries(nr-uesoftmodem PRIVATE pthread m CONFIG_LIB rt)
target_link_libraries(nr-uesoftmodem PRIVATE pthread m CONFIG_LIB rt nr_ue_phy_meas)
target_link_libraries(nr-uesoftmodem PRIVATE ${T_LIB})
target_link_libraries(nr-uesoftmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
......@@ -2256,7 +2256,7 @@ add_executable(nr_dlsim
)
target_link_libraries(nr_dlsim PRIVATE
-Wl,--start-group UTIL SIMU SIMU_ETH PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON nr_rrc CONFIG_LIB L2_NR HASHTABLE x2ap SECURITY ngap -lz -Wl,--end-group
m pthread ${T_LIB} ITTI dl shlib_loader
m pthread ${T_LIB} ITTI dl shlib_loader nr_ue_phy_meas
)
target_link_libraries(nr_dlsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
......@@ -2297,7 +2297,7 @@ endif()
target_link_libraries(nr_ulsim PRIVATE
-Wl,--start-group UTIL SIMU SIMU_ETH PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON nr_rrc CONFIG_LIB L2_NR HASHTABLE x2ap SECURITY ngap -lz -Wl,--end-group
m pthread ${T_LIB} ITTI dl shlib_loader
m pthread ${T_LIB} ITTI dl shlib_loader nr_ue_phy_meas
)
target_link_libraries(nr_ulsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
......
......@@ -86,7 +86,15 @@ int get_measurgroups(telnet_measurgroupdef_t **measurgroups) {
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[0][0];
telnet_cpumeasurdef_t cpumeasur[]=CPU_PHYNRUE_MEASURE;
telnet_cpumeasurdef_t cpumeasur[MAX_CPU_STAT_TYPE];
for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
sprintf(cpumeasur[i].statname, "%s", UE->phy_cpu_stats.cpu_time_stats[i].meas_name);
cpumeasur[i].astatptr = &UE->phy_cpu_stats.cpu_time_stats[i];
cpumeasur[i].statemask = 0;
cpumeasur[i].num_occur1 = 1;
cpumeasur[i].num_occur2 = 0;
cpumeasur[i].num_occur3 = 0;
}
prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
PRINT_CPUMEAS_STATE,HDR);
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
......
......@@ -95,51 +95,4 @@
{"ip_pdcp", &(pdcpvars->ip_pdcp),0,1},\
}
/* from openair1/PHY/defs_nr_UE.h */
#define CPU_PHYNRUE_MEASURE \
{ \
{"phy_proc", &(UE->phy_proc),0,1},\
{"phy_proc_rx", &(UE-> phy_proc_rx),0,1},\
{"phy_proc_tx", &(UE->phy_proc_tx),0,1},\
{"ue_ul_indication_stats", &(UE->ue_ul_indication_stats),0,1},\
{"ofdm_mod_stats", &(UE->ofdm_mod_stats),0,1},\
{"ulsch_encoding_stats", &(UE->ulsch_encoding_stats),0,1},\
{"ulsch_modulation_stats", &(UE->ulsch_modulation_stats),0,1},\
{"ulsch_segmentation_stats", &(UE->ulsch_segmentation_stats),0,1},\
{"ulsch_rate_matching_stats", &(UE->ulsch_rate_matching_stats),0,1},\
{"ulsch_ldpc_encoding_stats", &(UE->ulsch_ldpc_encoding_stats),0,1},\
{"ulsch_interleaving_stats", &(UE->ulsch_interleaving_stats),0,1},\
{"ulsch_multiplexing_stats", &(UE->ulsch_multiplexing_stats),0,1},\
{"ofdm_demod_stats", &(UE->ofdm_demod_stats),0,1},\
{"dlsch_rx_pdcch_stats", &(UE->dlsch_rx_pdcch_stats),0,1},\
{"rx_dft_stats", &(UE->rx_dft_stats),0,1},\
{"dlsch_c...timation_stats", &(UE->dlsch_channel_estimation_stats),0,1},\
{"dlsch_f...timation_stats", &(UE->dlsch_freq_offset_estimation_stats),0,1},\
{"dlsch_demodulation_stats", &(UE->dlsch_demodulation_stats),0,1},\
{"dlsch_rate_unmatching_stats", &(UE->dlsch_rate_unmatching_stats),0,1},\
{"dlsch_ldpc_decoding_stats", &(UE->dlsch_ldpc_decoding_stats),0,1},\
{"dlsch_deinterleaving_stats", &(UE->dlsch_deinterleaving_stats),0,1},\
{"dlsch_llr_stats", &(UE->dlsch_llr_stats),0,1},\
{"dlsch_unscrambling_stats", &(UE->dlsch_unscrambling_stats),0,1},\
{"dlsch_rate_matching_stats", &(UE->dlsch_rate_matching_stats),0,1},\
{"dlsch_ldpc_encoding_stats", &(UE->dlsch_ldpc_encoding_stats),0,1},\
{"dlsch_interleaving_stats", &(UE->dlsch_interleaving_stats),0,1},\
{"dlsch_tc_init_stats", &(UE->dlsch_tc_init_stats),0,1},\
{"dlsch_tc_alpha_stats", &(UE->dlsch_tc_alpha_stats),0,1},\
{"dlsch_tc_beta_stats", &(UE->dlsch_tc_beta_stats),0,1},\
{"dlsch_tc_gamma_stats", &(UE->dlsch_tc_gamma_stats),0,1},\
{"dlsch_tc_ext_stats", &(UE->dlsch_tc_ext_stats),0,1},\
{"dlsch_tc_intl1_stats", &(UE->dlsch_tc_intl1_stats),0,1},\
{"dlsch_tc_intl2_stats", &(UE->dlsch_tc_intl2_stats),0,1},\
{"tx_prach", &(UE->tx_prach),0,1},\
{"ue_front_end_stat", &(UE->ue_front_end_stat),0,1},\
{"ue_front_end_per_slot_stat", &(UE->ue_front_end_per_slot_stat[0]),0,LTE_SLOTS_PER_SUBFRAME},\
{"pdcch_procedures_stat", &(UE->pdcch_procedures_stat),0,1},\
{"rx_pdsch_stats", &(UE->rx_pdsch_stats), 0, 1}, \
{"pdsch_procedures_stat", &(UE->pdsch_procedures_stat),0,1},\
{"pdsch_procedures_per_slot_stat", &(UE->pdsch_procedures_per_slot_stat[0]),0,LTE_SLOTS_PER_SUBFRAME},\
{"dlsch_procedures_stat", &(UE->dlsch_procedures_stat),0,1},\
{"dlsch_decoding_stats", &(UE->dlsch_decoding_stats),0,1},\
{"dlsch_llr_stats_para", &(UE->dlsch_llr_stats_parallelization[0]),0,LTE_SLOTS_PER_SUBFRAME},\
}
#endif
......@@ -100,17 +100,14 @@ static size_t dump_L1_UE_meas_stats(PHY_VARS_NR_UE *ue, char *output, size_t max
{
const char *begin = output;
const char *end = output + max_len;
output += print_meas_log(&ue->phy_proc_tx, "L1 TX processing", NULL, NULL, output, end - output);
output += print_meas_log(&ue->ulsch_encoding_stats, "ULSCH encoding", NULL, NULL, output, end - output);
output += print_meas_log(&ue->phy_proc_rx, "L1 RX processing", NULL, NULL, output, end - output);
output += print_meas_log(&ue->ue_ul_indication_stats, "UL Indication", NULL, NULL, output, end - output);
output += print_meas_log(&ue->rx_pdsch_stats, "PDSCH receiver", NULL, NULL, output, end - output);
output += print_meas_log(&ue->dlsch_decoding_stats, "PDSCH decoding", NULL, NULL, output, end - output);
output += print_meas_log(&ue->dlsch_deinterleaving_stats, " -> Deinterleive", NULL, NULL, output, end - output);
output += print_meas_log(&ue->dlsch_rate_unmatching_stats, " -> Rate Unmatch", NULL, NULL, output, end - output);
output += print_meas_log(&ue->dlsch_ldpc_decoding_stats, " -> LDPC Decode", NULL, NULL, output, end - output);
output += print_meas_log(&ue->dlsch_unscrambling_stats, "PDSCH unscrambling", NULL, NULL, output, end - output);
output += print_meas_log(&ue->dlsch_rx_pdcch_stats, "PDCCH handling", NULL, NULL, output, end - output);
for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
output += print_meas_log(&ue->phy_cpu_stats.cpu_time_stats[i],
ue->phy_cpu_stats.cpu_time_stats[i].meas_name,
NULL,
NULL,
output,
end - output);
}
return output - begin;
}
......
......@@ -503,6 +503,7 @@ int main(int argc, char **argv)
set_options(CC_id, UE[CC_id]);
NR_UE_MAC_INST_t *mac = get_mac_inst(inst);
init_nr_ue_phy_cpu_stats(&UE[CC_id]->phy_cpu_stats);
if (get_softmodem_params()->sa || get_softmodem_params()->sl_mode) { // set frame config to initial values from command line
// and assume that the SSB is centered on the grid
......
......@@ -184,14 +184,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
rxdata_ptr = (int16_t *)tmp_dft_in;
}
start_meas(&ue->rx_dft_stats);
start_meas_nr_ue_phy(ue, RX_DFT_STATS);
dft(dftsize,
rxdata_ptr,
(int16_t *)&rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
1);
stop_meas(&ue->rx_dft_stats);
stop_meas_nr_ue_phy(ue, RX_DFT_STATS);
apply_nr_rotation_RX(frame_parms, rxdataF[aa], frame_parms->symbol_rotation[linktype], Ns, frame_parms->N_RB_DL, 0, symbol, 1);
}
......
......@@ -83,9 +83,9 @@ static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue,
NR_UE_DLSCH_t *dlsch = (NR_UE_DLSCH_t *) rdata->dlsch;
int r = rdata->segment_r;
merge_meas(&phy_vars_ue->dlsch_deinterleaving_stats, &rdata->ts_deinterleave);
merge_meas(&phy_vars_ue->dlsch_rate_unmatching_stats, &rdata->ts_rate_unmatch);
merge_meas(&phy_vars_ue->dlsch_ldpc_decoding_stats, &rdata->ts_ldpc_decode);
merge_meas(&phy_vars_ue->phy_cpu_stats.cpu_time_stats[DLSCH_DEINTERLEAVING_STATS], &rdata->ts_deinterleave);
merge_meas(&phy_vars_ue->phy_cpu_stats.cpu_time_stats[DLSCH_RATE_UNMATCHING_STATS], &rdata->ts_rate_unmatch);
merge_meas(&phy_vars_ue->phy_cpu_stats.cpu_time_stats[DLSCH_LDPC_DECODING_STATS], &rdata->ts_ldpc_decode);
bool decodeSuccess = (rdata->decodeIterations < (1+dlsch->max_ldpc_iterations));
......
......@@ -438,12 +438,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//--------------------- RBs extraction ---------------------
//----------------------------------------------------------
const int n_rx = frame_parms->nb_antennas_rx;
time_stats_t meas = {0};
const bool meas_enabled = cpumeas(CPUMEAS_GETSTATE);
if (meas_enabled)
start_meas(&meas);
{
start_meas_nr_ue_phy(ue, DLSCH_EXTRACT_RBS_STATS);
__attribute__((aligned(32))) c16_t rxdataF_ext[nbRx][rx_size_symbol];
memset(rxdataF_ext, 0, sizeof(rxdataF_ext));
......@@ -469,15 +467,15 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch_config->dlDmrsSymbPos,
csi_res_bitmap,
ue->chest_time);
stop_meas_nr_ue_phy(ue, DLSCH_EXTRACT_RBS_STATS);
if (meas_enabled) {
stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d: Pilot/Data extraction %5.2f \n",
frame,
nr_slot_rx,
slot,
symbol,
meas.p_time / (cpuf * 1000.0));
ue->phy_cpu_stats.cpu_time_stats[DLSCH_EXTRACT_RBS_STATS].p_time / (cpuf * 1000.0));
}
if (ue->phy_sim_pdsch_rxdataF_ext)
for (unsigned char aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
......@@ -491,25 +489,23 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//----------------------------------------------------------
//--------------------- Channel Scaling --------------------
//----------------------------------------------------------
if (meas_enabled)
start_meas(&meas);
start_meas_nr_ue_phy(ue, DLSCH_CHANNEL_SCALE_STATS);
nr_dlsch_scale_channel(rx_size_symbol, dl_ch_estimates_ext, frame_parms, nl, n_rx, symbol, pilots, nb_re_pdsch, nb_rb_pdsch);
stop_meas_nr_ue_phy(ue, DLSCH_CHANNEL_SCALE_STATS);
if (meas_enabled) {
stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",
frame,
nr_slot_rx,
slot,
symbol,
meas.p_time / (cpuf * 1000.0));
ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_SCALE_STATS].p_time / (cpuf * 1000.0));
}
//----------------------------------------------------------
//--------------------- Channel Level Calc. ----------------
//----------------------------------------------------------
if (meas_enabled)
start_meas(&meas);
start_meas_nr_ue_phy(ue, DLSCH_CHANNEL_LEVEL_STATS);
if (first_symbol_flag) {
int32_t avg[MAX_ANT][MAX_ANT] = {};
if (nb_re_pdsch)
......@@ -537,8 +533,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
// LOG_I(PHY, "avgs Power per SC is %d lg2_maxh %d\n", avgs, log2_maxh);
LOG_D(PHY, "[DLSCH] AbsSubframe %d.%d log2_maxh = %d (%d)\n", frame % 1024, nr_slot_rx, *log2_maxh, avgs);
}
stop_meas_nr_ue_phy(ue, DLSCH_CHANNEL_LEVEL_STATS);
if (meas_enabled) {
stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",
frame,
......@@ -546,7 +542,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
slot,
symbol,
first_symbol_flag,
meas.p_time / (cpuf * 1000.0));
ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_LEVEL_STATS].p_time / (cpuf * 1000.0));
}
#if T_TRACER
T(T_UE_PHY_PDSCH_ENERGY, T_INT(gNB_id), T_INT(0), T_INT(frame % 1024), T_INT(nr_slot_rx));
......@@ -556,8 +552,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//--------------------- channel compensation ---------------
//----------------------------------------------------------
// Disable correlation measurement for optimizing UE
if (meas_enabled)
start_meas(&meas);
start_meas_nr_ue_phy(ue, DLSCH_CHANNEL_COMPENSATION_STATS);
nr_dlsch_channel_compensation(rx_size_symbol,
nbRx,
rxdataF_ext,
......@@ -576,8 +571,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nb_rb_pdsch,
*log2_maxh,
measurements); // log2_maxh+I0_shift
stop_meas_nr_ue_phy(ue, DLSCH_CHANNEL_COMPENSATION_STATS);
if (meas_enabled) {
stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d Channel Comp %5.2f \n",
frame,
......@@ -585,13 +580,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
slot,
symbol,
*log2_maxh,
meas.p_time / (cpuf * 1000.0));
ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_COMPENSATION_STATS].p_time / (cpuf * 1000.0));
}
}
if (meas_enabled)
start_meas(&meas);
start_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS);
if (n_rx > 1) {
nr_dlsch_detection_mrc(rx_size_symbol,
nl,
......@@ -620,20 +613,20 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nb_re_pdsch,
nvar);
}
stop_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS);
if (meas_enabled) {
stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine and MMSE %5.2f \n",
frame,
nr_slot_rx,
slot,
symbol,
meas.p_time / (cpuf * 1000.0));
ue->phy_cpu_stats.cpu_time_stats[DLSCH_MRC_MMSE_STATS].p_time / (cpuf * 1000.0));
}
if (meas_enabled)
start_meas(&meas);
/* Store the valid DL RE's */
dl_valid_re[symbol-1] = nb_re_pdsch;
int startSymbIdx = 0;
......@@ -682,6 +675,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
else
first_symbol_flag = 0;
/* Calculate LLR's for each symbol */
start_meas_nr_ue_phy(ue, DLSCH_LLR_STATS);
nr_dlsch_llr(rx_size_symbol,
nbRx,
rx_llr_layer_size,
......@@ -703,8 +697,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nr_slot_rx,
dlsch,
llr_offset);
stop_meas_nr_ue_phy(ue, DLSCH_LLR_STATS);
}
start_meas_nr_ue_phy(ue, DLSCH_LAYER_DEMAPPING);
nr_dlsch_layer_demapping(llr,
dlsch[0].Nl,
dlsch[0].dlsch_config.qamModOrder,
......@@ -713,6 +709,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
codeword_TB1,
rx_llr_layer_size,
layer_llr);
stop_meas_nr_ue_phy(ue, DLSCH_LAYER_DEMAPPING);
// Please keep it: useful for debugging
#ifdef DEBUG_PDSCH_RX
char filename[50];
......@@ -742,14 +739,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
}
if (meas_enabled) {
stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",
frame,
nr_slot_rx,
slot,
symbol,
meas.p_time / (cpuf * 1000.0));
ue->phy_cpu_stats.cpu_time_stats[DLSCH_LLR_STATS].p_time / (cpuf * 1000.0));
}
#if T_TRACER
......
......@@ -48,7 +48,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
uint32_t tb_size,
unsigned int G)
{
start_meas(&ue->ulsch_encoding_stats);
start_meas_nr_ue_phy(ue, ULSCH_ENCODING_STATS);
/////////////////////////parameters and variables initialization/////////////////////////
......@@ -107,7 +107,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
harq_process->BG = ulsch->pusch_pdu.ldpcBaseGraph;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_IN);
start_meas(&ue->ulsch_segmentation_stats);
start_meas_nr_ue_phy(ue, ULSCH_SEGMENTATION_STATS);
impp.Kb = nr_segmentation(harq_process->payload_AB,
harq_process->c,
B,
......@@ -126,7 +126,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
LOG_E(PHY, "nr_segmentation.c: too many segments %d, B %d\n", impp.n_segments, B);
return(-1);
}
stop_meas(&ue->ulsch_segmentation_stats);
stop_meas_nr_ue_phy(ue, ULSCH_SEGMENTATION_STATS);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_OUT);
#ifdef DEBUG_ULSCH_CODING
......@@ -148,7 +148,8 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_IN);
}
start_meas(&ue->ulsch_ldpc_encoding_stats);
start_meas_nr_ue_phy(ue, ULSCH_LDPC_ENCODING_STATS);
if (ldpc_interface_offload.LDPCencoder) {
for (int j = 0; j < impp.n_segments; j++) {
impp.perCB[j].E_cb = nr_get_E(G, impp.n_segments, impp.Qm, ulsch->pusch_pdu.nrOfLayers, j);
......@@ -168,6 +169,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
write_output("ulsch_enc_output0.m", "enc0", &harq_process->d[0][0], (3 * 8 * Kr_bytes) + 12, 1, 4);
#endif
}
stop_meas_nr_ue_phy(ue, ULSCH_LDPC_ENCODING_STATS);
///////////////////////////////////////////////////////////////////////////////
for (int r = 0; r < impp.n_segments; r++) { // looping over C segments
if (impp.F > 0) {
......@@ -191,7 +193,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
impp.perCB[r].E_cb = nr_get_E(G, impp.n_segments, impp.Qm, ulsch->pusch_pdu.nrOfLayers, r);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
start_meas(&ue->ulsch_rate_matching_stats);
start_meas(&ue->phy_cpu_stats.cpu_time_stats[ULSCH_RATE_MATCHING_STATS]);
if (nr_rate_matching_ldpc(ulsch->pusch_pdu.tbslbrm,
impp.BG,
impp.Zc,
......@@ -205,7 +207,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
== -1)
return -1;
stop_meas(&ue->ulsch_rate_matching_stats);
stop_meas(&ue->phy_cpu_stats.cpu_time_stats[ULSCH_RATE_MATCHING_STATS]);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_OUT);
#ifdef DEBUG_ULSCH_CODING
......@@ -215,9 +217,9 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
///////////////////////// e---->| Rate matching bit interleaving |---->f /////////////////////////
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_IN);
start_meas(&ue->ulsch_interleaving_stats);
start_meas_nr_ue_phy(ue, ULSCH_INTERLEAVING_STATS);
nr_interleaving_ldpc(impp.perCB[r].E_cb, impp.Qm, harq_process->e + r_offset, harq_process->f + r_offset);
stop_meas(&ue->ulsch_interleaving_stats);
stop_meas_nr_ue_phy(ue, ULSCH_INTERLEAVING_STATS);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_OUT);
#ifdef DEBUG_ULSCH_CODING
......@@ -231,6 +233,6 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
}
///////////////////////////////////////////////////////////////////////////////////////////////
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
stop_meas(&ue->ulsch_encoding_stats);
stop_meas_nr_ue_phy(ue, ULSCH_ENCODING_STATS);
return(0);
}
......@@ -40,6 +40,7 @@
#include "defs_nr_common.h"
#include "CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/defs_nr_sl_UE.h"
#include "openair1/PHY/nr_phy_common/inc/nr_ue_phy_meas.h"
#include <stdio.h>
#include <stdlib.h>
......@@ -502,56 +503,10 @@ typedef struct PHY_VARS_NR_UE_s {
scheduling_request_config_t scheduling_request_config_nr[NUMBER_OF_CONNECTED_gNB_MAX];
#endif
time_stats_t phy_proc;
time_stats_t phy_proc_tx;
time_stats_t phy_proc_rx;
time_stats_t ue_ul_indication_stats;
uint32_t use_ia_receiver;
time_stats_t ofdm_mod_stats;
time_stats_t ulsch_encoding_stats;
time_stats_t ulsch_ldpc_encoding_stats;
time_stats_t ulsch_modulation_stats;
time_stats_t ulsch_segmentation_stats;
time_stats_t ulsch_rate_matching_stats;
time_stats_t ulsch_interleaving_stats;
time_stats_t ulsch_multiplexing_stats;
time_stats_t ue_front_end_stat;
time_stats_t ue_front_end_per_slot_stat[LTE_SLOTS_PER_SUBFRAME];
time_stats_t pdcch_procedures_stat;
time_stats_t pdsch_procedures_stat;
time_stats_t pdsch_procedures_per_slot_stat[LTE_SLOTS_PER_SUBFRAME];
time_stats_t dlsch_procedures_stat;
time_stats_t rx_pdsch_stats;
time_stats_t ofdm_demod_stats;
time_stats_t dlsch_rx_pdcch_stats;
time_stats_t rx_dft_stats;
time_stats_t dlsch_channel_estimation_stats;
time_stats_t dlsch_freq_offset_estimation_stats;
time_stats_t dlsch_decoding_stats;
time_stats_t dlsch_demodulation_stats;
time_stats_t dlsch_rate_unmatching_stats;
time_stats_t dlsch_ldpc_decoding_stats;
time_stats_t dlsch_deinterleaving_stats;
time_stats_t dlsch_llr_stats;
time_stats_t dlsch_llr_stats_parallelization[LTE_SLOTS_PER_SUBFRAME];
time_stats_t dlsch_unscrambling_stats;
time_stats_t dlsch_rate_matching_stats;
time_stats_t dlsch_ldpc_encoding_stats;
time_stats_t dlsch_interleaving_stats;
time_stats_t dlsch_tc_init_stats;
time_stats_t dlsch_tc_alpha_stats;
time_stats_t dlsch_tc_beta_stats;
time_stats_t dlsch_tc_gamma_stats;
time_stats_t dlsch_tc_ext_stats;
time_stats_t dlsch_tc_intl1_stats;
time_stats_t dlsch_tc_intl2_stats;
time_stats_t tx_prach;
// TODO: move this out of phy
time_stats_t ue_ul_indication_stats;
nr_ue_phy_cpu_stat_t phy_cpu_stats;
/// RF and Interface devices per CC
openair0_device rfdevice;
......@@ -685,5 +640,13 @@ typedef struct LDPCDecode_ue_s {
UE_nr_rxtx_proc_t proc;
} ldpcDecode_ue_t;
static inline void start_meas_nr_ue_phy(PHY_VARS_NR_UE *ue, int meas_index) {
start_meas(&ue->phy_cpu_stats.cpu_time_stats[meas_index]);
}
static inline void stop_meas_nr_ue_phy(PHY_VARS_NR_UE *ue, int meas_index) {
stop_meas(&ue->phy_cpu_stats.cpu_time_stats[meas_index]);
}
#include "SIMULATION/ETH_TRANSPORT/defs.h"
#endif
add_library(nr_phy_common src/nr_phy_common.c)
target_link_libraries(nr_phy_common PRIVATE UTIL)
target_include_directories(nr_phy_common PUBLIC inc/)
add_library(nr_ue_phy_meas src/nr_ue_phy_meas.c)
target_include_directories(nr_ue_phy_meas PUBLIC inc/)
target_link_libraries(nr_ue_phy_meas PUBLIC utils)
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __NR_UE_PHY_MEAS__H__
#define __NR_UE_PHY_MEAS__H__
#include "time_meas.h"
#include "utils.h"
#define NOOP(a) a
#define FOREACH_NR_PHY_CPU_MEAS(FN) \
FN(RX_PDSCH_STATS),\
FN(DLSCH_RX_PDCCH_STATS),\
FN(RX_DFT_STATS),\
FN(DLSCH_CHANNEL_ESTIMATION_STATS),\
FN(DLSCH_DECODING_STATS),\
FN(DLSCH_RATE_UNMATCHING_STATS),\
FN(DLSCH_LDPC_DECODING_STATS),\
FN(DLSCH_DEINTERLEAVING_STATS),\
FN(DLSCH_EXTRACT_RBS_STATS),\
FN(DLSCH_CHANNEL_SCALE_STATS),\
FN(DLSCH_CHANNEL_LEVEL_STATS),\
FN(DLSCH_MRC_MMSE_STATS),\
FN(DLSCH_UNSCRAMBLING_STATS),\
FN(DLSCH_CHANNEL_COMPENSATION_STATS),\
FN(DLSCH_LLR_STATS),\
FN(DLSCH_LAYER_DEMAPPING),\
FN(PHY_RX_PDCCH_STATS),\
FN(DLSCH_PROCEDURES_STATS),\
FN(PHY_PROC_TX),\
FN(ULSCH_SEGMENTATION_STATS),\
FN(ULSCH_LDPC_ENCODING_STATS),\
FN(ULSCH_RATE_MATCHING_STATS),\
FN(ULSCH_INTERLEAVING_STATS),\
FN(ULSCH_ENCODING_STATS)
typedef enum {
FOREACH_NR_PHY_CPU_MEAS(NOOP),
MAX_CPU_STAT_TYPE
} nr_ue_phy_cpu_stat_type_t;
typedef struct nr_ue_phy_cpu_stat_t {
time_stats_t cpu_time_stats[MAX_CPU_STAT_TYPE];
} nr_ue_phy_cpu_stat_t;
void init_nr_ue_phy_cpu_stats(nr_ue_phy_cpu_stat_t *ue_phy_cpu_stats);
void reset_nr_ue_phy_cpu_stats(nr_ue_phy_cpu_stat_t *ue_phy_cpu_stats);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <string.h>
#include "nr_ue_phy_meas.h"
#include <stdbool.h>
void init_nr_ue_phy_cpu_stats(nr_ue_phy_cpu_stat_t *ue_phy_cpu_stats) {
reset_nr_ue_phy_cpu_stats(ue_phy_cpu_stats);
const char* cpu_stats_enum_to_string_table[] = {
FOREACH_NR_PHY_CPU_MEAS(TO_STRING)
};
for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
ue_phy_cpu_stats->cpu_time_stats[i].meas_name = strdup(cpu_stats_enum_to_string_table[i]);
}
}
void reset_nr_ue_phy_cpu_stats(nr_ue_phy_cpu_stat_t *ue_phy_cpu_stats) {
for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
reset_meas(&ue_phy_cpu_stats->cpu_time_stats[i]);
}
}
This diff is collapsed.
......@@ -62,18 +62,20 @@ void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) {
}
void printStatIndent(time_stats_t *ptr, char *txt) {
printf("|__ %-38s %6.2f us (%3d trials)\n",
printf("|__ %-38s %6.2f us (%3d trials)\t\t(%6.2f total [ms])\n",
txt,
ptr->trials?inMicroS(ptr->diff/ptr->trials):0,
ptr->trials);
ptr->trials,
ptr->trials?inMicroS(ptr->diff)/1000:0);
}
void printStatIndent2(time_stats_t *ptr, char *txt) {
double timeBase=1/(1000*get_cpu_freq_GHz());
printf(" |__ %-34s %6.2f us (%3d trials)\n",
printf(" |__ %-34s %6.2f us (%3d trials)\t\t(%6.2f total [ms])\n",
txt,
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
ptr->trials);
ptr->trials,
ptr->trials?inMicroS(ptr->diff)/1000:0);
}
void printStatIndent3(time_stats_t *ptr, char *txt) {
......
......@@ -826,6 +826,7 @@ int main(int argc, char **argv)
UE->frame_parms.nb_antennas_rx = n_rx;
UE->frame_parms.nb_antenna_ports_gNB = n_tx;
UE->max_ldpc_iterations = max_ldpc_iterations;
init_nr_ue_phy_cpu_stats(&UE->phy_cpu_stats);
if (run_initial_sync==1)
UE->is_synchronized = 0;
......@@ -1232,36 +1233,10 @@ int main(int argc, char **argv)
printStatIndent2(&gNB->dlsch_resource_mapping_stats, "DLSCH Resource Mapping time");
printStatIndent2(&gNB->dlsch_precoding_stats,"DLSCH Layer Precoding time");
printf("\nUE RX function statistics (per %d us slot)\n",1000>>*scc->ssbSubcarrierSpacing);
/*
printDistribution(&phy_proc_rx_tot, table_rx,"Total PHY proc rx");
printStatIndent(&ue_front_end_tot,"Front end processing");
printStatIndent(&dlsch_llr_tot,"rx_pdsch processing");
printStatIndent2(&pdsch_procedures_tot,"pdsch processing");
printStatIndent2(&dlsch_procedures_tot,"dlsch processing");
printStatIndent2(&UE->crnti_procedures_stats,"C-RNTI processing");
printStatIndent(&UE->ofdm_demod_stats,"ofdm demodulation");
printStatIndent(&UE->dlsch_channel_estimation_stats,"DLSCH channel estimation time");
printStatIndent(&UE->dlsch_freq_offset_estimation_stats,"DLSCH frequency offset estimation time");
printStatIndent(&dlsch_decoding_tot, "DLSCH Decoding time ");
printStatIndent(&UE->dlsch_unscrambling_stats,"DLSCH unscrambling time");
printStatIndent(&UE->dlsch_rate_unmatching_stats,"DLSCH Rate Unmatching");
printf("|__ DLSCH Turbo Decoding(%d bits), avg iterations: %.1f %.2f us (%d cycles, %d trials)\n",
UE->dlsch[0][0]->harq_processes[0]->Cminus ?
UE->dlsch[0][0]->harq_processes[0]->Kminus :
UE->dlsch[0][0]->harq_processes[0]->Kplus,
UE->dlsch_tc_intl1_stats.trials/(double)UE->dlsch_tc_init_stats.trials,
(double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials*timeBase,
(int)((double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials),
UE->dlsch_turbo_decoding_stats.trials);
printStatIndent2(&UE->dlsch_tc_init_stats,"init");
printStatIndent2(&UE->dlsch_tc_alpha_stats,"alpha");
printStatIndent2(&UE->dlsch_tc_beta_stats,"beta");
printStatIndent2(&UE->dlsch_tc_gamma_stats,"gamma");
printStatIndent2(&UE->dlsch_tc_ext_stats,"ext");
printStatIndent2(&UE->dlsch_tc_intl1_stats,"turbo internal interleaver");
printStatIndent2(&UE->dlsch_tc_intl2_stats,"intl2+HardDecode+CRC");
*/
printf("\nUE function statistics (per %d us slot)\n", 1000 >> *scc->ssbSubcarrierSpacing);
for (int i = RX_PDSCH_STATS; i <= DLSCH_PROCEDURES_STATS; i++) {
printStatIndent(&UE->phy_cpu_stats.cpu_time_stats[i], UE->phy_cpu_stats.cpu_time_stats[i].meas_name);
}
}
if (n_trials == 1) {
......
......@@ -950,10 +950,6 @@ int main(int argc, char *argv[])
reset_meas(&gNB->rx_pusch_symbol_processing_stats);
reset_meas(&gNB->ulsch_decoding_stats);
reset_meas(&gNB->ulsch_channel_estimation_stats);
reset_meas(&UE->ulsch_ldpc_encoding_stats);
reset_meas(&UE->ulsch_rate_matching_stats);
reset_meas(&UE->ulsch_interleaving_stats);
reset_meas(&UE->ulsch_encoding_stats);
reset_meas(&gNB->rx_srs_stats);
reset_meas(&gNB->generate_srs_stats);
reset_meas(&gNB->get_srs_signal_stats);
......@@ -962,6 +958,7 @@ int main(int argc, char *argv[])
reset_meas(&gNB->srs_report_tlv_stats);
reset_meas(&gNB->srs_beam_report_stats);
reset_meas(&gNB->srs_iq_matrix_stats);
init_nr_ue_phy_cpu_stats(&UE->phy_cpu_stats);
uint32_t errors_scrambling[16] = {0};
int n_errors[16] = {0};
......@@ -1575,11 +1572,9 @@ int main(int argc, char *argv[])
printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time");
printf("\nUE TX\n");
printStatIndent(&UE->ulsch_encoding_stats,"ULSCH total encoding time");
printStatIndent2(&UE->ulsch_segmentation_stats,"ULSCH segmentation time");
printStatIndent2(&UE->ulsch_ldpc_encoding_stats,"ULSCH LDPC encoder time");
printStatIndent2(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time");
printStatIndent2(&UE->ulsch_interleaving_stats,"ULSCH interleaving time");
for (int i = PHY_PROC_TX; i <= ULSCH_ENCODING_STATS; i++) {
printStatIndent(&UE->phy_cpu_stats.cpu_time_stats[i], UE->phy_cpu_stats.cpu_time_stats[i].meas_name);
}
printStatIndent(&gNB->rx_srs_stats,"RX SRS time");
printStatIndent2(&gNB->generate_srs_stats,"Generate SRS sequence time");
printStatIndent2(&gNB->get_srs_signal_stats,"Get SRS signal time");
......
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