sharkcz / rpms / gnuradio

Forked from rpms/gnuradio 3 years ago
Clone
025abfa
diff --git a/docs/doxygen/other/thread_affinity.dox b/docs/doxygen/other/thread_affinity.dox
025abfa
index edac813..03d2129 100644
025abfa
--- a/docs/doxygen/other/thread_affinity.dox
025abfa
+++ b/docs/doxygen/other/thread_affinity.dox
940b56c
@@ -50,7 +50,7 @@ Each block has two new data members:
940b56c
 A block can set and unset its affinity at any time using the
940b56c
 following member functions:
940b56c
 
940b56c
-- gr::block::set_processor_affinity(const std::vector<int> &mask)
940b56c
+- gr::block::set_processor_affinity(const std::vector<std::size_t> &mask)
940b56c
 - gr::block::unset_processor_affinity()
940b56c
 
940b56c
 Where \p mask is a vector of core numbers to set the thread's affinity
940b56c
@@ -76,7 +76,7 @@ to that affinity setting.
940b56c
 The gr::hier_block2 class supports the same API interface to the block
940b56c
 thread affinity:
940b56c
 
940b56c
-- gr::hier_block2::set_processor_affinity(const std::vector<int> &mask)
940b56c
+- gr::hier_block2::set_processor_affinity(const std::vector<std::size_t> &mask)
940b56c
 - gr::hier_block2::unset_processor_affinity()
940b56c
 - gr::hier_block2::processor_affinity()
940b56c
 
025abfa
diff --git a/gnuradio-runtime/include/gnuradio/basic_block.h b/gnuradio-runtime/include/gnuradio/basic_block.h
c83a741
index 25d9fb5..2a43a8a 100644
025abfa
--- a/gnuradio-runtime/include/gnuradio/basic_block.h
025abfa
+++ b/gnuradio-runtime/include/gnuradio/basic_block.h
025abfa
@@ -376,13 +376,13 @@ namespace gr {
940b56c
       d_msg_handlers[which_port] = msg_handler_t(msg_handler);
940b56c
     }
940b56c
 
940b56c
-    virtual void set_processor_affinity(const std::vector<int> &mask)
940b56c
+    virtual void set_processor_affinity(const std::vector<std::size_t> &mask)
940b56c
     { throw std::runtime_error("set_processor_affinity not overloaded in child class."); }
940b56c
 
940b56c
     virtual void unset_processor_affinity()
940b56c
     { throw std::runtime_error("unset_processor_affinity not overloaded in child class."); }
940b56c
 
940b56c
-    virtual std::vector<int> processor_affinity()
940b56c
+    virtual std::vector<std::size_t> processor_affinity()
940b56c
     { throw std::runtime_error("processor_affinity not overloaded in child class."); }
940b56c
   };
940b56c
 
