summaryrefslogtreecommitdiff
path: root/include/gnuradio
diff options
context:
space:
mode:
authorJosh Blum2012-09-13 23:45:21 -0700
committerJosh Blum2012-09-13 23:45:21 -0700
commitf48974cbfc5304003ad5296d8df610579768d362 (patch)
tree40eb308e253e3ec2b1376fabec9ca12f084f2620 /include/gnuradio
parentac9daab85d3651f9a63eafc48beb901c0941da7f (diff)
downloadsandhi-f48974cbfc5304003ad5296d8df610579768d362.tar.gz
sandhi-f48974cbfc5304003ad5296d8df610579768d362.tar.bz2
sandhi-f48974cbfc5304003ad5296d8df610579768d362.zip
added set buffer affinity hook for blocks
Diffstat (limited to 'include/gnuradio')
-rw-r--r--include/gnuradio/block.hpp16
-rw-r--r--include/gnuradio/gras.hpp15
-rw-r--r--include/gnuradio/sbuffer.hpp16
3 files changed, 32 insertions, 15 deletions
diff --git a/include/gnuradio/block.hpp b/include/gnuradio/block.hpp
index 459e25b..abfb07e 100644
--- a/include/gnuradio/block.hpp
+++ b/include/gnuradio/block.hpp
@@ -18,6 +18,7 @@
#define INCLUDED_GNURADIO_BLOCK_HPP
#include <gnuradio/element.hpp>
+#include <gnuradio/sbuffer.hpp>
#include <gnuradio/tags.hpp>
#include <gruel/pmt.h>
#include <vector>
@@ -199,6 +200,21 @@ struct GRAS_API Block : Element
//! scheduler calls when the topology is updated, can be overloaded
virtual bool check_topology(int ninputs, int noutputs);
+ /*******************************************************************
+ * routines related to affinity and allocation
+ ******************************************************************/
+
+ /*!
+ * Set the node affinity of this block.
+ * This call affects how output buffers are allocated.
+ * By default memory is allocated by malloc.
+ * When the affinity is set, virtual memory
+ * will be locked to a physical CPU/memory node.
+ */
+ void set_buffer_affinity(const Affinity &affinity);
+
+ //TODO overload for allocate output buffer(index)
+
};
} //namespace gnuradio
diff --git a/include/gnuradio/gras.hpp b/include/gnuradio/gras.hpp
index 23aab4c..1e0087a 100644
--- a/include/gnuradio/gras.hpp
+++ b/include/gnuradio/gras.hpp
@@ -38,21 +38,6 @@ struct SBufferImpl;
void intrusive_ptr_add_ref(SBufferImpl*);
void intrusive_ptr_release(SBufferImpl*);
-struct Affinity
-{
- Affinity(void)
- {
- value = -1;
- }
-
- operator long long(void) const
- {
- return value;
- }
-
- long long value;
-};
-
} //namespace gnuradio
#endif /*INCLUDED_GNURADIO_GRAS_HPP*/
diff --git a/include/gnuradio/sbuffer.hpp b/include/gnuradio/sbuffer.hpp
index c0e13c8..71a588a 100644
--- a/include/gnuradio/sbuffer.hpp
+++ b/include/gnuradio/sbuffer.hpp
@@ -23,6 +23,22 @@
namespace gnuradio
{
+//! A small wrapper to represent a node affinity
+struct Affinity
+{
+ Affinity(void)
+ {
+ value = -1;
+ }
+
+ operator long long(void) const
+ {
+ return value;
+ }
+
+ long long value;
+};
+
//! The callback function type when buffers dereference
typedef boost::function<void(SBuffer &)> SBufferDeleter;