- Remove old loggers in ttcn3 and in NR.

master
faluco 4 years ago committed by faluco
parent fd6c1e16a8
commit 2328011732

@ -45,7 +45,7 @@ class gnb_stack_nr final : public srsenb::enb_stack_base,
public srslte::thread
{
public:
explicit gnb_stack_nr(srslte::logger* logger_);
explicit gnb_stack_nr();
~gnb_stack_nr() final;
int init(const srsenb::stack_args_t& args_, const rrc_nr_cfg_t& rrc_cfg_, phy_interface_stack_nr* phy_);
@ -78,9 +78,8 @@ private:
void run_tti_impl(uint32_t tti);
// args
srsenb::stack_args_t args = {};
srslte::logger* logger = nullptr;
phy_interface_stack_nr* phy = nullptr;
srsenb::stack_args_t args = {};
phy_interface_stack_nr* phy = nullptr;
// task scheduling
static const int STACK_MAIN_THREAD_PRIO = 4;

@ -99,7 +99,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
radio = std::move(lte_radio);
} else if (args.stack.type == "nr") {
std::unique_ptr<srsenb::gnb_stack_nr> nr_stack(new srsenb::gnb_stack_nr(logger));
std::unique_ptr<srsenb::gnb_stack_nr> nr_stack(new srsenb::gnb_stack_nr);
std::unique_ptr<srslte::radio_null> nr_radio(new srslte::radio_null);
std::unique_ptr<srsenb::vnf_phy_nr> nr_phy(new srsenb::vnf_phy_nr);

@ -16,7 +16,7 @@
namespace srsenb {
gnb_stack_nr::gnb_stack_nr(srslte::logger* logger_) : logger(logger_), task_sched{512, 128}, thread("gNB")
gnb_stack_nr::gnb_stack_nr() : task_sched{512, 128}, thread("gNB")
{
m_mac.reset(new mac_nr());
m_rlc.reset(new rlc_nr("RLC"));

@ -23,7 +23,6 @@ namespace nr {
class worker_pool
{
private:
srslog::sink& log_sink;
srslog::basic_logger& logger;
srslte::thread_pool pool;
std::vector<std::unique_ptr<sf_worker> > workers;
@ -33,7 +32,7 @@ private:
public:
sf_worker* operator[](std::size_t pos) { return workers.at(pos).get(); }
worker_pool(uint32_t max_workers, srslog::sink& log_sink_);
worker_pool(uint32_t max_workers);
bool init(const phy_args_nr_t& args_, phy_common* common, stack_interface_phy_nr* stack_, int prio);
sf_worker* wait_worker(uint32_t tti);
void start_worker(sf_worker* w);

@ -73,7 +73,7 @@ public:
logger_phy(srslog::fetch_basic_logger("PHY")),
logger_phy_lib(srslog::fetch_basic_logger("PHY_LIB")),
lte_workers(MAX_WORKERS),
nr_workers(MAX_WORKERS, log_sink),
nr_workers(MAX_WORKERS),
common(logger_phy),
sfsync(logger_phy, logger_phy_lib),
prach_buffer(logger_phy),

@ -14,9 +14,7 @@
namespace srsue {
namespace nr {
worker_pool::worker_pool(uint32_t max_workers, srslog::sink& log_sink_) :
pool(max_workers), log_sink(log_sink_), logger(srslog::fetch_basic_logger("NR-PHY", log_sink))
{}
worker_pool::worker_pool(uint32_t max_workers) : pool(max_workers), logger(srslog::fetch_basic_logger("NR-PHY")) {}
bool worker_pool::init(const phy_args_nr_t& args, phy_common* common, stack_interface_phy_nr* stack_, int prio)
{
@ -38,7 +36,7 @@ bool worker_pool::init(const phy_args_nr_t& args, phy_common* common, stack_inte
// Add workers to workers pool and start threads
for (uint32_t i = 0; i < args.nof_phy_threads; i++) {
auto& log = srslog::fetch_basic_logger(fmt::format("PHY{}", i), log_sink);
auto& log = srslog::fetch_basic_logger(fmt::format("PHY{}", i));
log.set_level(srslog::str_to_basic_level(args.log.phy_level));
log.set_hex_dump_max_size(args.log.phy_hex_limit);
@ -52,7 +50,7 @@ bool worker_pool::init(const phy_args_nr_t& args, phy_common* common, stack_inte
}
// Initialise PRACH
auto& prach_log = srslog::fetch_basic_logger("NR-PRACH", log_sink);
auto& prach_log = srslog::fetch_basic_logger("NR-PRACH");
prach_log.set_level(srslog::str_to_basic_level(args.log.phy_level));
prach_buffer = std::unique_ptr<prach>(new prach(prach_log));
prach_buffer->init(phy_state.args.dl.nof_max_prb);

@ -38,7 +38,7 @@ class ttcn3_syssim : public syssim_interface_phy,
public srslte::pdu_queue::process_callback
{
public:
ttcn3_syssim(srslte::logger& logger_file_, srslte::logger& logger_stdout_, ttcn3_ue* ue_);
explicit ttcn3_syssim(ttcn3_ue* ue_);
~ttcn3_syssim();
@ -220,12 +220,6 @@ private:
epoll_timer_handler timer_handler;
epoll_signal_handler signal_handler;
// Logging stuff (to be removed)
srslte::logger& logger_stdout;
srslte::logger& logger_file;
srslte::logger* old_logger = nullptr;
srslte::log_ref log;
all_args_t args = {};
// Simulator vars

@ -126,20 +126,14 @@ int main(int argc, char** argv)
}
srslog::set_default_sink(*default_sink);
srslte::srslog_wrapper file_wrapper(srslog::fetch_log_channel("file_channel"));
srslte::srslog_wrapper stdout_wrapper(srslog::fetch_log_channel("stdout_channel", srslog::fetch_stdout_sink(), {}));
// Start the log backend.
srslog::init();
// Instantiate file logger
srslte::logmap::set_default_logger(&file_wrapper);
// Create UE object
unique_ptr<ttcn3_ue> ue = std::unique_ptr<ttcn3_ue>(new ttcn3_ue());
// create and init SYSSIM
ttcn3_syssim syssim(file_wrapper, stdout_wrapper, ue.get());
ttcn3_syssim syssim(ue.get());
if (syssim.init(ue_args) != SRSLTE_SUCCESS) {
fprintf(stderr, "Error: Couldn't initialize system simulator\n");
return SRSLTE_ERROR;

@ -29,7 +29,7 @@
#include "ttcn3_ut_interface.h"
#include <functional>
ttcn3_syssim::ttcn3_syssim(srslte::logger& logger_file_, srslte::logger& logger_stdout_, ttcn3_ue* ue_) :
ttcn3_syssim::ttcn3_syssim(ttcn3_ue* ue_) :
logger(srslog::fetch_basic_logger("SS")),
ut_logger(srslog::fetch_basic_logger("UT", false)),
sys_logger(srslog::fetch_basic_logger("SYS", false)),
@ -46,13 +46,9 @@ ttcn3_syssim::ttcn3_syssim(srslte::logger& logger_file_, srslte::logger& logger_
ip_ctrl(ip_ctrl_logger),
srb(srb_logger),
drb(drb_logger),
log{"SS "},
mac_msg_ul(20, ss_mac_logger),
mac_msg_dl(20, ss_mac_logger),
pdus(logger, 128),
logger_stdout(logger_stdout_),
logger_file(logger_file_),
old_logger(&logger_file),
ue(ue_),
signal_handler(&running),
timer_handler(create_tti_timer(), [&](uint64_t res) { new_tti_indication(res); })
@ -71,7 +67,6 @@ int ttcn3_syssim::init(const all_args_t& args_)
// Make sure to get SS logging as well
if (args.log.filename == "stdout") {
old_logger = &logger_stdout;
auto* swp_sink = srslog::find_sink(swappable_sink::name());
if (!swp_sink) {
logger.error("Unable to find the swappable sink");
@ -80,12 +75,8 @@ int ttcn3_syssim::init(const all_args_t& args_)
}
static_cast<swappable_sink*>(swp_sink)->swap_to_stdout();
}
srslte::logmap::set_default_logger(old_logger);
// init and configure logging
log->set_level(args.log.all_level);
auto logger_lvl = srslog::str_to_basic_level(args.log.all_level);
logger.set_level(logger_lvl);
ut_logger.set_level(logger_lvl);
@ -98,8 +89,6 @@ int ttcn3_syssim::init(const all_args_t& args_)
ss_rlc_logger.set_level(logger_lvl);
ss_pdcp_logger.set_level(logger_lvl);
log->set_hex_limit(args.log.all_hex_limit);
logger.set_hex_dump_max_size(args.log.all_hex_limit);
ut_logger.set_hex_dump_max_size(args.log.all_hex_limit);
sys_logger.set_hex_dump_max_size(args.log.all_hex_limit);
@ -207,7 +196,6 @@ void ttcn3_syssim::new_tti_indication(uint64_t res)
{
tti = (tti + 1) % 10240;
log->step(tti);
logger.set_context(tti);
logger.debug("Start TTI");
@ -420,12 +408,10 @@ void ttcn3_syssim::tc_start(const char* name)
// set up logging
if (args.log.filename == "stdout") {
old_logger = &logger_stdout;
static_cast<swappable_sink*>(swp_sink)->swap_to_stdout();
} else {
const std::string& file_tc_name = get_filename_with_tc_name(local_args.log.filename, run_id, tc_name);
static_cast<swappable_sink*>(swp_sink)->swap_sink(file_tc_name);
old_logger = &logger_file;
}
logger.info("Initializing UE ID=%d for TC=%s", run_id, tc_name.c_str());

Loading…
Cancel
Save