025abfa
diff --git a/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h
d84e5c3
index c6185d9..8480ec7 100644
025abfa
--- a/gnuradio-runtime/include/gnuradio/block.h
025abfa
+++ b/gnuradio-runtime/include/gnuradio/block.h
d84e5c3
@@ -593,9 +593,9 @@ namespace gr {
940b56c
     /*!
940b56c
      * \brief Set the thread's affinity to processor core \p n.
940b56c
      *
940b56c
-     * \param mask a vector of ints of the core numbers available to this block.
940b56c
+     * \param mask a vector of std::size_t of the core numbers available to this block.
940b56c
      */
940b56c
-    void set_processor_affinity(const std::vector<int> &mask);
940b56c
+    void set_processor_affinity(const std::vector<std::size_t> &mask);
940b56c
 
940b56c
     /*!
940b56c
      * \brief Remove processor affinity to a specific core.
d84e5c3
@@ -605,7 +605,7 @@ namespace gr {
940b56c
     /*!
940b56c
      * \brief Get the current processor affinity.
940b56c
      */
940b56c
-    std::vector<int> processor_affinity() { return d_affinity; }
940b56c
+    std::vector<std::size_t> processor_affinity() { return d_affinity; }
940b56c
 
940b56c
     /*!
940b56c
      * \brief Get the current thread priority in use
d84e5c3
@@ -650,7 +650,7 @@ namespace gr {
940b56c
     int                   d_max_noutput_items;         // value of max_noutput_items for this block
940b56c
     int                   d_min_noutput_items;
940b56c
     tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream
940b56c
-    std::vector<int>      d_affinity;              // thread affinity proc. mask
940b56c
+    std::vector<std::size_t>      d_affinity;              // thread affinity proc. mask
940b56c
     int                   d_priority;              // thread priority level
940b56c
     bool                  d_pc_rpc_set;
940b56c
     bool                  d_update_rate;           // should sched update rel rate?
025abfa
diff --git a/gnuradio-runtime/include/gnuradio/block_detail.h b/gnuradio-runtime/include/gnuradio/block_detail.h
025abfa
index 916c0a4..1d52824 100644
025abfa
--- a/gnuradio-runtime/include/gnuradio/block_detail.h
025abfa
+++ b/gnuradio-runtime/include/gnuradio/block_detail.h
940b56c
@@ -174,10 +174,10 @@ namespace gr {
940b56c
      * \brief Set core affinity of block to the cores in the vector
940b56c
      * mask.
940b56c
      *
940b56c
-     * \param mask a vector of ints of the core numbers available to
940b56c
+     * \param mask a vector of std::size_t of the core numbers available to
940b56c
      * this block.
940b56c
      */
940b56c
-    void set_processor_affinity(const std::vector<int> &mask);
940b56c
+    void set_processor_affinity(const std::vector<std::size_t> &mask);
940b56c
 
940b56c
     /*!
940b56c
      * \brief Unset core affinity.
025abfa
diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h b/gnuradio-runtime/include/gnuradio/hier_block2.h
d84e5c3
index 08a5389..d4f9696 100644
025abfa
--- a/gnuradio-runtime/include/gnuradio/hier_block2.h
025abfa
+++ b/gnuradio-runtime/include/gnuradio/hier_block2.h
d84e5c3
@@ -248,7 +248,7 @@ namespace gr {
940b56c
      *
940b56c
      * \param mask a vector of ints of the core numbers available to this block.
940b56c
      */
940b56c
-    void set_processor_affinity(const std::vector<int> &mask);
940b56c
+    void set_processor_affinity(const std::vector<std::size_t> &mask);
940b56c
 
940b56c
     /*!
940b56c
      * \brief Remove processor affinity for all blocks in hier_block2.
d84e5c3
@@ -264,7 +264,7 @@ namespace gr {
940b56c
      * interface. If any block has been individually set, then this
940b56c
      * call could be misleading.
940b56c
      */
940b56c
-    std::vector<int> processor_affinity();
940b56c
+    std::vector<std::size_t> processor_affinity();
940b56c
 
d84e5c3
     /*!
d84e5c3
      * \brief Get if all block min buffers should be set.
025abfa
diff --git a/gnuradio-runtime/include/gnuradio/thread/thread.h b/gnuradio-runtime/include/gnuradio/thread/thread.h
025abfa
index a58d172..6c6c1bf 100644
025abfa
--- a/gnuradio-runtime/include/gnuradio/thread/thread.h
025abfa
+++ b/gnuradio-runtime/include/gnuradio/thread/thread.h
940b56c
@@ -77,7 +77,7 @@ namespace gr {
940b56c
      * do support in this way since 10.5 is not what we want or can
940b56c
      * use in this fashion).
940b56c
      */
940b56c
-    GR_RUNTIME_API void thread_bind_to_processor(const std::vector<int> &mask);
940b56c
+    GR_RUNTIME_API void thread_bind_to_processor(const std::vector<std::size_t> &mask);
940b56c
 
940b56c
     /*! \brief Convineince function to bind the current thread to a single core.
940b56c
      *
940b56c
@@ -89,7 +89,7 @@ namespace gr {
940b56c
      * do support in this way since 10.5 is not what we want or can
940b56c
      * use in this fashion).
940b56c
      */
940b56c
-    GR_RUNTIME_API void thread_bind_to_processor(int n);
940b56c
+    GR_RUNTIME_API void thread_bind_to_processor(std::size_t n);
940b56c
 
940b56c
     /*! \brief Bind a thread to a set of cores.
940b56c
      *
940b56c
@@ -104,7 +104,7 @@ namespace gr {
940b56c
      * use in this fashion).
940b56c
      */
940b56c
     GR_RUNTIME_API void thread_bind_to_processor(gr_thread_t thread,
940b56c
-                                                 const std::vector<int> &mask);
940b56c
+                                                 const std::vector<std::size_t> &mask);
940b56c
 
