Commit d00ef8d8 authored by liuxu's avatar liuxu

240103 multi-ue measurement is send by one-time transmission

parent 208ab840
......@@ -82,7 +82,7 @@ void *gnbSendToManager_task(void *args_p)
send_len = write(sockfd, &sim_socket_manager, GNBSENDTOMANAGER_MAX_RE_SCHDULE_LEN);
}
else if (message_flag == 3){
send_len = write(sockfd, &sim_measurement_manager, GNBSENDTOMANAGER_MAX_MEASUREMENT_LEN);
send_len = write(sockfd, &sim_measurement_manager, sim_measurement_manager.data_len);
}
// printf("send_len=%d\n", send_len);
......
......@@ -57,7 +57,6 @@
const uint8_t nr_rv_round_map[4] = {0, 2, 3, 1};
sim_socket_t sim_socket_manager;
sim_measurement_t sim_measurement_manager;
void clear_nr_nfapi_information(gNB_MAC_INST *gNB,
int CC_idP,
......
......@@ -88,11 +88,13 @@ void clear_mac_stats(gNB_MAC_INST *gNB) {
}
}
sim_measurement_t sim_measurement_manager;
size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset_rsrp)
{
int num = 1;
const char *begin = output;
const char *end = output + strlen;
int cnt = 0;
/* this function is called from gNB_dlsch_ulsch_scheduler(), so assumes the
* scheduler to be locked*/
......@@ -104,46 +106,32 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
NR_mac_stats_t *stats = &UE->mac_stats;
const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0;
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 3;
sim_measurement_manager.data_len = sizeof(sim_measurement_t);
sim_measurement_manager.message = 3;
sim_measurement_manager.rnti = UE->rnti;
sim_measurement_manager.dl_recv_bytes_high16 = (stats->dl.total_bytes>>16)&0x0000ffff;
sim_measurement_manager.dl_recv_bytes_low16 = stats->dl.total_bytes&0x0000ffff;
sim_measurement_manager.ul_recv_bytes_high16 = (stats->ul.total_bytes>>16)&0x0000ffff;
sim_measurement_manager.ul_recv_bytes_low16 = stats->ul.total_bytes&0x0000ffff;
sim_measurement_manager.dl_mcs = sched_ctrl->dl_bler_stats.mcs;
sim_measurement_manager.ul_mcs = sched_ctrl->ul_bler_stats.mcs;
sim_measurement_manager.dl_bler = sched_ctrl->dl_bler_stats.bler*10000;
sim_measurement_manager.ul_bler = sched_ctrl->ul_bler_stats.bler*10000;
sim_measurement_manager.pucch_snr = sched_ctrl->pucch_snrx10/10;
sim_measurement_manager.pusch_snr = sched_ctrl->pusch_snrx10/10;
sim_measurement_manager.rsrp = avg_rsrp;
// uint64_t diff = ((double)(end_time_manager - start_time_manager) / CLOCKS_PER_SEC)*10000;
// if (diff == 0){
// printf("frame %d slot %d\n", sim_socket_manager.frame, sim_socket_manager.slot);
// exit(1);
// }
// sim_measurement_manager.time_diff_high16 = (diff>>16)&0x0000ffff;
// sim_measurement_manager.time_diff_low16 = diff&0x0000ffff;
// printf("dl %d ul %d\n", stats->dl.current_bytes,stats->ul.current_bytes);
#ifdef VRB_MAP_TEST_MANAGER
LOG_I(NR_MAC,"data_len %d\n", sim_socket_manager.data_len);
sim_measurement_manager.UE[cnt].rnti = UE->rnti;
sim_measurement_manager.UE[cnt].dl_recv_bytes_high16 = (stats->dl.total_bytes>>16)&0x0000ffff;
sim_measurement_manager.UE[cnt].dl_recv_bytes_low16 = stats->dl.total_bytes&0x0000ffff;
sim_measurement_manager.UE[cnt].ul_recv_bytes_high16 = (stats->ul.total_bytes>>16)&0x0000ffff;
sim_measurement_manager.UE[cnt].ul_recv_bytes_low16 = stats->ul.total_bytes&0x0000ffff;
sim_measurement_manager.UE[cnt].dl_mcs = sched_ctrl->dl_bler_stats.mcs;
sim_measurement_manager.UE[cnt].ul_mcs = sched_ctrl->ul_bler_stats.mcs;
sim_measurement_manager.UE[cnt].dl_bler = sched_ctrl->dl_bler_stats.bler*10000;
sim_measurement_manager.UE[cnt].ul_bler = sched_ctrl->ul_bler_stats.bler*10000;
sim_measurement_manager.UE[cnt].pucch_snr = sched_ctrl->pucch_snrx10/10;
sim_measurement_manager.UE[cnt].pusch_snr = sched_ctrl->pusch_snrx10/10;
sim_measurement_manager.UE[cnt].rsrp = avg_rsrp;
#if 0
LOG_I(NR_MAC,"stats->dl.total_bytes %ld stats->ul.total_bytes %ld\n", stats->dl.total_bytes, stats->ul.total_bytes);
LOG_I(NR_MAC,"sim_measurement_manager.dl_recv_bytes_high16 %d sim_measurement_manager.dl_recv_bytes_low16 %d sim_measurement_manager.ul_recv_bytes_high16 %d sim_measurement_manager.ul_recv_bytes_low16 %d\n",
sim_measurement_manager.dl_recv_bytes_high16,sim_measurement_manager.dl_recv_bytes_low16,
sim_measurement_manager.ul_recv_bytes_high16,sim_measurement_manager.ul_recv_bytes_low16);
sim_measurement_manager.UE[cnt].dl_recv_bytes_high16,sim_measurement_manager.UE[cnt].dl_recv_bytes_low16,
sim_measurement_manager.UE[cnt].ul_recv_bytes_high16,sim_measurement_manager.UE[cnt].ul_recv_bytes_low16);
LOG_I(NR_MAC,"dl_recv_bytes %dbytes, ul_recv_bytes %dbytes,dl_mcs %d, ul_mcs %d, dl_bler %d, ul_bler %d, pucch_snr %ddB, pusch_snr %ddB, rsrp %ddBm\n",
(sim_measurement_manager.dl_recv_bytes_high16<<16)+sim_measurement_manager.dl_recv_bytes_low16,
(sim_measurement_manager.ul_recv_bytes_high16<<16)+sim_measurement_manager.ul_recv_bytes_low16,
(sim_measurement_manager.UE[cnt].dl_recv_bytes_high16<<16)+sim_measurement_manager.UE[cnt].dl_recv_bytes_low16,
(sim_measurement_manager.UE[cnt].ul_recv_bytes_high16<<16)+sim_measurement_manager.UE[cnt].ul_recv_bytes_low16,
// (sim_measurement_manager.time_diff_high16<<16)+sim_measurement_manager.time_diff_low16,
sim_measurement_manager.dl_mcs, sim_measurement_manager.ul_mcs,
sim_measurement_manager.dl_bler,sim_measurement_manager.ul_bler, sim_measurement_manager.pucch_snr,
sim_measurement_manager.pusch_snr,sim_measurement_manager.rsrp);
sim_measurement_manager.UE[cnt].dl_mcs, sim_measurement_manager.UE[cnt].ul_mcs,
sim_measurement_manager.UE[cnt].dl_bler,sim_measurement_manager.UE[cnt].ul_bler, sim_measurement_manager.UE[cnt].pucch_snr,
sim_measurement_manager.UE[cnt].pusch_snr,sim_measurement_manager.UE[cnt].rsrp);
#endif
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
cnt++;
output += snprintf(output,
end - output,
......@@ -222,6 +210,20 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
stats->ul.lc_bytes[lc_id]);
}
}
if (cnt > 0){
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 3;
sim_measurement_manager.data_len = cnt*sizeof(struct ue_measure_t)+3*sizeof(uint16_t);
sim_measurement_manager.message = 3;
sim_measurement_manager.ue_count = cnt;
#if 0
LOG_I(NR_MAC,"data_len %d\n", sim_measurement_manager.data_len);
#endif
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
}
NR_SCHED_UNLOCK(&gNB->UE_info.mutex);
return output - begin;
}
......
......@@ -81,9 +81,7 @@ typedef struct {
}sim_socket_t;
typedef struct{
uint16_t data_len;
uint16_t message;
struct ue_measure_t{
uint16_t rnti;
uint16_t dl_recv_bytes_high16;
uint16_t dl_recv_bytes_low16;
......@@ -97,7 +95,14 @@ typedef struct{
uint16_t ul_bler;
int16_t pucch_snr;
int16_t pusch_snr;
int16_t rsrp;
int16_t rsrp;
};
typedef struct{
uint16_t data_len;
uint16_t message;
uint16_t ue_count;
struct ue_measure_t UE[100];
}sim_measurement_t;
extern sim_socket_t sim_socket_manager;
......
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