summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------Theron0
-rw-r--r--include/gnuradio/gras.hpp9
-rw-r--r--include/gnuradio/sbuffer.ipp26
-rw-r--r--lib/block_allocator.cpp4
-rw-r--r--lib/block_task.cpp3
-rw-r--r--lib/element_impl.hpp4
-rw-r--r--lib/gras_impl/debug.hpp2
-rw-r--r--lib/gras_impl/input_buffer_queues.hpp26
-rw-r--r--lib/gras_impl/interruptible_thread.hpp2
-rw-r--r--lib/gras_impl/output_buffer_queues.hpp22
-rw-r--r--lib/sbuffer.cpp7
-rw-r--r--lib/top_block.cpp2
12 files changed, 58 insertions, 49 deletions
diff --git a/Theron b/Theron
-Subproject c6388f54e6ce75495ffd14d3aa6f24a66bb2545
+Subproject ccc8d247e4e55847cf6da9e9a072f902ca02335
diff --git a/include/gnuradio/gras.hpp b/include/gnuradio/gras.hpp
index 1e0087a..3b7c651 100644
--- a/include/gnuradio/gras.hpp
+++ b/include/gnuradio/gras.hpp
@@ -27,6 +27,15 @@
#define GRAS_MAX_ALIGNMENT 32
+//define cross platform attribute macros
+#if defined(BOOST_MSVC)
+ #define GRAS_FORCE_INLINE __forceinline
+#elif defined(__GNUG__) && __GNUG__ >= 4
+ #define GRAS_FORCE_INLINE inline __attribute__((always_inline))
+#else
+ #define GRAS_FORCE_INLINE inline
+#endif
+
namespace gnuradio
{
diff --git a/include/gnuradio/sbuffer.ipp b/include/gnuradio/sbuffer.ipp
index 15719b6..7ecc974 100644
--- a/include/gnuradio/sbuffer.ipp
+++ b/include/gnuradio/sbuffer.ipp
@@ -32,19 +32,18 @@ struct SBufferImpl
}
boost::detail::atomic_count count;
- size_t __pad; //avoid a probably non-issue w/ count
SBufferConfig config;
};
extern GRAS_API void sbuffer_handle_deref(SBufferImpl *impl);
-inline void intrusive_ptr_add_ref(SBufferImpl *impl)
+GRAS_FORCE_INLINE void intrusive_ptr_add_ref(SBufferImpl *impl)
{
++impl->count;
}
-inline void intrusive_ptr_release(SBufferImpl *impl)
+GRAS_FORCE_INLINE void intrusive_ptr_release(SBufferImpl *impl)
{
if (--impl->count == 0)
{
@@ -52,37 +51,44 @@ inline void intrusive_ptr_release(SBufferImpl *impl)
}
}
-inline void *SBuffer::get_actual_memory(void) const
+GRAS_FORCE_INLINE SBuffer::SBuffer(void):
+ offset(0),
+ length(0)
+{
+ //NOP
+}
+
+GRAS_FORCE_INLINE void *SBuffer::get_actual_memory(void) const
{
return (*this)->config.memory;
}
-inline size_t SBuffer::get_actual_length(void) const
+GRAS_FORCE_INLINE size_t SBuffer::get_actual_length(void) const
{
return (*this)->config.length;
}
-inline void *SBuffer::get(const ptrdiff_t delta_bytes) const
+GRAS_FORCE_INLINE void *SBuffer::get(const ptrdiff_t delta_bytes) const
{
return ((char *)(*this)->config.memory) + this->offset + delta_bytes;
}
-inline Affinity SBuffer::get_affinity(void) const
+GRAS_FORCE_INLINE Affinity SBuffer::get_affinity(void) const
{
return (*this)->config.affinity;
}
-inline size_t SBuffer::get_user_index(void) const
+GRAS_FORCE_INLINE size_t SBuffer::get_user_index(void) const
{
return (*this)->config.user_index;
}
-inline bool SBuffer::unique(void) const
+GRAS_FORCE_INLINE bool SBuffer::unique(void) const
{
return (*this)->count == 1;
}
-inline size_t SBuffer::use_count(void) const
+GRAS_FORCE_INLINE size_t SBuffer::use_count(void) const
{
return (*this)->count;
}
diff --git a/lib/block_allocator.cpp b/lib/block_allocator.cpp
index e26f350..c5f4637 100644
--- a/lib/block_allocator.cpp
+++ b/lib/block_allocator.cpp
@@ -21,8 +21,8 @@
using namespace gnuradio;
-const size_t AT_LEAST_DEFAULT_ITEMS = 1 << 14;
-const size_t AHH_TOO_MANY_BYTES = 1 << 16; //TODO
+const size_t AT_LEAST_DEFAULT_ITEMS = 1 << 17;
+const size_t AHH_TOO_MANY_BYTES = 1 << 20; //TODO
const size_t THIS_MANY_BUFFERS = 32;
const double EDGE_CASE_MITIGATION = 8.0; //edge case mitigation constant
diff --git a/lib/block_task.cpp b/lib/block_task.cpp
index 5214e9c..9cb7e22 100644
--- a/lib/block_task.cpp
+++ b/lib/block_task.cpp
@@ -264,6 +264,7 @@ void ElementImpl::handle_task(const tsbe::TaskInterface &task_iface)
//------------------------------------------------------------------
//-- trim the input tags that are past the consumption zone
//-- and post trimmed tags to the downstream based on policy
+ //-- //FIXME this propagation is AFTER the output buffers flushed... fix this
//------------------------------------------------------------------
for (size_t i = 0; i < num_inputs; i++)
{
@@ -313,7 +314,7 @@ void ElementImpl::handle_task(const tsbe::TaskInterface &task_iface)
this->conclusion(task_iface, inputs_done);
}
-inline void ElementImpl::conclusion(const tsbe::TaskInterface &task_iface, const bool inputs_done)
+GRAS_FORCE_INLINE void ElementImpl::conclusion(const tsbe::TaskInterface &task_iface, const bool inputs_done)
{
//if there are inputs, and not all are provided for,
//tell the block to check input queues and handle done
diff --git a/lib/element_impl.hpp b/lib/element_impl.hpp
index 39895fe..d791cb7 100644
--- a/lib/element_impl.hpp
+++ b/lib/element_impl.hpp
@@ -33,12 +33,12 @@
#include <vector>
#include <queue>
-static inline unsigned long myulround(const double x)
+static GRAS_FORCE_INLINE unsigned long myulround(const double x)
{
return (unsigned long)(x + 0.5);
}
-static inline unsigned long long myullround(const double x)
+static GRAS_FORCE_INLINE unsigned long long myullround(const double x)
{
return (unsigned long long)(x + 0.5);
}
diff --git a/lib/gras_impl/debug.hpp b/lib/gras_impl/debug.hpp
index 5aa8e8e..49260fe 100644
--- a/lib/gras_impl/debug.hpp
+++ b/lib/gras_impl/debug.hpp
@@ -31,7 +31,7 @@
//-- define to enable these debugs:
//----------------------------------------------------------------------
//#define WORK_DEBUG
-#define ASSERTING
+//#define ASSERTING
//----------------------------------------------------------------------
//-- various debug prints
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp
index df670c4..50a06ef 100644
--- a/lib/gras_impl/input_buffer_queues.hpp
+++ b/lib/gras_impl/input_buffer_queues.hpp
@@ -43,21 +43,21 @@ struct InputBufferQueues
);
//! Call to get an input buffer for work
- SBuffer front(const size_t i, bool &potential_inline);
+ SBuffer front(const size_t i, bool &potential_GRAS_FORCE_INLINE);
//! Call when input bytes consumed by work
void consume(const size_t i, const size_t bytes_consumed);
void resize(const size_t size);
- inline void push(const size_t i, const SBuffer &buffer)
+ GRAS_FORCE_INLINE void push(const size_t i, const SBuffer &buffer)
{
_queues[i].push_back(buffer);
_enqueued_bytes[i] += _queues[i].back().length;
__update(i);
}
- inline void flush(const size_t i)
+ GRAS_FORCE_INLINE void flush(const size_t i)
{
_queues[i] = std::deque<SBuffer>();
_bitset.reset(i);
@@ -68,31 +68,31 @@ struct InputBufferQueues
return _queues.size();
}
- inline void flush_all(void)
+ GRAS_FORCE_INLINE void flush_all(void)
{
const size_t old_size = this->size();
this->resize(0);
this->resize(old_size);
}
- inline bool ready(const size_t i) const
+ GRAS_FORCE_INLINE bool ready(const size_t i) const
{
return _bitset[i];
}
- inline bool empty(const size_t i) const
+ GRAS_FORCE_INLINE bool empty(const size_t i) const
{
return not _bitset[i];
}
- inline bool all_ready(void) const
+ GRAS_FORCE_INLINE bool all_ready(void) const
{
return (~_bitset).none();
}
void __prepare(const size_t i);
- inline void __update(const size_t i)
+ GRAS_FORCE_INLINE void __update(const size_t i)
{
_bitset.set(i, _enqueued_bytes[i] >= _reserve_bytes[i]);
}
@@ -108,7 +108,7 @@ struct InputBufferQueues
};
-inline void InputBufferQueues::resize(const size_t size)
+GRAS_FORCE_INLINE void InputBufferQueues::resize(const size_t size)
{
_bitset.resize(size);
_enqueued_bytes.resize(size, 0);
@@ -129,7 +129,7 @@ static size_t round_up_to_multiple(const size_t at_least, const size_t multiple)
}
-inline void InputBufferQueues::init(
+GRAS_FORCE_INLINE void InputBufferQueues::init(
const std::vector<size_t> &input_history_items,
const std::vector<size_t> &input_multiple_items,
const std::vector<size_t> &input_item_sizes
@@ -193,7 +193,7 @@ inline void InputBufferQueues::init(
}
-inline SBuffer InputBufferQueues::front(const size_t i, bool &potential_inline)
+GRAS_FORCE_INLINE SBuffer InputBufferQueues::front(const size_t i, bool &potential_inline)
{
//if (_queues[i].empty()) return BuffInfo();
@@ -216,7 +216,7 @@ inline SBuffer InputBufferQueues::front(const size_t i, bool &potential_inline)
return buff;
}
-inline void InputBufferQueues::__prepare(const size_t i)
+GRAS_FORCE_INLINE void InputBufferQueues::__prepare(const size_t i)
{
//HERE();
//assumes that we are always pushing proper history buffs on front
@@ -265,7 +265,7 @@ inline void InputBufferQueues::__prepare(const size_t i)
}
-inline void InputBufferQueues::consume(const size_t i, const size_t bytes_consumed)
+GRAS_FORCE_INLINE void InputBufferQueues::consume(const size_t i, const size_t bytes_consumed)
{
//if (bytes_consumed == 0) return true;
diff --git a/lib/gras_impl/interruptible_thread.hpp b/lib/gras_impl/interruptible_thread.hpp
index e7025bf..7546019 100644
--- a/lib/gras_impl/interruptible_thread.hpp
+++ b/lib/gras_impl/interruptible_thread.hpp
@@ -71,7 +71,7 @@ namespace gnuradio
_thread->join();
}
- inline void call(void)
+ GRAS_FORCE_INLINE void call(void)
{
boost::mutex::scoped_lock lock(_mutex);
if (not _callable) return;
diff --git a/lib/gras_impl/output_buffer_queues.hpp b/lib/gras_impl/output_buffer_queues.hpp
index cf3ea0c..6cd12c6 100644
--- a/lib/gras_impl/output_buffer_queues.hpp
+++ b/lib/gras_impl/output_buffer_queues.hpp
@@ -30,65 +30,65 @@ struct OutputBufferQueues
boost::dynamic_bitset<> _bitset;
std::vector<std::deque<T> > _queues;
- inline void resize(const size_t size)
+ GRAS_FORCE_INLINE void resize(const size_t size)
{
_bitset.resize(size);
_queues.resize(size);
}
- inline void push(const size_t i, const T &value)
+ GRAS_FORCE_INLINE void push(const size_t i, const T &value)
{
_queues[i].push_back(value);
_bitset.set(i);
}
//! used for input buffer inlining
- inline void push_front(const size_t i, const T &value)
+ GRAS_FORCE_INLINE void push_front(const size_t i, const T &value)
{
_queues[i].push_front(value);
_bitset.set(i);
}
- inline const T &front(const size_t i) const
+ GRAS_FORCE_INLINE const T &front(const size_t i) const
{
return _queues[i].front();
}
- inline T &front(const size_t i)
+ GRAS_FORCE_INLINE T &front(const size_t i)
{
return _queues[i].front();
}
- inline void pop(const size_t i)
+ GRAS_FORCE_INLINE void pop(const size_t i)
{
_queues[i].pop_front();
_bitset.set(i, not _queues[i].empty());
}
- inline void flush(const size_t i)
+ GRAS_FORCE_INLINE void flush(const size_t i)
{
_queues[i] = std::deque<T>();
_bitset.reset(i);
}
- inline void flush_all(void)
+ GRAS_FORCE_INLINE void flush_all(void)
{
_queues.clear();
_queues.resize(_bitset.size());
_bitset.reset();
}
- inline bool ready(const size_t i) const
+ GRAS_FORCE_INLINE bool ready(const size_t i) const
{
return not _queues[i].empty();
}
- inline bool empty(const size_t i) const
+ GRAS_FORCE_INLINE bool empty(const size_t i) const
{
return _queues[i].empty();
}
- inline bool all_ready(void) const
+ GRAS_FORCE_INLINE bool all_ready(void) const
{
return (~_bitset).none();
}
diff --git a/lib/sbuffer.cpp b/lib/sbuffer.cpp
index 31e3943..6662bb7 100644
--- a/lib/sbuffer.cpp
+++ b/lib/sbuffer.cpp
@@ -78,13 +78,6 @@ static void default_allocator(SBufferConfig &config)
}
}
-SBuffer::SBuffer(void):
- offset(0),
- length(0)
-{
- //NOP
-}
-
SBuffer::SBuffer(const SBufferConfig &config):
offset(0),
length(0)
diff --git a/lib/top_block.cpp b/lib/top_block.cpp
index 3231055..bea7371 100644
--- a/lib/top_block.cpp
+++ b/lib/top_block.cpp
@@ -110,7 +110,7 @@ void TopBlock::wait(void)
{
//We do not need to join "special" threads;
//the token mechainism will do just fine.
- //(*this)->thread_group->join_all();
+ (*this)->thread_group->join_all();
//wait for all blocks to release the token
while (not (*this)->token.unique())