Commit cf655f38 authored by Joanne Hugé's avatar Joanne Hugé

Add one recv counter per antenna

parent c1df2e0e
......@@ -200,7 +200,7 @@ static uint8_t rx_buf[MAX_PACKET_SIZE * MAX_RX_BURST];
static uint8_t tx_buf[MAX_PACKET_SIZE * MAX_TX_BURST];
// Counters
static counter_stat_t recv_counter; // frames received from RRH
static counter_stat_t recv_counter[MAX_CHANNELS]; // frames received from RRH
static counter_stat_t read_counter; // frames passed to amarisoft stack
static counter_stat_t write_counter; // samples to write from TRX
static counter_stat_t sent_counter; // frames sent to RRH
......@@ -232,19 +232,11 @@ static void print_debug(FILE * f, int print_header) {
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"\n",
"RX RA",
"TRXR RA",
"TRXW RA",
"TX RA",
"RX WA",
"TRXR WA",
"TRXW WA",
"TX WA",
"TRXW RI",
"TRXW WI",
"TRXR RI",
......@@ -289,6 +281,9 @@ static void print_stats(FILE * f, int print_header) {
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
"%" STAT_INT_LEN "s "
......@@ -297,7 +292,10 @@ static void print_stats(FILE * f, int print_header) {
"\n",
"rx dropped",
"tx dropped",
"received",
"received 0",
"received 1",
"received 2",
"received 3",
"read",
"write",
"sent",
......@@ -316,6 +314,9 @@ static void print_stats(FILE * f, int print_header) {
"%" STAT_INT_LEN "" PRIi64 " "
"%" STAT_INT_LEN "" PRIi64 " "
"%" STAT_INT_LEN "" PRIi64 " "
"%" STAT_INT_LEN "" PRIi64 " "
"%" STAT_INT_LEN "" PRIi64 " "
"%" STAT_INT_LEN "" PRIi64 " "
"%" STAT_INT_LEN "" PRIi64 "pps "
"%" STAT_INT_LEN "" PRIi64 "pps "
"%" STAT_INT_LEN "" PRIi64 "pps "
......@@ -324,12 +325,15 @@ static void print_stats(FILE * f, int print_header) {
"\n",
rx_drop_counter.counter,
tx_drop_counter.counter,
recv_counter.counter,
recv_counter[0].counter,
recv_counter[1].counter,
recv_counter[2].counter,
recv_counter[3].counter,
read_counter.counter,
write_counter.counter,
sent_counter.counter,
lost_rx_counter.counter,
recv_counter.pps,
recv_counter[0].pps,
read_counter.pps,
write_counter.pps,
sent_counter.pps,
......@@ -483,8 +487,8 @@ static void *recv_thread(void *p) {
antenna_id = ntohs(header->antenna_id);
// Exit if SEQ ID is not sequential
if ( prev_seq_id[antenna_id] != -1 && (header->seq_id + 256 - prev_seq_id[antenna_id]) % 256 != 1 ) {
log_info("RECV_THREAD", "seq_ids are not sequential (%d, %d)",
prev_seq_id[antenna_id], header->seq_id);
//log_info("RECV_THREAD", "seq_ids are not sequential (%d, %d)",
// prev_seq_id[antenna_id], header->seq_id);
update_counter(&lost_rx_counter, (header->seq_id + 256 - prev_seq_id[antenna_id]) % 256);
//stop = 1; break;
}
......@@ -494,9 +498,12 @@ static void *recv_thread(void *p) {
stop = 1; break;
}
// Exit if there is no more space in the buffer
if(!rbuf_write_amount(&trxr_rbuf[antenna_id]))
log_exit("RECV_THREAD", "No more space in %s buffer",
trxr_rbuf[antenna_id].name);
if(!rbuf_write_amount(&trxr_rbuf[antenna_id])) {
rbuf_increment_read(&trxr_rbuf[antenna_id], MAX_IQ_PAYLOAD);
update_counter(&rx_drop_counter, MAX_IQ_PAYLOAD / N_SAMPLES);
//log_exit("RECV_THREAD", "No more space in %s buffer",
// trxr_rbuf[antenna_id].name);
}
prev_seq_id[antenna_id] = header->seq_id;
iq_packet = (ecpri_iq_packet*) (rx_buf + j * MAX_PACKET_SIZE);
......@@ -505,7 +512,7 @@ static void *recv_thread(void *p) {
iq_packet->iq_samples,
iq_packet->payload_size);
rbuf_increment_write(&trxr_rbuf[antenna_id], trxr_rbuf[antenna_id].block_len);
update_counter(&recv_counter, iq_packet->payload_size / N_SAMPLES);
update_counter(&recv_counter[antenna_id], iq_packet->payload_size / N_SAMPLES);
}
if(stop) {
for(int j = 0; j < ret; j++) {
......@@ -643,7 +650,10 @@ static void *statistic_thread(void *p) {
update_counter_pps(&rx_drop_counter);
update_counter_pps(&tx_drop_counter);
update_counter_pps(&recv_counter);
update_counter_pps(&recv_counter[0]);
update_counter_pps(&recv_counter[1]);
update_counter_pps(&recv_counter[2]);
update_counter_pps(&recv_counter[3]);
update_counter_pps(&read_counter);
update_counter_pps(&write_counter);
update_counter_pps(&sent_counter);
......@@ -744,7 +754,10 @@ int start(TRXEcpriState * s) {
tx_seq_id = 0;
init_counter(&rx_drop_counter);
init_counter(&tx_drop_counter);
init_counter(&recv_counter);
init_counter(&recv_counter[0]);
init_counter(&recv_counter[1]);
init_counter(&recv_counter[2]);
init_counter(&recv_counter[3]);
init_counter(&read_counter);
init_counter(&write_counter);
init_counter(&sent_counter);
......
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