940b56c
 
940b56c
     /*! \brief Convineince function to bind the a thread to a single core.
025abfa
diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc
c83a741
index 2bae8ea..9641022 100644
025abfa
--- a/gnuradio-runtime/lib/block.cc
025abfa
+++ b/gnuradio-runtime/lib/block.cc
940b56c
@@ -325,7 +325,7 @@ namespace gr {
940b56c
   }
940b56c
 
940b56c
   void
940b56c
-  block::set_processor_affinity(const std::vector<int> &mask)
940b56c
+  block::set_processor_affinity(const std::vector<std::size_t> &mask)
940b56c
   {
940b56c
     d_affinity = mask;
940b56c
     if(d_detail) {
025abfa
diff --git a/gnuradio-runtime/lib/block_detail.cc b/gnuradio-runtime/lib/block_detail.cc
025abfa
index 9463e8d..96b54d0 100644
025abfa
--- a/gnuradio-runtime/lib/block_detail.cc
025abfa
+++ b/gnuradio-runtime/lib/block_detail.cc
025abfa
@@ -223,7 +223,7 @@ namespace gr {
940b56c
   }
940b56c
 
940b56c
   void
940b56c
-  block_detail::set_processor_affinity(const std::vector<int> &mask)
940b56c
+  block_detail::set_processor_affinity(const std::vector<std::size_t> &mask)
940b56c
   {
940b56c
     if(threaded) {
940b56c
       try {
025abfa
diff --git a/gnuradio-runtime/lib/hier_block2.cc b/gnuradio-runtime/lib/hier_block2.cc
20a9abd
index 597ae03..031ec30 100644
025abfa
--- a/gnuradio-runtime/lib/hier_block2.cc
025abfa
+++ b/gnuradio-runtime/lib/hier_block2.cc
20a9abd
@@ -161,7 +161,7 @@ namespace gr {
940b56c
   }
940b56c
 
940b56c
   void
940b56c
-  hier_block2::set_processor_affinity(const std::vector<int> &mask)
940b56c
+  hier_block2::set_processor_affinity(const std::vector<std::size_t> &mask)
940b56c
   {
940b56c
     d_detail->set_processor_affinity(mask);
940b56c
   }
20a9abd
@@ -172,7 +172,7 @@ namespace gr {
940b56c
     d_detail->unset_processor_affinity();
940b56c
   }
940b56c
 
940b56c
-  std::vector<int>
940b56c
+  std::vector<std::size_t>
940b56c
   hier_block2::processor_affinity()
940b56c
   {
940b56c
     return d_detail->processor_affinity();
025abfa
diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc b/gnuradio-runtime/lib/hier_block2_detail.cc
20a9abd
index 0d0ddf5..175e787 100644
025abfa
--- a/gnuradio-runtime/lib/hier_block2_detail.cc
025abfa
+++ b/gnuradio-runtime/lib/hier_block2_detail.cc
20a9abd
@@ -932,7 +932,7 @@ namespace gr {
940b56c
   }
940b56c
 
940b56c
   void
940b56c
-  hier_block2_detail::set_processor_affinity(const std::vector<int> &mask)
940b56c
+  hier_block2_detail::set_processor_affinity(const std::vector<std::size_t> &mask)
940b56c
   {
940b56c
     basic_block_vector_t tmp = d_fg->calc_used_blocks();
940b56c
     for(basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++) {
20a9abd
@@ -949,7 +949,7 @@ namespace gr {
940b56c
     }
940b56c
   }
940b56c
 
940b56c
-  std::vector<int>
940b56c
+  std::vector<std::size_t>
940b56c
   hier_block2_detail::processor_affinity()
940b56c
   {
940b56c
     basic_block_vector_t tmp = d_fg->calc_used_blocks();
025abfa
diff --git a/gnuradio-runtime/lib/hier_block2_detail.h b/gnuradio-runtime/lib/hier_block2_detail.h
20a9abd
index a5584fe..0cdb149 100644
025abfa
--- a/gnuradio-runtime/lib/hier_block2_detail.h
025abfa
+++ b/gnuradio-runtime/lib/hier_block2_detail.h
940b56c
@@ -54,9 +54,9 @@ namespace gr {
940b56c
     void unlock();
940b56c
     void flatten_aux(flat_flowgraph_sptr sfg) const;
940b56c
 
940b56c
-    void set_processor_affinity(const std::vector<int> &mask);
940b56c
+    void set_processor_affinity(const std::vector<std::size_t> &mask);
940b56c
     void unset_processor_affinity();
940b56c
-    std::vector<int> processor_affinity();
940b56c
+    std::vector<std::size_t> processor_affinity();
d84e5c3
     
d84e5c3
     // Track output buffer min/max settings
d84e5c3
     std::vector<size_t> d_max_output_buffer;
025abfa
diff --git a/gnuradio-runtime/lib/thread/thread.cc b/gnuradio-runtime/lib/thread/thread.cc
025abfa
index 483dfed..e05a8ba 100644
025abfa
--- a/gnuradio-runtime/lib/thread/thread.cc
025abfa
+++ b/gnuradio-runtime/lib/thread/thread.cc
940b56c
@@ -40,33 +40,33 @@ namespace gr {
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(int n)
940b56c
+    thread_bind_to_processor(std::size_t n)
940b56c
     {
940b56c
-      std::vector<int> mask(1, n);
940b56c
+      std::vector<std::size_t> mask(1, n);
940b56c
       thread_bind_to_processor(get_current_thread_id(), mask);
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(const std::vector<int> &mask)
940b56c
+    thread_bind_to_processor(const std::vector<std::size_t> &mask)
940b56c
     {
940b56c
       thread_bind_to_processor(get_current_thread_id(), mask);
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(gr_thread_t thread, int n)
940b56c
+    thread_bind_to_processor(gr_thread_t thread, std::size_t n)
940b56c
     {
940b56c
-      std::vector<int> mask(1, n);
940b56c
+      std::vector<std::size_t> mask(1, n);
940b56c
       thread_bind_to_processor(thread, mask);
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask)
940b56c
+    thread_bind_to_processor(gr_thread_t thread, const std::vector<std::size_t> &mask)
940b56c
     {
940b56c
       //DWORD_PTR mask = (1 << n);
940b56c
       DWORD_PTR dword_mask = 0;
940b56c
 
940b56c
-      std::vector<int> _mask = mask;
940b56c
-      std::vector<int>::iterator itr;
940b56c
+      std::vector<std::size_t> _mask = mask;
940b56c
+      std::vector<std::size_t>::iterator itr;
940b56c
       for(itr = _mask.begin(); itr != _mask.end(); itr++)
940b56c
         dword_mask |= (1 << (*itr));
940b56c
 
940b56c
@@ -171,25 +171,25 @@ namespace gr {
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(int n)
940b56c
+    thread_bind_to_processor(std::size_t n)
940b56c
     {
940b56c
       // Not implemented on OSX
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(gr_thread_t thread, int n)
940b56c
+    thread_bind_to_processor(gr_thread_t thread, std::size_t n)
940b56c
     {
940b56c
       // Not implemented on OSX
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(const std::vector<int> &mask)
940b56c
+    thread_bind_to_processor(const std::vector<std::size_t> &mask)
940b56c
     {
940b56c
       // Not implemented on OSX
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask)
940b56c
+    thread_bind_to_processor(gr_thread_t thread, const std::vector<std::size_t> &mask)
940b56c
     {
940b56c
       // Not implemented on OSX
940b56c
     }
940b56c
@@ -254,32 +254,32 @@ namespace gr {
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(int n)
940b56c
+    thread_bind_to_processor(std::size_t n)
940b56c
     {
940b56c
-      std::vector<int> mask(1, n);
940b56c
+      std::vector<std::size_t> mask(1, n);
940b56c
       thread_bind_to_processor(get_current_thread_id(), mask);
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(const std::vector<int> &mask)
940b56c
+    thread_bind_to_processor(const std::vector<std::size_t> &mask)
940b56c
     {
940b56c
       thread_bind_to_processor(get_current_thread_id(), mask);
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(gr_thread_t thread, int n)
940b56c
+    thread_bind_to_processor(gr_thread_t thread, std::size_t n)
940b56c
     {
940b56c
-      std::vector<int> mask(1, n);
940b56c
+      std::vector<std::size_t> mask(1, n);
940b56c
       thread_bind_to_processor(thread, mask);
940b56c
     }
940b56c
 
940b56c
     void
940b56c
-    thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask)
940b56c
+    thread_bind_to_processor(gr_thread_t thread, const std::vector<std::size_t> &mask)
940b56c
     {
940b56c
       cpu_set_t set;
940b56c
       size_t len = sizeof(cpu_set_t);
940b56c
-      std::vector<int> _mask = mask;
940b56c
-      std::vector<int>::iterator itr;
940b56c
+      std::vector<std::size_t> _mask = mask;
940b56c
+      std::vector<std::size_t>::iterator itr;
940b56c
 
940b56c
       CPU_ZERO(&set);
940b56c
       for(itr = _mask.begin(); itr != _mask.end(); itr++)
025abfa
diff --git a/gnuradio-runtime/swig/block.i b/gnuradio-runtime/swig/block.i
025abfa
index 945cea7..7d2b29e 100644
025abfa
--- a/gnuradio-runtime/swig/block.i
025abfa
+++ b/gnuradio-runtime/swig/block.i
025abfa
@@ -99,9 +99,9 @@ class gr::block : public gr::basic_block
025abfa
   float pc_throughput_avg();
940b56c
 
940b56c
   // Methods to manage processor affinity.
940b56c
-  void set_processor_affinity(const std::vector<int> &mask);
940b56c
+  void set_processor_affinity(const std::vector<std::size_t> &mask);
940b56c
   void unset_processor_affinity();
940b56c
-  std::vector<int> processor_affinity();
940b56c
+  std::vector<std::size_t> processor_affinity();
940b56c
 
940b56c
   // Methods to manage thread priority
940b56c
   int active_thread_priority();
025abfa
diff --git a/gnuradio-runtime/swig/hier_block2.i b/gnuradio-runtime/swig/hier_block2.i
d84e5c3
index 12190d0..de79e3f 100644
025abfa
--- a/gnuradio-runtime/swig/hier_block2.i
025abfa
+++ b/gnuradio-runtime/swig/hier_block2.i
940b56c
@@ -87,9 +87,9 @@ namespace gr {
940b56c
     void message_port_register_hier_in(pmt::pmt_t port_id);
940b56c
     void message_port_register_hier_out(pmt::pmt_t port_id);
940b56c
 
940b56c
-    void set_processor_affinity(const std::vector<int> &mask);
940b56c
+    void set_processor_affinity(const std::vector<std::size_t> &mask);
940b56c
     void unset_processor_affinity();
940b56c
-    std::vector<int> processor_affinity();
940b56c
+    std::vector<std::size_t> processor_affinity();
940b56c
 
d84e5c3
     // Methods to manage block's min/max buffer sizes.
d84e5c3
     size_t max_output_buffer(int i);
025abfa
diff --git a/gr-blocks/lib/qa_gr_top_block.cc b/gr-blocks/lib/qa_gr_top_block.cc
025abfa
index 39709d2..8792637 100644
025abfa
--- a/gr-blocks/lib/qa_gr_top_block.cc
025abfa
+++ b/gr-blocks/lib/qa_gr_top_block.cc
940b56c
@@ -278,7 +278,7 @@ void qa_top_block::t11_set_block_affinity()
940b56c
   gr::block_sptr src (gr::blocks::null_source::make(sizeof(float)));
940b56c
   gr::block_sptr snk (gr::blocks::null_sink::make(sizeof(float)));
940b56c
 
940b56c
-  std::vector<int> set(1, 0), ret;
940b56c
+  std::vector<std::size_t> set(1, 0), ret;
940b56c
   src->set_processor_affinity(set);
940b56c
 
940b56c
   tb->connect(src, 0, snk, 0);