diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2017-04-06 10:11:10 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-04-06 13:39:31 -0700 |
commit | e59b2ba1286d21ad57a279094dec236255628bea (patch) | |
tree | 253aaa3f6e4c206718f8b107d27fbe96bdf3023d /host | |
parent | b8628dad4667649ce7f377e869d91fdcd90e10a2 (diff) | |
download | uhd-e59b2ba1286d21ad57a279094dec236255628bea.tar.gz uhd-e59b2ba1286d21ad57a279094dec236255628bea.tar.bz2 uhd-e59b2ba1286d21ad57a279094dec236255628bea.zip |
utils: add cmake switch to disable fastpath logging
Diffstat (limited to 'host')
-rw-r--r-- | host/cmake/Modules/UHDLog.cmake | 5 | ||||
-rw-r--r-- | host/include/uhd/utils/log.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/common/async_packet_handler.hpp | 15 |
3 files changed, 21 insertions, 3 deletions
diff --git a/host/cmake/Modules/UHDLog.cmake b/host/cmake/Modules/UHDLog.cmake index d5612f1ed..19b4c39ef 100644 --- a/host/cmake/Modules/UHDLog.cmake +++ b/host/cmake/Modules/UHDLog.cmake @@ -50,6 +50,11 @@ ELSE() ENDIF() ENDIF() +SET(UHD_LOG_FASTPATH_DISABLE "OFF" CACHE BOOL "Disable printing of fastpath logging symbols to stderr (DOSU)") +IF(UHD_LOG_FASTPATH_DISABLE) + ADD_DEFINITIONS(-DUHD_LOG_FASTPATH_DISABLE) +ENDIF() + SET(UHD_LOG_FILE "" CACHE FILE "Set UHD log file to a file in a existing directory") IF(NOT UHD_LOG_FILE STREQUAL "") ADD_DEFINITIONS(-DUHD_LOG_FILE=${UHD_LOG_FILE}) diff --git a/host/include/uhd/utils/log.hpp b/host/include/uhd/utils/log.hpp index d90fb4667..ce6ce16e7 100644 --- a/host/include/uhd/utils/log.hpp +++ b/host/include/uhd/utils/log.hpp @@ -182,8 +182,12 @@ namespace uhd { #define UHD_LOG_FATAL(component, message) #endif +#ifndef UHD_LOG_FASTPATH_DISABLE #define UHD_LOG_FASTPATH(message) \ std::cerr << message << std::flush; +#else +#define UHD_LOG_FASTPATH(message) +#endif // iostream-style logging #define UHD_LOGGER_TRACE(component) _UHD_LOG_INTERNAL(component, uhd::log::trace) diff --git a/host/lib/usrp/common/async_packet_handler.hpp b/host/lib/usrp/common/async_packet_handler.hpp index 15f05e508..fd4fed81e 100644 --- a/host/lib/usrp/common/async_packet_handler.hpp +++ b/host/lib/usrp/common/async_packet_handler.hpp @@ -55,14 +55,23 @@ namespace uhd{ namespace usrp{ if (metadata.event_code & ( async_metadata_t::EVENT_CODE_UNDERFLOW | async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET) - ) UHD_LOG_FASTPATH("U") + ) + { + UHD_LOG_FASTPATH("U") + } else if (metadata.event_code & ( async_metadata_t::EVENT_CODE_SEQ_ERROR | async_metadata_t::EVENT_CODE_SEQ_ERROR_IN_BURST) - ) UHD_LOG_FASTPATH("S") + ) + { + UHD_LOG_FASTPATH("S") + } else if (metadata.event_code & async_metadata_t::EVENT_CODE_TIME_ERROR - ) UHD_LOG_FASTPATH("L") + ) + { + UHD_LOG_FASTPATH("L") + } } |