[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/01: Warn when the throttlers sleep time
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/01: Warn when the throttlers sleep time variable overflows |
Date: |
Wed, 4 Mar 2015 18:13:08 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch maint
in repository gnuradio.
commit 41f1ba4171b74354ab25cf066451d8ba940d9ec4
Author: Harm te Hennepe <address@hidden>
Date: Wed Mar 4 17:38:36 2015 +0100
Warn when the throttlers sleep time variable overflows
---
gr-blocks/lib/throttle_impl.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gr-blocks/lib/throttle_impl.cc b/gr-blocks/lib/throttle_impl.cc
index 7c24f80..d818ce1 100644
--- a/gr-blocks/lib/throttle_impl.cc
+++ b/gr-blocks/lib/throttle_impl.cc
@@ -28,6 +28,7 @@
#include <gnuradio/io_signature.h>
#include <cstring>
#include <boost/thread/thread.hpp>
+#include <limits>
pmt::pmt_t throttle_rx_rate_pmt(pmt::intern("rx_rate"));
@@ -107,8 +108,13 @@ namespace gr {
//if the expected samples was less, we need to throttle back
if(d_total_samples > expected_samps) {
+ double sleep_time = (d_total_samples - expected_samps)/d_samps_per_us;
+ if (std::numeric_limits<long>::max() < sleep_time) {
+ GR_LOG_ALERT(d_logger, "WARNING: Throttle sleep time overflow! You
"
+ "are probably using a very low sample rate.");
+ }
boost::this_thread::sleep(boost::posix_time::microseconds
- (long((d_total_samples -
expected_samps)/d_samps_per_us)));
+ (long(sleep_time)));
}
//copy all samples output[i] <= input[i]