diff options
-rw-r--r-- | gr-blocks/grc/blocks_probe_rate.xml | 5 | ||||
-rw-r--r-- | gr-blocks/lib/probe_rate_impl.cc | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gr-blocks/grc/blocks_probe_rate.xml b/gr-blocks/grc/blocks_probe_rate.xml index 08df23e0d2..f79444c137 100644 --- a/gr-blocks/grc/blocks_probe_rate.xml +++ b/gr-blocks/grc/blocks_probe_rate.xml @@ -63,4 +63,9 @@ <type>$type</type> <vlen>$vlen</vlen> </sink> + <source> + <name>rate</name> + <type>message</type> + <optional>1</optional> + </source> </block> diff --git a/gr-blocks/lib/probe_rate_impl.cc b/gr-blocks/lib/probe_rate_impl.cc index 84977beae2..015b157d39 100644 --- a/gr-blocks/lib/probe_rate_impl.cc +++ b/gr-blocks/lib/probe_rate_impl.cc @@ -48,6 +48,7 @@ namespace gr { d_lastthru(0), d_itemsize(itemsize) { + message_port_register_out(pmt::mp("rate")); } probe_rate_impl::~probe_rate_impl(){} @@ -68,6 +69,10 @@ namespace gr { } else { d_avg = rate_this_update*d_alpha + d_avg*d_beta; } + pmt::pmt_t d = pmt::make_dict(); + d = pmt::dict_add(d, pmt::mp("rate_avg"), pmt::mp(d_avg)); + d = pmt::dict_add(d, pmt::mp("rate_now"), pmt::mp(rate_this_update)); + message_port_pub(pmt::mp("rate"), pmt::cons(d, pmt::PMT_NIL)); } return noutput_items; } |