ue,mac: adding missing mutex when updating metrics

master
Andre Puschmann 3 years ago
parent e1776f8d28
commit aa43e3c8d6

@ -493,6 +493,9 @@ void mac::new_grant_ul(uint32_t cc_idx,
} }
ul_harq.at(cc_idx)->new_grant_ul(grant, action); ul_harq.at(cc_idx)->new_grant_ul(grant, action);
{
std::lock_guard<std::mutex> lock(metrics_mutex);
metrics[cc_idx].tx_pkts++; metrics[cc_idx].tx_pkts++;
if (grant.phich_available) { if (grant.phich_available) {
@ -502,6 +505,7 @@ void mac::new_grant_ul(uint32_t cc_idx,
metrics[cc_idx].tx_brate += ul_harq.at(cc_idx)->get_current_tbs(grant.pid) * 8; metrics[cc_idx].tx_brate += ul_harq.at(cc_idx)->get_current_tbs(grant.pid) * 8;
} }
} }
} // end of holding metrics mutex
} }
void mac::new_mch_dl(const srsran_pdsch_grant_t& phy_grant, tb_action_dl_t* action) void mac::new_mch_dl(const srsran_pdsch_grant_t& phy_grant, tb_action_dl_t* action)
@ -623,6 +627,8 @@ void mac::mch_start_rx(uint32_t lcid)
void mac::get_metrics(mac_metrics_t m[SRSRAN_MAX_CARRIERS]) void mac::get_metrics(mac_metrics_t m[SRSRAN_MAX_CARRIERS])
{ {
std::lock_guard<std::mutex> lock(metrics_mutex);
int tx_pkts = 0; int tx_pkts = 0;
int tx_errors = 0; int tx_errors = 0;
int tx_brate = 0; int tx_brate = 0;

Loading…
Cancel
Save