mirror of https://github.com/PentHertz/srsLTE.git
gw: calculate GW throughput based on TTI timing
similiar like the RLC patch, MAC TTIs are passed to GW so the rx/tx rate can be calculated based on the LTE timing
This commit is contained in:
parent
c0883291f6
commit
ab598dae3b
|
@ -43,7 +43,7 @@ public:
|
|||
int init(const gw_args_t& args_, srslte::logger* logger_, stack_interface_gw* stack);
|
||||
void stop();
|
||||
|
||||
void get_metrics(gw_metrics_t& m);
|
||||
void get_metrics(gw_metrics_t& m, const uint32_t nof_tti);
|
||||
|
||||
// PDCP interface
|
||||
void write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
|
||||
|
@ -82,8 +82,8 @@ private:
|
|||
uint32_t current_ip_addr = 0;
|
||||
uint8_t current_if_id[8];
|
||||
|
||||
long ul_tput_bytes = 0;
|
||||
long dl_tput_bytes = 0;
|
||||
uint32_t ul_tput_bytes = 0;
|
||||
uint32_t dl_tput_bytes = 0;
|
||||
struct timeval metrics_time[3];
|
||||
|
||||
void run_thread();
|
||||
|
|
|
@ -84,15 +84,24 @@ void gw::stop()
|
|||
}
|
||||
}
|
||||
|
||||
void gw::get_metrics(gw_metrics_t& m)
|
||||
void gw::get_metrics(gw_metrics_t& m, const uint32_t nof_tti)
|
||||
{
|
||||
gettimeofday(&metrics_time[2], NULL);
|
||||
get_time_interval(metrics_time);
|
||||
double secs = (double)metrics_time[0].tv_sec + metrics_time[0].tv_usec * 1e-6;
|
||||
|
||||
m.dl_tput_mbps = (dl_tput_bytes * 8 / (double)1e6) / secs;
|
||||
m.ul_tput_mbps = (ul_tput_bytes * 8 / (double)1e6) / secs;
|
||||
log.info("RX throughput: %4.6f Mbps. TX throughput: %4.6f Mbps.\n", m.dl_tput_mbps, m.ul_tput_mbps);
|
||||
double secs = (double)metrics_time[0].tv_sec + metrics_time[0].tv_usec * 1e-6;
|
||||
double dl_tput_mbps_real_time = (dl_tput_bytes * 8 / (double)1e6) / secs;
|
||||
double ul_tput_mbps_real_time = (ul_tput_bytes * 8 / (double)1e6) / secs;
|
||||
|
||||
// Use the provided TTI counter to compute rate for metrics interface
|
||||
m.dl_tput_mbps = (dl_tput_bytes * 8 / (double)1e6) / (nof_tti / 1000.0);
|
||||
m.ul_tput_mbps = (ul_tput_bytes * 8 / (double)1e6) / (nof_tti / 1000.0);
|
||||
|
||||
log.info("gw_rx_rate_mbps=%4.2f (real=%4.2f), gw_tx_rate_mbps=%4.2f (real=%4.2f)\n",
|
||||
m.dl_tput_mbps,
|
||||
dl_tput_mbps_real_time,
|
||||
m.ul_tput_mbps,
|
||||
ul_tput_mbps_real_time);
|
||||
|
||||
memcpy(&metrics_time[1], &metrics_time[2], sizeof(struct timeval));
|
||||
dl_tput_bytes = 0;
|
||||
|
|
|
@ -298,7 +298,7 @@ bool ue::get_metrics(ue_metrics_t* m)
|
|||
phy->get_metrics(&m->phy);
|
||||
radio->get_metrics(&m->rf);
|
||||
stack->get_metrics(&m->stack);
|
||||
gw_inst->get_metrics(m->gw);
|
||||
gw_inst->get_metrics(m->gw, m->stack.mac[0].nof_tti);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue