This commit is contained in:
Paul Sutton 2017-06-23 15:52:00 +01:00
commit 769c2c1f6b
23 changed files with 235 additions and 494 deletions

View File

@ -65,7 +65,7 @@ if(RF_FOUND)
add_executable(cell_search cell_search.c) add_executable(cell_search cell_search.c)
target_link_libraries(cell_search srslte_phy srslte_rf) target_link_libraries(cell_search srslte_phy srslte_rf)
add_executable(cell_measurement cell_measurement.c) add_executable(cell_measurement cell_measurement.c ../include/srslte/common/logger_stdout.h)
target_link_libraries(cell_measurement srslte_phy srslte_rf) target_link_libraries(cell_measurement srslte_phy srslte_rf)
add_executable(usrp_capture usrp_capture.c) add_executable(usrp_capture usrp_capture.c)

View File

@ -38,15 +38,19 @@
#include <stdarg.h> #include <stdarg.h>
#include <string> #include <string>
#include "srslte/common/log.h" #include "srslte/common/log.h"
#include "logger.h" #include "srslte/common/logger.h"
#include "srslte/common/logger_stdout.h"
namespace srslte { namespace srslte {
typedef std::string* str_ptr;
class log_filter : public srslte::log class log_filter : public srslte::log
{ {
public: public:
log_filter(); log_filter();
log_filter(std::string layer);
log_filter(std::string layer, logger *logger_, bool tti=false); log_filter(std::string layer, logger *logger_, bool tti=false);
void init(std::string layer, logger *logger_, bool tti=false); void init(std::string layer, logger *logger_, bool tti=false);
@ -71,6 +75,8 @@ private:
logger *logger_h; logger *logger_h;
bool do_tti; bool do_tti;
logger_stdout def_logger_stdout;
void all_log(srslte::LOG_LEVEL_ENUM level, uint32_t tti, char *msg); void all_log(srslte::LOG_LEVEL_ENUM level, uint32_t tti, char *msg);
void all_log(srslte::LOG_LEVEL_ENUM level, uint32_t tti, char *msg, uint8_t *hex, int size); void all_log(srslte::LOG_LEVEL_ENUM level, uint32_t tti, char *msg, uint8_t *hex, int size);
void all_log_line(srslte::LOG_LEVEL_ENUM level, uint32_t tti, std::string file, int line, char *msg); void all_log_line(srslte::LOG_LEVEL_ENUM level, uint32_t tti, std::string file, int line, char *msg);

View File

@ -1,82 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: log_stout.h
*
* Description: Logging service through standard output. Inherits log interface
*
* Reference:
*****************************************************************************/
#ifndef LOGSTDOUT_H
#define LOGSTDOUT_H
#include <stdarg.h>
#include <string>
#include "srslte/common/log.h"
namespace srslte {
class log_stdout : public log
{
public:
log_stdout(std::string service_name_) : log(service_name_) { }
void console(std::string message, ...);
void error(std::string message, ...);
void warning(std::string message, ...);
void info(std::string message, ...);
void debug(std::string message, ...);
// Same with hex dump
void error_hex(uint8_t *hex, int size, std::string message, ...);
void warning_hex(uint8_t *hex, int size, std::string message, ...);
void info_hex(uint8_t *hex, int size, std::string message, ...);
void debug_hex(uint8_t *hex, int size, std::string message, ...);
// Same with line and file info
void error_line(std::string file, int line, std::string message, ...);
void warning_line(std::string file, int line, std::string message, ...);
void info_line(std::string file, int line, std::string message, ...);
void debug_line(std::string file, int line, std::string message, ...);
private:
void printlog(srslte::LOG_LEVEL_ENUM level, uint32_t tti, std::string file, int line, std::string message, va_list args);
void printlog(srslte::LOG_LEVEL_ENUM level, uint32_t tti, std::string message, va_list args);
void all_log(srslte::LOG_LEVEL_ENUM level, uint32_t tti, char *msg);
void all_log(srslte::LOG_LEVEL_ENUM level, uint32_t tti, char *msg, uint8_t *hex, int size);
void all_log_line(srslte::LOG_LEVEL_ENUM level, uint32_t tti, std::string file, int line, char *msg);
std::string now_time();
std::string hex_string(uint8_t *hex, int size);
};
}
#endif

View File

@ -26,49 +26,23 @@
/****************************************************************************** /******************************************************************************
* File: logger.h * File: logger.h
* Description: Common log object. Maintains a queue of log messages * Description: Interface for logging output
* and runs a thread to read messages and write to file.
* Multiple producers, single consumer. If full, producers
* increase queue size. If empty, consumer blocks.
*****************************************************************************/ *****************************************************************************/
#ifndef LOGGER_H #ifndef LOGGER_H
#define LOGGER_H #define LOGGER_H
#include <stdio.h> #include <stdio.h>
#include <deque>
#include <string> #include <string>
#include "srslte/common/threads.h"
namespace srslte { namespace srslte {
typedef std::string* str_ptr; class logger
class logger : public thread
{ {
public: public:
logger(); virtual void log(std::string *msg) = 0;
logger(std::string file);
~logger();
void init(std::string file);
void log(const char *msg);
void log(str_ptr msg);
private:
void run_thread();
void flush();
FILE* logfile;
bool inited;
bool not_done;
std::string filename;
pthread_cond_t not_empty;
pthread_cond_t not_full;
pthread_mutex_t mutex;
pthread_t thread;
std::deque<str_ptr> buffer;
}; };
} // namespace srsue } // namespace srslte
#endif // LOGGER_H #endif // LOGGER_H

View File

@ -0,0 +1,76 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: logger_file.h
* Description: Common log object. Maintains a queue of log messages
* and runs a thread to read messages and write to file.
* Multiple producers, single consumer. If full, producers
* increase queue size. If empty, consumer blocks.
*****************************************************************************/
#ifndef LOGGER_FILE_H
#define LOGGER_FILE_H
#include <stdio.h>
#include <deque>
#include <string>
#include "srslte/common/logger.h"
#include "srslte/common/threads.h"
namespace srslte {
typedef std::string* str_ptr;
class logger_file : public thread, public logger
{
public:
logger_file();
logger_file(std::string file);
~logger_file();
void init(std::string file);
// Implementation of log_out
void log(str_ptr msg);
void log(const char *msg);
private:
void run_thread();
void flush();
FILE* logfile;
bool inited;
bool not_done;
std::string filename;
pthread_cond_t not_empty;
pthread_cond_t not_full;
pthread_mutex_t mutex;
pthread_t thread;
std::deque<str_ptr> buffer;
};
} // namespace srsue
#endif // LOGGER_H

View File

@ -0,0 +1,51 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: logger_stdout.h
* Description: Interface for logging output
*****************************************************************************/
#ifndef LOGGER_STDOUT_H
#define LOGGER_STDOUT_H
#include <stdio.h>
#include <string>
#include "srslte/common/logger.h"
namespace srslte {
class logger_stdout : public logger
{
public:
void log(std::string *msg) {
fprintf(stdout, "%s", msg->c_str());
}
};
} // namespace srslte
#endif // LOGGER_H

View File

@ -40,6 +40,11 @@ log_filter::log_filter()
do_tti = false; do_tti = false;
} }
log_filter::log_filter(std::string layer)
{
init(layer, &def_logger_stdout, tti);
}
log_filter::log_filter(std::string layer, logger *logger_, bool tti) log_filter::log_filter(std::string layer, logger *logger_, bool tti)
{ {
init(layer, logger_, tti); init(layer, logger_, tti);

View File

@ -1,290 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <stdarg.h>
#include <string>
#include "srslte/common/log_stdout.h"
using namespace std;
namespace srslte {
void log_stdout::all_log(srslte::LOG_LEVEL_ENUM level,
uint32_t tti,
char *msg)
{
std::stringstream ss;
ss << now_time() << " ";
ss << "[" <<get_service_name() << "] ";
ss << log_level_text[level] << " ";
ss << "[" << std::setfill('0') << std::setw(5) << tti << "] ";
ss << msg;
cout << ss.str();
}
void log_stdout::all_log(srslte::LOG_LEVEL_ENUM level,
uint32_t tti,
char *msg,
uint8_t *hex,
int size)
{
std::stringstream ss;
ss << now_time() << " ";
ss << "[" <<get_service_name() << "] ";
ss << log_level_text[level] << " ";
ss << "[" << std::setfill('0') << std::setw(5) << tti << "] ";
ss << msg << std::endl;
ss << hex_string(hex, size);
cout << ss.str();
}
void log_stdout::all_log_line(srslte::LOG_LEVEL_ENUM level,
uint32_t tti,
std::string file,
int line,
char *msg)
{
std::stringstream ss;
ss << now_time() << " ";
ss << "[" <<get_service_name() << "] ";
ss << log_level_text[level] << " ";
ss << "[" << std::setfill('0') << std::setw(5) << tti << "] ";
ss << msg;
cout << ss.str();
}
void log_stdout::console(std::string message, ...) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
printf("%s",args_msg); // Print directly to stdout
va_end(args);
free(args_msg);
}
void log_stdout::error(std::string message, ...) {
if (level >= LOG_LEVEL_ERROR) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log(LOG_LEVEL_ERROR, tti, args_msg);
va_end(args);
free(args_msg);
}
}
void log_stdout::warning(std::string message, ...) {
if (level >= LOG_LEVEL_WARNING) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log(LOG_LEVEL_WARNING, tti, args_msg);
va_end(args);
free(args_msg);
}
}
void log_stdout::info(std::string message, ...) {
if (level >= LOG_LEVEL_INFO) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log(LOG_LEVEL_INFO, tti, args_msg);
va_end(args);
free(args_msg);
}
}
void log_stdout::debug(std::string message, ...) {
if (level >= LOG_LEVEL_DEBUG) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log(LOG_LEVEL_DEBUG, tti, args_msg);
va_end(args);
free(args_msg);
}
}
void log_stdout::error_hex(uint8_t *hex, int size, std::string message, ...) {
if (level >= LOG_LEVEL_ERROR) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log(LOG_LEVEL_ERROR, tti, args_msg, hex, size);
va_end(args);
free(args_msg);
}
}
void log_stdout::warning_hex(uint8_t *hex, int size, std::string message, ...) {
if (level >= LOG_LEVEL_WARNING) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log(LOG_LEVEL_WARNING, tti, args_msg, hex, size);
va_end(args);
free(args_msg);
}
}
void log_stdout::info_hex(uint8_t *hex, int size, std::string message, ...) {
if (level >= LOG_LEVEL_INFO) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log(LOG_LEVEL_INFO, tti, args_msg, hex, size);
va_end(args);
free(args_msg);
}
}
void log_stdout::debug_hex(uint8_t *hex, int size, std::string message, ...) {
if (level >= LOG_LEVEL_DEBUG) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log(LOG_LEVEL_DEBUG, tti, args_msg, hex, size);
va_end(args);
free(args_msg);
}
}
void log_stdout::error_line(std::string file, int line, std::string message, ...)
{
if (level >= LOG_LEVEL_ERROR) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log_line(LOG_LEVEL_ERROR, tti, file, line, args_msg);
va_end(args);
free(args_msg);
}
}
void log_stdout::warning_line(std::string file, int line, std::string message, ...)
{
if (level >= LOG_LEVEL_WARNING) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log_line(LOG_LEVEL_WARNING, tti, file, line, args_msg);
va_end(args);
free(args_msg);
}
}
void log_stdout::info_line(std::string file, int line, std::string message, ...)
{
if (level >= LOG_LEVEL_INFO) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log_line(LOG_LEVEL_INFO, tti, file, line, args_msg);
va_end(args);
free(args_msg);
}
}
void log_stdout::debug_line(std::string file, int line, std::string message, ...)
{
if (level >= LOG_LEVEL_DEBUG) {
char *args_msg;
va_list args;
va_start(args, message);
if(vasprintf(&args_msg, message.c_str(), args) > 0)
all_log_line(LOG_LEVEL_DEBUG, tti, file, line, args_msg);
va_end(args);
free(args_msg);
}
}
std::string log_stdout::now_time()
{
struct timeval rawtime;
struct tm * timeinfo;
char buffer[64];
char us[16];
gettimeofday(&rawtime, NULL);
timeinfo = localtime(&rawtime.tv_sec);
strftime(buffer,64,"%H:%M:%S",timeinfo);
strcat(buffer,".");
snprintf(us,16,"%ld",rawtime.tv_usec);
strcat(buffer,us);
return std::string(buffer);
}
std::string log_stdout::hex_string(uint8_t *hex, int size)
{
std::stringstream ss;
int c = 0;
ss << std::hex << std::setfill('0');
if(hex_limit >= 0) {
size = (size > hex_limit) ? hex_limit : size;
}
while(c < size) {
ss << " " << std::setw(4) << static_cast<unsigned>(c) << ": ";
int tmp = (size-c < 16) ? size-c : 16;
for(int i=0;i<tmp;i++) {
ss << std::setw(2) << static_cast<unsigned>(hex[c++]) << " ";
}
ss << "\n";
}
return ss.str();
}
}

