diff options
author | Tom Rondeau <tom@trondeau.com> | 2016-06-14 10:42:00 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-06-14 10:57:04 -0700 |
commit | b64bd530ed55464f0b8eeec203c4c75df25f9810 (patch) | |
tree | 4cd96507a958356af66a2d1f843ef298d3848605 /gnuradio-runtime | |
parent | d7eaf6e1ed531c1e765905875669282ae79752ee (diff) |
runtime: executor fixes for tag propagation
Executor uses information about the number of items produced/consumed to
update the relative rate. This makes sure tags are being propagated by
all blocks correctly. Needed for pfb_clock_sync to use the
correlate_and_sync block's tags.
Diffstat (limited to 'gnuradio-runtime')
-rw-r--r-- | gnuradio-runtime/include/gnuradio/block_detail.h | 3 | ||||
-rw-r--r-- | gnuradio-runtime/lib/block_detail.cc | 8 | ||||
-rw-r--r-- | gnuradio-runtime/lib/block_executor.cc | 21 |
3 files changed, 22 insertions, 10 deletions
diff --git a/gnuradio-runtime/include/gnuradio/block_detail.h b/gnuradio-runtime/include/gnuradio/block_detail.h index a71030b43..8a9f4ab88 100644 --- a/gnuradio-runtime/include/gnuradio/block_detail.h +++ b/gnuradio-runtime/include/gnuradio/block_detail.h @@ -241,6 +241,8 @@ namespace gr { tpb_detail d_tpb; // used by thread-per-block scheduler int d_produce_or; + int consumed() const; + // ---------------------------------------------------------------------------- private: @@ -249,6 +251,7 @@ namespace gr { std::vector<buffer_reader_sptr> d_input; std::vector<buffer_sptr> d_output; bool d_done; + int d_consumed; // Performance counters float d_ins_noutput_items; diff --git a/gnuradio-runtime/lib/block_detail.cc b/gnuradio-runtime/lib/block_detail.cc index 484d84965..9e2e29fcd 100644 --- a/gnuradio-runtime/lib/block_detail.cc +++ b/gnuradio-runtime/lib/block_detail.cc @@ -110,14 +110,22 @@ namespace gr { void block_detail::consume(int which_input, int how_many_items) { + d_consumed = how_many_items; if(how_many_items > 0) { input(which_input)->update_read_pointer(how_many_items); } } + int + block_detail::consumed() const + { + return d_consumed; + } + void block_detail::consume_each(int how_many_items) { + d_consumed = how_many_items; if(how_many_items > 0) { for(int i = 0; i < ninputs (); i++) { d_input[i]->update_read_pointer(how_many_items); diff --git a/gnuradio-runtime/lib/block_executor.cc b/gnuradio-runtime/lib/block_executor.cc index ef2e4948b..585e65fc6 100644 --- a/gnuradio-runtime/lib/block_executor.cc +++ b/gnuradio-runtime/lib/block_executor.cc @@ -464,16 +464,6 @@ namespace gr { m->set_is_unaligned(m->unaligned() != 0); } - // For some blocks that can change their produce/consume ratio - // (the relative_rate), we might want to automatically update - // based on the amount of items written/read. - // In the block constructor, use enable_update_rate(true). - if(m->update_rate()) { - rrate = ((double)(m->nitems_written(0)+n)) / ((double)m->nitems_read(0)); - if(rrate > 0) - m->set_relative_rate(rrate); - } - // Now propagate the tags based on the new relative rate if(!propagate_tags(m->tag_propagation_policy(), d, d_start_nitems_read, m->relative_rate(), @@ -486,6 +476,17 @@ namespace gr { if(n != block::WORK_CALLED_PRODUCE) d->produce_each(n); // advance write pointers + // For some blocks that can change their produce/consume ratio + // (the relative_rate), we might want to automatically update + // based on the amount of items written/read. + // In the block constructor, use enable_update_rate(true). + if(m->update_rate()) { + //rrate = ((double)(m->nitems_written(0))) / ((double)m->nitems_read(0)); + rrate = (double)n / (double)d->consumed(); + if(rrate > 0) + m->set_relative_rate(rrate); + } + if(d->d_produce_or > 0) // block produced something return READY; |