summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/block.cc
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2013-10-29 14:19:20 -0400
committerTom Rondeau <tom@trondeau.com>2013-10-29 14:21:15 -0400
commite140069eaa05a0b71bbacb014d596dc218383940 (patch)
treeecaf88321e4a42a12843ff670c9ede600269a668 /gnuradio-runtime/lib/block.cc
parent9b9768baefeb995dc4516168287c6f865c92b60a (diff)
runtime: add concept up an automatic update_rate to gr::block.
When enabled, uses nitems_written/nitems_read to update the relative_rate of a block. Useful for blocks that change their relative rate based on activity in the work function. Disabled by default. digital: PFB clock sync blocks set update_rate to True.
Diffstat (limited to 'gnuradio-runtime/lib/block.cc')
-rw-r--r--gnuradio-runtime/lib/block.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc
index e1369f9d47..af963c9977 100644
--- a/gnuradio-runtime/lib/block.cc
+++ b/gnuradio-runtime/lib/block.cc
@@ -52,6 +52,7 @@ namespace gr {
d_tag_propagation_policy(TPP_ALL_TO_ALL),
d_priority(-1),
d_pc_rpc_set(false),
+ d_update_rate(false),
d_max_output_buffer(std::max(output_signature->max_streams(),1), -1),
d_min_output_buffer(std::max(output_signature->max_streams(),1), -1)
{
@@ -444,7 +445,20 @@ namespace gr {
else
d_min_output_buffer[port] = min_output_buffer;
}
-
+
+
+ bool
+ block::update_rate() const
+ {
+ return d_update_rate;
+ }
+
+ void
+ block::enable_update_rate(bool en)
+ {
+ d_update_rate = en;
+ }
+
float
block::pc_noutput_items()
{