View File

@ -27,20 +27,20 @@
#define LOG_BUFFER_SIZE 1024*32 #define LOG_BUFFER_SIZE 1024*32
#include "srslte/common/logger.h" #include "srslte/common/logger_file.h"
using namespace std; using namespace std;
namespace srslte{ namespace srslte{
logger::logger() logger_file::logger_file()
:inited(false) :inited(false)
,not_done(true) ,not_done(true)
{} {}
logger::~logger() { logger_file::~logger_file() {
not_done = false; not_done = false;
log("Closing log"); log(new std::string("Closing log"));
if(inited) { if(inited) {
wait_thread_finish(); wait_thread_finish();
flush(); flush();
@ -48,7 +48,7 @@ logger::~logger() {
} }
} }
void logger::init(std::string file) { void logger_file::init(std::string file) {
pthread_mutex_init(&mutex, NULL); pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&not_empty, NULL); pthread_cond_init(&not_empty, NULL);
pthread_cond_init(&not_full, NULL); pthread_cond_init(&not_full, NULL);
@ -61,19 +61,18 @@ void logger::init(std::string file) {
inited = true; inited = true;
} }
void logger::log(const char *msg) { void logger_file::log(const char *msg) {
str_ptr s_ptr(new std::string(msg)); log(new std::string(msg));
log(s_ptr);
} }
void logger::log(str_ptr msg) { void logger_file::log(str_ptr msg) {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
buffer.push_back(msg); buffer.push_back(msg);
pthread_cond_signal(&not_empty); pthread_cond_signal(&not_empty);
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
} }
void logger::run_thread() { void logger_file::run_thread() {
while(not_done) { while(not_done) {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
while(buffer.empty()) { while(buffer.empty()) {
@ -89,7 +88,7 @@ void logger::run_thread() {
} }
} }
void logger::flush() { void logger_file::flush() {
std::deque<str_ptr>::iterator it; std::deque<str_ptr>::iterator it;
for(it=buffer.begin();it!=buffer.end();it++) for(it=buffer.begin();it!=buffer.end();it++)
{ {

View File

@ -29,11 +29,12 @@
#include <stdio.h> #include <stdio.h>
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include "srslte/common/logger_file.h"
using namespace srslte; using namespace srslte;
typedef struct { typedef struct {
logger *l; logger_file *l;
int thread_id; int thread_id;
}args_t; }args_t;
@ -78,7 +79,7 @@ void* thread_loop_hex(void *a) {
} }
void write(std::string filename) { void write(std::string filename) {
logger l; logger_file l;
l.init(filename); l.init(filename);
pthread_t threads[NTHREADS]; pthread_t threads[NTHREADS];
args_t args[NTHREADS]; args_t args[NTHREADS];

View File

@ -29,12 +29,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "srslte/common/logger.h" #include "srslte/common/logger_file.h"
using namespace srslte; using namespace srslte;
typedef struct { typedef struct {
logger *l; logger_file *l;
int thread_id; int thread_id;
}args_t; }args_t;
@ -44,13 +44,13 @@ void* thread_loop(void *a) {
for(int i=0;i<NMSGS;i++) for(int i=0;i<NMSGS;i++)
{ {
sprintf(buf, "Thread %d: %d", args->thread_id, i); sprintf(buf, "Thread %d: %d", args->thread_id, i);
args->l->log(buf); args->l->log(new std::string(buf));
} }
return NULL; return NULL;
} }
void write(std::string filename) { void write(std::string filename) {
logger l; logger_file l;
l.init(filename); l.init(filename);
pthread_t threads[NTHREADS]; pthread_t threads[NTHREADS];
args_t args[NTHREADS]; args_t args[NTHREADS];

View File

@ -25,7 +25,8 @@
*/ */
#include <iostream> #include <iostream>
#include "srslte/common/log_stdout.h" #include "srslte/common/log_filter.h"
#include "srslte/common/logger_stdout.h"
#include "srslte/upper/rlc_am.h" #include "srslte/upper/rlc_am.h"
#include <assert.h> #include <assert.h>
#define NBUFS 5 #define NBUFS 5
@ -73,8 +74,8 @@ public:
void basic_test() void basic_test()
{ {
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -152,8 +153,8 @@ void basic_test()
void concat_test() void concat_test()
{ {
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -216,8 +217,8 @@ void concat_test()
void segment_test() void segment_test()
{ {
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -298,8 +299,8 @@ void segment_test()
void retx_test() void retx_test()
{ {
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -394,8 +395,8 @@ void resegment_test_1()
// PDUs: | 10 | 10 | 10 | 10 | 10 | // PDUs: | 10 | 10 | 10 | 10 | 10 |
// Retx PDU segments: | 5 | 5| // Retx PDU segments: | 5 | 5|
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -503,8 +504,8 @@ void resegment_test_2()
// PDUs: | 5 | 10 | 20 | 10 | 5 | // PDUs: | 5 | 10 | 20 | 10 | 5 |
// Retx PDU segments: | 10 | 10 | // Retx PDU segments: | 10 | 10 |
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -609,8 +610,8 @@ void resegment_test_3()
// PDUs: | 5 | 5| 20 | 10 | 10 | // PDUs: | 5 | 5| 20 | 10 | 10 |
// Retx PDU segments: | 10 | 10 | // Retx PDU segments: | 10 | 10 |
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -711,8 +712,8 @@ void resegment_test_4()
// PDUs: | 5 | 5| 30 | 5 | 5| // PDUs: | 5 | 5| 30 | 5 | 5|
// Retx PDU segments: | 15 | 15 | // Retx PDU segments: | 15 | 15 |
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -813,8 +814,8 @@ void resegment_test_5()
// PDUs: |2|3| 40 |3|2| // PDUs: |2|3| 40 |3|2|
// Retx PDU segments: | 20 | 20 | // Retx PDU segments: | 20 | 20 |
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -914,8 +915,8 @@ void resegment_test_6()
// PDUs: |10|10|10| 270 | 54 | // PDUs: |10|10|10| 270 | 54 |
// Retx PDU segments: | 120 | 150 | // Retx PDU segments: | 120 | 150 |
srslte::log_stdout log1("RLC_AM_1"); srslte::log_filter log1("RLC_AM_1");
srslte::log_stdout log2("RLC_AM_2"); srslte::log_filter log2("RLC_AM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);

View File

@ -25,7 +25,7 @@
*/ */
#include <iostream> #include <iostream>
#include "srslte/common/log_stdout.h" #include "srslte/common/log_filter.h"
#include "srslte/upper/rlc_um.h" #include "srslte/upper/rlc_um.h"
#include <assert.h> #include <assert.h>
@ -78,8 +78,8 @@ public:
void basic_test() void basic_test()
{ {
srslte::log_stdout log1("RLC_UM_1"); srslte::log_filter log1("RLC_UM_1");
srslte::log_stdout log2("RLC_UM_2"); srslte::log_filter log2("RLC_UM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -146,8 +146,8 @@ void basic_test()
void loss_test() void loss_test()
{ {
srslte::log_stdout log1("RLC_UM_1"); srslte::log_filter log1("RLC_UM_1");
srslte::log_stdout log2("RLC_UM_2"); srslte::log_filter log2("RLC_UM_2");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG); log2.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);

View File

@ -50,7 +50,7 @@
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
#include "srslte/interfaces/ue_interfaces.h" #include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/logger.h" #include "srslte/common/logger_file.h"
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include "srslte/common/mac_pcap.h" #include "srslte/common/mac_pcap.h"
#include "srslte/interfaces/sched_interface.h" #include "srslte/interfaces/sched_interface.h"
@ -173,7 +173,7 @@ private:
srsenb::gtpu gtpu; srsenb::gtpu gtpu;
srsenb::s1ap s1ap; srsenb::s1ap s1ap;
srslte::logger logger; srslte::logger_file logger;
srslte::log_filter rf_log; srslte::log_filter rf_log;
std::vector<void*> phy_log; std::vector<void*> phy_log;
srslte::log_filter mac_log; srslte::log_filter mac_log;

View File

@ -6,7 +6,7 @@
#include "srslte/interfaces/enb_interfaces.h" #include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/sched_interface.h" #include "srslte/interfaces/sched_interface.h"
#include "srslte/common/log_stdout.h" #include "srslte/common/log_filter.h"
#include "srslte/radio/radio.h" #include "srslte/radio/radio.h"
#include "srslte/phy/utils/debug.h" #include "srslte/phy/utils/debug.h"
@ -62,7 +62,7 @@ private:
// Create classes // Create classes
srslte::log_stdout log_out("ALL"); srslte::log_filter log_out("ALL");
srsenb::sched my_sched; srsenb::sched my_sched;
srsenb::dl_metric_rr dl_metric; srsenb::dl_metric_rr dl_metric;
srsenb::ul_metric_rr ul_metric; srsenb::ul_metric_rr ul_metric;

View File

@ -16,7 +16,7 @@
#include "srslte/interfaces/enb_interfaces.h" #include "srslte/interfaces/enb_interfaces.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
#include "srslte/common/logger.h" #include "srslte/common/logger_file.h"
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include "srslte/upper/rlc.h" #include "srslte/upper/rlc.h"
#include "srslte/radio/radio.h" #include "srslte/radio/radio.h"
@ -320,7 +320,7 @@ private:
// Create classes // Create classes
srslte::logger logger; srslte::logger_file logger;
srslte::log_filter log_phy; srslte::log_filter log_phy;
srslte::log_filter log_mac; srslte::log_filter log_mac;
srslte::log_filter log_rlc; srslte::log_filter log_rlc;

View File

@ -49,7 +49,7 @@
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
#include "srslte/interfaces/ue_interfaces.h" #include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/logger.h" #include "srslte/common/logger_file.h"
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include "ue_metrics_interface.h" #include "ue_metrics_interface.h"
@ -173,7 +173,7 @@ private:
srslte::gw gw; srslte::gw gw;
srsue::usim usim; srsue::usim usim;
srslte::logger logger; srslte::logger_file logger;
srslte::log_filter rf_log; srslte::log_filter rf_log;
srslte::log_filter phy_log; srslte::log_filter phy_log;
srslte::log_filter mac_log; srslte::log_filter mac_log;

View File

@ -32,7 +32,7 @@
#include "srslte/radio/radio_multi.h" #include "srslte/radio/radio_multi.h"
#include "phy/phy.h" #include "phy/phy.h"
#include "srslte/interfaces/ue_interfaces.h" #include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/log_stdout.h" #include "srslte/common/log_filter.h"
#include "mac/mac.h" #include "mac/mac.h"
#include "srslte/common/mac_pcap.h" #include "srslte/common/mac_pcap.h"
@ -427,7 +427,7 @@ private:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
srslte::log_stdout mac_log("MAC"), phy_log("PHY"); srslte::log_filter mac_log("MAC"), phy_log("PHY");
rlctest my_rlc; rlctest my_rlc;
parse_args(&prog_args, argc, argv); parse_args(&prog_args, argc, argv);

View File

@ -29,7 +29,7 @@
#include "srslte/phy/utils/debug.h" #include "srslte/phy/utils/debug.h"
#include "phy/phy.h" #include "phy/phy.h"
#include "srslte/interfaces/ue_interfaces.h" #include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/log_stdout.h" #include "srslte/common/log_filter.h"
#include "srslte/radio/radio_multi.h" #include "srslte/radio/radio_multi.h"
/********************************************************************** /**********************************************************************
@ -330,7 +330,7 @@ srslte::radio_multi radio;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
srslte::log_stdout log("PHY"); srslte::log_filter log("PHY");
parse_args(&prog_args, argc, argv); parse_args(&prog_args, argc, argv);

View File

@ -28,7 +28,7 @@
#include "srslte/phy/utils/debug.h" #include "srslte/phy/utils/debug.h"
#include "phy/phy.h" #include "phy/phy.h"
#include "srslte/common/log_stdout.h" #include "srslte/common/log_filter.h"
#include "srslte/interfaces/ue_interfaces.h" #include "srslte/interfaces/ue_interfaces.h"
#include "srslte/radio/radio_multi.h" #include "srslte/radio/radio_multi.h"
@ -153,7 +153,7 @@ srslte::radio_multi radio;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
srslte::log_stdout log("PHY"); srslte::log_filter log("PHY");
parse_args(&prog_args, argc, argv); parse_args(&prog_args, argc, argv);

View File

@ -21,7 +21,7 @@
#include "srslte/common/threads.h" #include "srslte/common/threads.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
#include "srslte/common/logger.h" #include "srslte/common/logger_file.h"
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include "srslte/upper/rlc.h" #include "srslte/upper/rlc.h"
#include "upper/rrc.h" #include "upper/rrc.h"
@ -464,7 +464,7 @@ private:
// Create classes // Create classes
srslte::logger logger; srslte::logger_file logger;
srslte::log_filter log_phy; srslte::log_filter log_phy;
srslte::log_filter log_mac; srslte::log_filter log_mac;
srslte::log_filter log_rlc; srslte::log_filter log_rlc;

View File

@ -26,12 +26,12 @@
#include <iostream> #include <iostream>
#include <srslte/srslte.h> #include <srslte/srslte.h>
#include "srslte/common/log_stdout.h" #include "srslte/common/log_filter.h"
#include "srslte/asn1/liblte_rrc.h" #include "srslte/asn1/liblte_rrc.h"
#include "srslte/asn1/liblte_mme.h" #include "srslte/asn1/liblte_mme.h"
void nas_test() { void nas_test() {
srslte::log_stdout log1("NAS"); srslte::log_filter log1("NAS");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
@ -91,7 +91,7 @@ void nas_test() {
} }
void basic_test() { void basic_test() {
srslte::log_stdout log1("RRC"); srslte::log_filter log1("RRC");
log1.set_level(srslte::LOG_LEVEL_DEBUG); log1.set_level(srslte::LOG_LEVEL_DEBUG);
log1.set_hex_limit(-1); log1.set_hex_limit(-1);

View File

@ -26,7 +26,7 @@
#include <iostream> #include <iostream>
#include "upper/usim.h" #include "upper/usim.h"
#include "srslte/common/log_stdout.h" #include "srslte/common/log_filter.h"
#include <assert.h> #include <assert.h>
using namespace srsue; using namespace srsue;
@ -67,7 +67,7 @@ uint16 mnc = 93;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
srslte::log_stdout usim_log("USIM"); srslte::log_filter usim_log("USIM");
bool net_valid; bool net_valid;
uint8_t res[16]; uint8_t res[16];