Commit 5dbae260 authored by Xenofon Foukas's avatar Xenofon Foukas

Merge branch 'feature-68-enb-agent' into agent-performance

parents 60b7e425 6b15195a
...@@ -462,6 +462,13 @@ typedef struct { ...@@ -462,6 +462,13 @@ typedef struct {
// //
uint32_t total_ulsch_pdus_rx; uint32_t total_ulsch_pdus_rx;
/// MAC agent-related stats
/// total number of scheduling decisions
int sched_decisions;
/// missed deadlines
int missed_deadlines;
} eNB_STATS; } eNB_STATS;
/*! \brief eNB statistics for the connected UEs*/ /*! \brief eNB statistics for the connected UEs*/
typedef struct { typedef struct {
......
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
#include "eNB_agent_scheduler_dlsch_ue_remote.h" #include "eNB_agent_scheduler_dlsch_ue_remote.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
struct DlMacConfigHead queue_head; struct DlMacConfigHead queue_head;
int queue_initialized = 0; int queue_initialized = 0;
...@@ -46,11 +49,16 @@ int queue_initialized = 0; ...@@ -46,11 +49,16 @@ int queue_initialized = 0;
void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { int *mbsfn_flag, Protocol__ProgranMessage **dl_info) {
eNB_MAC_INST *eNB;
if (!queue_initialized) { if (!queue_initialized) {
TAILQ_INIT(&queue_head); TAILQ_INIT(&queue_head);
queue_initialized = 1; queue_initialized = 1;
} }
eNB = &eNB_mac_inst[mod_id];
dl_mac_config_element_t *dl_config_elem; dl_mac_config_element_t *dl_config_elem;
int diff; int diff;
...@@ -66,12 +74,15 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, ...@@ -66,12 +74,15 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs);
*dl_info = dl_config_elem->dl_info; *dl_info = dl_config_elem->dl_info;
free(dl_config_elem); free(dl_config_elem);
eNB->eNB_stats[mod_id].sched_decisions++;
return; return;
} else if (diff < 0) { //previous subframe , delete message and free memory } else if (diff < 0) { //previous subframe , delete message and free memory
LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n"); LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n");
TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs);
enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info);
free(dl_config_elem); free(dl_config_elem);
eNB->eNB_stats[mod_id].sched_decisions++;
eNB->eNB_stats[mod_id].missed_deadlines++;
} else { // next subframe, nothing to do now } else { // next subframe, nothing to do now
LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n"); LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n");
enb_agent_mac_create_empty_dl_config(mod_id, dl_info); enb_agent_mac_create_empty_dl_config(mod_id, dl_info);
...@@ -86,12 +97,15 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, ...@@ -86,12 +97,15 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf);
if (diff == 0) { // Got a command for this sfn_sf if (diff == 0) { // Got a command for this sfn_sf
LOG_D(MAC, "Found a decision for this subframe pending. Let's use it\n"); LOG_D(MAC, "Found a decision for this subframe pending. Let's use it\n");
eNB->eNB_stats[mod_id].sched_decisions++;
return; return;
} else if (diff < 0) { } else if (diff < 0) {
LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n"); LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n");
enb_agent_mac_destroy_dl_config(*dl_info); enb_agent_mac_destroy_dl_config(*dl_info);
*dl_info = NULL; *dl_info = NULL;
enb_agent_get_pending_dl_mac_config(mod_id, dl_info); enb_agent_get_pending_dl_mac_config(mod_id, dl_info);
eNB->eNB_stats[mod_id].sched_decisions++;
eNB->eNB_stats[mod_id].missed_deadlines++;
} else { // Intended for future subframe. Store it in local cache } else { // Intended for future subframe. Store it in local cache
LOG_D(MAC, "Found a decision for a future subframe in the queue. Let's store it in the cache\n"); LOG_D(MAC, "Found a decision for a future subframe in the queue. Let's store it in the cache\n");
dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t));
......
...@@ -122,11 +122,13 @@ int dump_eNB_l2_stats(char *buffer, int length) ...@@ -122,11 +122,13 @@ int dump_eNB_l2_stats(char *buffer, int length)
for (CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
eNB->eNB_stats[CC_id].dlsch_bitrate= 0; eNB->eNB_stats[CC_id].dlsch_bitrate= 0;
len += sprintf(&buffer[len],"eNB %d CC %d Frame %d: Active UEs %d, Available PRBs %d, nCCE %d \n", len += sprintf(&buffer[len],"eNB %d CC %d Frame %d: Active UEs %d, Available PRBs %d, nCCE %d, Scheduling decisions %d, Missed Deadlines %d \n",
eNB_id, CC_id, eNB->frame, eNB_id, CC_id, eNB->frame,
eNB->eNB_stats[CC_id].num_dlactive_UEs, eNB->eNB_stats[CC_id].num_dlactive_UEs,
eNB->eNB_stats[CC_id].available_prbs, eNB->eNB_stats[CC_id].available_prbs,
eNB->eNB_stats[CC_id].available_ncces); eNB->eNB_stats[CC_id].available_ncces,
eNB->eNB_stats[CC_id].sched_decisions,
eNB->eNB_stats[CC_id].missed_deadlines);
len += sprintf(&buffer[len],"BCCH , NB_TX_MAC = %d, transmitted bytes (TTI %d, total %d) MCS (TTI %d)\n", len += sprintf(&buffer[len],"BCCH , NB_TX_MAC = %d, transmitted bytes (TTI %d, total %d) MCS (TTI %d)\n",
eNB->eNB_stats[CC_id].total_num_bcch_pdu, eNB->eNB_stats[CC_id].total_num_bcch_pdu,
......
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