summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-09-30 21:27:14 -0400
committerTom Rondeau <tom@trondeau.com>2014-09-30 21:27:14 -0400
commit4ecfc89678f69692ca9197f047b9ab245136c8f4 (patch)
tree2d7740e7c8404bc2669c881e29b1915ce86d6614
parentcecf6f7523488cf6c77b0f0ddfccefdcf0a0d0f7 (diff)
blocks: throttle resets the timer state when the topblock starts each block, including during a lock/unlock restart.
Addresses issue #649.
-rw-r--r--gr-blocks/lib/throttle_impl.cc8
-rw-r--r--gr-blocks/lib/throttle_impl.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/gr-blocks/lib/throttle_impl.cc b/gr-blocks/lib/throttle_impl.cc
index f46decee11..7c24f80ae1 100644
--- a/gr-blocks/lib/throttle_impl.cc
+++ b/gr-blocks/lib/throttle_impl.cc
@@ -57,6 +57,14 @@ namespace gr {
{
}
+ bool
+ throttle_impl::start()
+ {
+ d_start = boost::get_system_time();
+ d_total_samples = 0;
+ return block::start();
+ }
+
void
throttle_impl::set_sample_rate(double rate)
{
diff --git a/gr-blocks/lib/throttle_impl.h b/gr-blocks/lib/throttle_impl.h
index c5e43d7564..6afacbba5d 100644
--- a/gr-blocks/lib/throttle_impl.h
+++ b/gr-blocks/lib/throttle_impl.h
@@ -41,6 +41,9 @@ namespace gr {
throttle_impl(size_t itemsize, double samples_per_sec, bool ignore_tags=true);
~throttle_impl();
+ // Overloading gr::block::start to reset timer
+ bool start();
+
void setup_rpc();
void set_sample_rate(double rate);