summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/CMakeLists.txt1
-rw-r--r--host/include/uhd/config.hpp9
-rw-r--r--host/lib/transport/CMakeLists.txt1
-rw-r--r--host/lib/transport/vrt_packet_handler.hpp13
4 files changed, 18 insertions, 6 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index f2725e4b3..0b2d3f012 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -62,6 +62,7 @@ IF(UNIX)
UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-ansi HAVE_ANSI)
#only export symbols that are declared to be part of the uhd api:
UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
+ UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-O3 HAVE_O3) #have some optimizations
ENDIF(UNIX)
IF(WIN32)
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp
index 32eafc89b..fea95145c 100644
--- a/host/include/uhd/config.hpp
+++ b/host/include/uhd/config.hpp
@@ -76,4 +76,13 @@
#define UHD_LOCAL
#endif // UHD_DLL
+// Define force inline macro
+#ifdef BOOST_MSVC
+ #define UHD_INLINE __forceinline
+#elif defined(__GNUG__) && __GNUG__ >= 4
+ #define UHD_INLINE inline __attribute__((always_inline))
+#else
+ #define UHD_INLINE inline
+#endif
+
#endif /* INCLUDED_UHD_CONFIG_HPP */
diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt
index a36f0fc03..ed8c35225 100644
--- a/host/lib/transport/CMakeLists.txt
+++ b/host/lib/transport/CMakeLists.txt
@@ -49,4 +49,5 @@ LIBUHD_APPEND_SOURCES(
${CMAKE_SOURCE_DIR}/lib/transport/if_addrs.cpp
${CMAKE_SOURCE_DIR}/lib/transport/udp_simple.cpp
${CMAKE_SOURCE_DIR}/lib/transport/udp_zero_copy_asio.cpp
+ ${CMAKE_SOURCE_DIR}/lib/transport/vrt_packet_handler.hpp
)
diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp
index cd0c89b05..f6353ef99 100644
--- a/host/lib/transport/vrt_packet_handler.hpp
+++ b/host/lib/transport/vrt_packet_handler.hpp
@@ -18,6 +18,7 @@
#ifndef INCLUDED_LIBUHD_TRANSPORT_VRT_PACKET_HANDLER_HPP
#define INCLUDED_LIBUHD_TRANSPORT_VRT_PACKET_HANDLER_HPP
+#include <uhd/config.hpp>
#include <uhd/types/io_type.hpp>
#include <uhd/types/otw_type.hpp>
#include <uhd/types/metadata.hpp>
@@ -53,7 +54,7 @@ namespace vrt_packet_handler{
typedef boost::function<void(uhd::transport::managed_recv_buffer::sptr)> recv_cb_t;
- static inline void recv_cb_nop(uhd::transport::managed_recv_buffer::sptr){
+ static UHD_INLINE void recv_cb_nop(uhd::transport::managed_recv_buffer::sptr){
/* NOP */
}
@@ -61,7 +62,7 @@ namespace vrt_packet_handler{
* Unpack a received vrt header and set the copy buffer.
* - helper function for vrt_packet_handler::recv
******************************************************************/
- static inline void _recv_helper(
+ static UHD_INLINE void _recv_helper(
recv_state &state,
uhd::rx_metadata_t &metadata,
double tick_rate,
@@ -100,7 +101,7 @@ namespace vrt_packet_handler{
/*******************************************************************
* Recv vrt packets and copy convert the samples into the buffer.
******************************************************************/
- static inline size_t recv(
+ static UHD_INLINE size_t recv(
recv_state &state,
const boost::asio::mutable_buffer &buff,
uhd::rx_metadata_t &metadata,
@@ -168,7 +169,7 @@ namespace vrt_packet_handler{
typedef boost::function<void(uhd::transport::managed_send_buffer::sptr)> send_cb_t;
- static inline void send_cb_nop(uhd::transport::managed_send_buffer::sptr){
+ static UHD_INLINE void send_cb_nop(uhd::transport::managed_send_buffer::sptr){
/* NOP */
}
@@ -176,7 +177,7 @@ namespace vrt_packet_handler{
* Pack a vrt header, copy-convert the data, and send it.
* - helper function for vrt_packet_handler::send
******************************************************************/
- static inline void _send_helper(
+ static UHD_INLINE void _send_helper(
send_state &state,
const void *send_mem,
size_t num_samps,
@@ -222,7 +223,7 @@ namespace vrt_packet_handler{
/*******************************************************************
* Send vrt packets and copy convert the samples into the buffer.
******************************************************************/
- static inline size_t send(
+ static UHD_INLINE size_t send(
send_state &state,
const boost::asio::const_buffer &buff,
const uhd::tx_metadata_t &metadata,