lib,rlc: make it easier to save rlc_stress test result log to a file

master
Pedro Alvarez 3 years ago
parent 6ffa036b84
commit 718c0ba2cd

@ -229,6 +229,17 @@ void rlc_tester::run_thread()
void stress_test(stress_test_args_t args) void stress_test(stress_test_args_t args)
{ {
auto log_sink =
(args.log_filename == "stdout") ? srslog::create_stdout_sink() : srslog::create_file_sink(args.log_filename);
if (!log_sink) {
return;
}
srslog::log_channel* chan = srslog::create_log_channel("main_channel", *log_sink);
if (!chan) {
return;
}
srslog::set_default_sink(*log_sink);
auto& log1 = srslog::fetch_basic_logger("RLC_1", false); auto& log1 = srslog::fetch_basic_logger("RLC_1", false);
log1.set_level(static_cast<srslog::basic_levels>(args.log_level)); log1.set_level(static_cast<srslog::basic_levels>(args.log_level));
log1.set_hex_dump_max_size(args.log_hex_limit); log1.set_hex_dump_max_size(args.log_hex_limit);

@ -73,6 +73,7 @@ typedef struct {
uint32_t nof_pdu_tti; uint32_t nof_pdu_tti;
uint32_t max_retx; uint32_t max_retx;
int32_t log_hex_limit; int32_t log_hex_limit;
std::string log_filename;
uint32_t min_sdu_size; uint32_t min_sdu_size;
uint32_t max_sdu_size; uint32_t max_sdu_size;
} stress_test_args_t; } stress_test_args_t;
@ -102,6 +103,7 @@ void parse_args(stress_test_args_t* args, int argc, char* argv[])
("pdu_cut_rate", bpo::value<float>(&args->pdu_cut_rate)->default_value(0.0), "Rate at which RLC PDUs are chopped in length") ("pdu_cut_rate", bpo::value<float>(&args->pdu_cut_rate)->default_value(0.0), "Rate at which RLC PDUs are chopped in length")
("pdu_duplicate_rate", bpo::value<float>(&args->pdu_duplicate_rate)->default_value(0.0), "Rate at which RLC PDUs are duplicated") ("pdu_duplicate_rate", bpo::value<float>(&args->pdu_duplicate_rate)->default_value(0.0), "Rate at which RLC PDUs are duplicated")
("loglevel", bpo::value<uint32_t>(&args->log_level)->default_value((int)srslog::basic_levels::debug), "Log level (1=Error,2=Warning,3=Info,4=Debug)") ("loglevel", bpo::value<uint32_t>(&args->log_level)->default_value((int)srslog::basic_levels::debug), "Log level (1=Error,2=Warning,3=Info,4=Debug)")
("log_filename", bpo::value<std::string>(&args->log_filename)->default_value("stdout"), "Filename to save log to")
("singletx", bpo::value<bool>(&args->single_tx)->default_value(false), "If set to true, only one node is generating data") ("singletx", bpo::value<bool>(&args->single_tx)->default_value(false), "If set to true, only one node is generating data")
("pcap", bpo::value<bool>(&args->write_pcap)->default_value(false), "Whether to write all RLC PDU to PCAP file") ("pcap", bpo::value<bool>(&args->write_pcap)->default_value(false), "Whether to write all RLC PDU to PCAP file")
("zeroseed", bpo::value<bool>(&args->zero_seed)->default_value(false), "Whether to initialize random seed to zero") ("zeroseed", bpo::value<bool>(&args->zero_seed)->default_value(false), "Whether to initialize random seed to zero")

Loading…
Cancel
Save