From 371e2f90fd066fc7be1809557e82f7c1a830a7ee Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 3 May 2018 18:36:29 +0200 Subject: [PATCH] print RLC throughput after finishing stress test - also exit with failure when malformed PDU is received in release mode --- lib/test/upper/rlc_stress_test.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/test/upper/rlc_stress_test.cc b/lib/test/upper/rlc_stress_test.cc index 2363708b3..56bbfafba 100644 --- a/lib/test/upper/rlc_stress_test.cc +++ b/lib/test/upper/rlc_stress_test.cc @@ -252,9 +252,13 @@ public: void write_pdu(uint32_t rx_lcid, byte_buffer_t *sdu) { assert(rx_lcid == lcid); - assert(sdu->N_bytes==SDU_SIZE); + if (sdu->N_bytes != SDU_SIZE) { + printf("Received PDU with size %d, expected %d. Exiting.\n", sdu->N_bytes, SDU_SIZE); + exit(-1); + } + byte_buffer_pool::get_instance()->deallocate(sdu); - std::cout << "rlc_tester " << name << " received " << rx_pdus++ << " PDUs" << std::endl; + rx_pdus++; } void write_pdu_bcch_bch(byte_buffer_t *sdu) {} void write_pdu_bcch_dlsch(byte_buffer_t *sdu) {} @@ -264,6 +268,8 @@ public: void max_retx_attempted(){} std::string get_rb_name(uint32_t rx_lcid) { return std::string(""); } + int get_nof_rx_pdus() { return rx_pdus; } + private: void run_thread() { @@ -378,6 +384,16 @@ void stress_test(stress_test_args_t args) if (args.write_pcap) { pcap.close(); } + + printf("RLC1 received %d SDUs in %ds (%.2f PDU/s)\n", + tester1.get_nof_rx_pdus(), + args.test_duration_sec, + (float)tester1.get_nof_rx_pdus()/args.test_duration_sec); + + printf("RLC2 received %d SDUs in %ds (%.2f PDU/s)\n", + tester2.get_nof_rx_pdus(), + args.test_duration_sec, + (float)tester2.get_nof_rx_pdus()/args.test_duration_sec); }