diff options
5 files changed, 51 insertions, 2 deletions
diff --git a/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h index 8b486cc398..dace24ad88 100644 --- a/gnuradio-runtime/include/gnuradio/block.h +++ b/gnuradio-runtime/include/gnuradio/block.h @@ -518,6 +518,30 @@ public: void set_min_output_buffer(int port, long min_output_buffer); /*! + * \brief DEPRECATED Configure the timer set when input is blocked \p port. + * + * \details + * This is an advanced/experimental feature and might be removed in a future + * version. Calling this can affect some fundamental assumptions about the + * system behavior and + * performance. + * + * In the TPB scheduler, when a block has no work to do because there + * is no data at it inputs, it sets a timer and tries again after a + * period of time. The default is 250 ms, but this can be configured + * differently per block when necessary + * + * \param timer_value_ms the timer value in milliseconds + */ + void set_blkd_input_timer_value(unsigned int timer_value_ms); + + /*! + * \brief DEPRECATED Returns timer value set when input is blocked + */ + unsigned int blkd_input_timer_value(); + + + /*! * \brief Allocate the block_detail and necessary output buffers for this * block. */ @@ -950,6 +974,8 @@ protected: std::vector<long> d_max_output_buffer; std::vector<long> d_min_output_buffer; + unsigned int d_blkd_input_timer_value = 250; + /*! Used by block's setters and work functions to make * setting/resetting of parameters thread-safe. * diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc index 8965a9eaea..25a77982c5 100644 --- a/gnuradio-runtime/lib/block.cc +++ b/gnuradio-runtime/lib/block.cc @@ -381,6 +381,13 @@ void block::set_min_output_buffer(int port, long min_output_buffer) d_min_output_buffer[port] = min_output_buffer; } +void block::set_blkd_input_timer_value(unsigned int value) +{ + d_blkd_input_timer_value = value; +} + +unsigned int block::blkd_input_timer_value() { return d_blkd_input_timer_value; } + void block::allocate_detail(int ninputs, int noutputs, const std::vector<int>& downstream_max_nitems_vec, diff --git a/gnuradio-runtime/lib/tpb_thread_body.cc b/gnuradio-runtime/lib/tpb_thread_body.cc index abf722dec2..c95547748a 100644 --- a/gnuradio-runtime/lib/tpb_thread_body.cc +++ b/gnuradio-runtime/lib/tpb_thread_body.cc @@ -132,7 +132,8 @@ tpb_thread_body::tpb_thread_body(block_sptr block, if (!d->d_tpb.input_changed) { boost::system_time const timeout = - boost::get_system_time() + boost::posix_time::milliseconds(250); + boost::get_system_time() + + boost::posix_time::milliseconds(block->blkd_input_timer_value()); d->d_tpb.input_cond.timed_wait(guard, timeout); } } break; diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/block_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/block_python.cc index 6f70235496..952cee1ac7 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/block_python.cc +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/block_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(block.h) */ -/* BINDTOOL_HEADER_FILE_HASH(ee5f3ad6384686a28dce290f2da34ceb) */ +/* BINDTOOL_HEADER_FILE_HASH(c8416d414680c7aa6fab4fdd471daa3e) */ /***********************************************************************************/ #include <pybind11/complex.h> @@ -280,6 +280,15 @@ void bind_block(py::module& m) D(block, set_min_output_buffer, 1)) + .def("set_blkd_input_timer_value", + &block::set_blkd_input_timer_value, + py::arg("value"), + D(block, set_blkd_input_timer_value)) + + .def("blkd_input_timer_value", + &block::set_blkd_input_timer_value, + D(block, blkd_input_timer_value)) + .def("pc_noutput_items", &block::pc_noutput_items, D(block, pc_noutput_items)) diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/block_pydoc_template.h b/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/block_pydoc_template.h index d60a699fec..6d10af60ce 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/block_pydoc_template.h +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/block_pydoc_template.h @@ -162,6 +162,12 @@ static const char* __doc_gr_block_set_min_output_buffer_0 = R"doc()doc"; static const char* __doc_gr_block_set_min_output_buffer_1 = R"doc()doc"; +static const char* __doc_gr_block_set_blkd_input_timer_value = R"doc()doc"; + + +static const char* __doc_gr_block_blkd_input_timer_value = R"doc()doc"; + + static const char* __doc_gr_block_pc_noutput_items = R"doc()doc"; |