From e140069eaa05a0b71bbacb014d596dc218383940 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <tom@trondeau.com>
Date: Tue, 29 Oct 2013 14:19:20 -0400
Subject: 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.
---
 gnuradio-runtime/lib/block.cc | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'gnuradio-runtime/lib/block.cc')

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()
   {
-- 
cgit v1.2.3