23#ifndef INCLUDED_GR_RUNTIME_BLOCK_H
24#define INCLUDED_GR_RUNTIME_BLOCK_H
250 void consume(
int which_input,
int how_many_items);
271 void produce(
int which_output,
int how_many_items);
669 int d_output_multiple;
670 bool d_output_multiple_set;
673 double d_relative_rate;
674 block_detail_sptr d_detail;
676 unsigned d_attr_delay;
678 bool d_max_noutput_items_set;
679 int d_max_noutput_items;
680 int d_min_noutput_items;
682 d_tag_propagation_policy;
683 std::vector<int> d_affinity;
718 this->add_item_tag(which_output, tag);
752 this->remove_item_tag(which_input, tag);
777 unsigned int which_input,
797 unsigned int which_input,
824 unsigned int which_input,
841 unsigned int which_input,
875 block_detail_sptr
detail()
const {
return d_detail; }
876 void set_detail(block_detail_sptr detail) { d_detail = detail; }
890inline block_sptr cast_to_block_sptr(basic_block_sptr p)
892 return boost::dynamic_pointer_cast<block, basic_block>(p);
The abstract base class for all signal processing blocks.
Definition: basic_block.h:60
The abstract base class for all 'terminal' processing blocks.
Definition: block.h:66
float pc_input_buffers_full_var(int which)
Gets variance of fullness of which input buffer.
void set_processor_affinity(const std::vector< int > &mask)
Set the thread's affinity to processor core n.
int unaligned() const
Definition: block.h:237
virtual bool stop()
Called to disable drivers, etc for i/o devices.
float pc_input_buffers_full_avg(int which)
Gets average fullness of which input buffer.
int active_thread_priority()
Get the current thread priority in use.
virtual int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
compute output items from input items
void set_is_unaligned(bool u)
float pc_output_buffers_full_avg(int which)
Gets average fullness of which input buffer.
void consume_each(int how_many_items)
Tell the scheduler how_many_items were consumed on each input stream.
float pc_nproduced_var()
Gets variance of num items produced performance counter.
uint64_t nitems_read(unsigned int which_input)
Return the number of items read on input stream which_input.
const pmt::pmt_t d_system_port
Definition: block.h:872
double relative_rate() const
return the approximate output rate / input rate
Definition: block.h:287
float pc_output_buffers_full_var(int which)
Gets variance of fullness of which input buffer.
float pc_work_time_total()
Gets total clock cycles spent in work.
float pc_work_time_avg()
Gets average clock cycles spent in work.
std::vector< int > processor_affinity()
Get the current processor affinity.
Definition: block.h:637
float pc_noutput_items_avg()
Gets average noutput_items performance counter.
void system_handler(pmt::pmt_t msg)
the system message handler
gr::logger_ptr d_debug_logger
Definition: block.h:861
std::vector< float > pc_output_buffers_full_var()
Gets variance of fullness of all output buffers.
void get_tags_in_window(std::vector< tag_t > &v, unsigned int which_input, uint64_t rel_start, uint64_t rel_end, const pmt::pmt_t &key)
Operates like gr::block::get_tags_in_window with the ability to only return tags with the specified k...
void unset_max_noutput_items()
Clear the switch for using the max_noutput_items value of this block.
void remove_item_tag(unsigned int which_input, uint64_t abs_offset, const pmt::pmt_t &key, const pmt::pmt_t &value, const pmt::pmt_t &srcid=pmt::PMT_F)
DEPRECATED. Will be removed in 3.8.
Definition: block.h:741
void set_min_output_buffer(int port, long min_output_buffer)
Request limit on min buffer size on output port port.
void consume(int which_input, int how_many_items)
Tell the scheduler how_many_items of input stream which_input were consumed.
void set_tag_propagation_policy(tag_propagation_policy_t p)
Set the policy by the scheduler to determine how tags are moved downstream.
tag_propagation_policy_t tag_propagation_policy()
Asks for the policy used by the scheduler to moved tags downstream.
float pc_work_time_var()
Gets average clock cycles spent in work.
float pc_input_buffers_full(int which)
Gets instantaneous fullness of which input buffer.
void set_alignment(int multiple)
Constrains buffers to work on a set item alignment (for SIMD)
std::vector< long > d_min_output_buffer
Definition: block.h:849
std::vector< float > pc_input_buffers_full_avg()
Gets average fullness of all input buffers.
void set_unaligned(int na)
bool is_set_max_noutput_items()
Ask the block if the flag is or is not set to use the internal value of max_noutput_items during a ca...
int thread_priority()
Get the current thread priority stored.
virtual void forecast(int noutput_items, gr_vector_int &ninput_items_required)
Estimate input requirements given output request.
long max_output_buffer(size_t i)
Returns max buffer size on output port i.
unsigned sample_delay(int which) const
block(void)
Definition: block.h:690
void set_output_multiple(int multiple)
Constrain the noutput_items argument passed to forecast and general_work.
void set_min_noutput_items(int m)
Set the minimum number of output items this block can produce during a call to work.
Definition: block.h:345
gr::logger_ptr d_logger
Definition: block.h:860
void set_max_output_buffer(long max_output_buffer)
Request limit on max buffer size on all output ports.
void enable_update_rate(bool en)
uint64_t nitems_written(unsigned int which_output)
Return the number of items written on output stream which_output.
void no_pc_rpc()
If the block calls this in its constructor, it's perf. counters will not be exported.
Definition: block.h:616
void set_detail(block_detail_sptr detail)
Definition: block.h:876
float pc_throughput_avg()
Gets average throughput.
virtual bool start()
Called to enable drivers, etc for i/o devices.
void get_tags_in_range(std::vector< tag_t > &v, unsigned int which_input, uint64_t abs_start, uint64_t abs_end, const pmt::pmt_t &key)
Given a [start,end), returns a vector of all tags in the range with a given key.
int set_thread_priority(int priority)
Set the current thread priority.
float pc_nproduced()
Gets instantaneous num items produced performance counter.
bool finished()
returns true when execution has completed due to a message connection
void add_item_tag(unsigned int which_output, uint64_t abs_offset, const pmt::pmt_t &key, const pmt::pmt_t &value, const pmt::pmt_t &srcid=pmt::PMT_F)
Adds a new tag onto the given output buffer.
Definition: block.h:707
void add_item_tag(unsigned int which_output, const tag_t &tag)
Adds a new tag onto the given output buffer.
void setup_pc_rpc()
Sets up export of perf. counters to ControlPort. Only called by the scheduler.
void remove_item_tag(unsigned int which_input, const tag_t &tag)
DEPRECATED. Will be removed in 3.8.
virtual int fixed_rate_ninput_to_noutput(int ninput)
Given ninput samples, return number of output samples that will be produced. N.B. this is only define...
void set_max_output_buffer(int port, long max_output_buffer)
Request limit on max buffer size on output port port.
std::vector< float > pc_input_buffers_full()
Gets instantaneous fullness of all input buffers.
int alignment() const
Definition: block.h:234
int output_multiple() const
Definition: block.h:213
void expand_minmax_buffer(int port)
void set_min_output_buffer(long min_output_buffer)
Request limit on the minimum buffer size on all output ports.
void get_tags_in_range(std::vector< tag_t > &v, unsigned int which_input, uint64_t abs_start, uint64_t abs_end)
Given a [start,end), returns a vector of all tags in the range.
void produce(int which_output, int how_many_items)
Tell the scheduler how_many_items were produced on output stream which_output.
bool is_unaligned() const
Definition: block.h:239
void declare_sample_delay(unsigned delay)
void set_fixed_rate(bool fixed_rate)
Definition: block.h:695
bool is_pc_rpc_set()
Checks if this block is already exporting perf. counters to ControlPort.
Definition: block.h:610
gr::thread::mutex d_setlock
Definition: block.h:856
float pc_output_buffers_full(int which)
Gets instantaneous fullness of which input buffer.
std::vector< long > d_max_output_buffer
Definition: block.h:848
bool fixed_rate() const
Return true if this block has a fixed input to output rate.
Definition: block.h:141
int min_noutput_items() const
Return the minimum number of output items this block can produce during a call to work.
Definition: block.h:337
std::vector< float > pc_output_buffers_full()
Gets instantaneous fullness of all output buffers.
tag_propagation_policy_t
enum to represent different tag propagation policies.
Definition: block.h:74
virtual int fixed_rate_noutput_to_ninput(int noutput)
Given noutput samples, return number of input samples required to produce noutput....
void get_tags_in_window(std::vector< tag_t > &v, unsigned int which_input, uint64_t rel_start, uint64_t rel_end)
Gets all tags within the relative window of the current call to work.
void unset_processor_affinity()
Remove processor affinity to a specific core.
long min_output_buffer(size_t i)
Returns min buffer size on output port i.
void set_history(unsigned history)
void declare_sample_delay(int which, unsigned delay)
block_detail_sptr detail() const
Definition: block.h:875
float pc_nproduced_avg()
Gets average num items produced performance counter.
bool output_multiple_set() const
Definition: block.h:214
const pmt::pmt_t d_pmt_done
Definition: block.h:868
std::vector< float > pc_output_buffers_full_avg()
Gets average fullness of all output buffers.
void reset_perf_counters()
Resets the performance counters.
void notify_msg_neighbors()
Tell msg neighbors we are finished.
float pc_noutput_items_var()
Gets variance of noutput_items performance counter.
void set_max_noutput_items(int m)
Set the maximum number of output items this block will handle during a call to work.
float pc_work_time()
Gets instantaneous clock cycles spent in work.
block(const std::string &name, gr::io_signature::sptr input_signature, gr::io_signature::sptr output_signature)
std::vector< float > pc_input_buffers_full_var()
Gets variance of fullness of all input buffers.
void clear_finished()
Make sure we don't think we are finished.
Definition: block.h:884
float pc_noutput_items()
Gets instantaneous noutput_items performance counter.
int max_noutput_items()
Return the maximum number of output items this block will handle during a call to work.
void set_relative_rate(double relative_rate)
Set the approximate output rate / input rate.
boost::shared_ptr< io_signature > sptr
Definition: io_signature.h:46
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:30
std::vector< const void * > gr_vector_const_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:40
std::vector< void * > gr_vector_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:39
std::vector< int > gr_vector_int
Definition: gnuradio-runtime/include/gnuradio/types.h:35
static purpose_t msg
Definition: source_logger.h:39
boost::mutex mutex
Definition: thread.h:48
Include this header to use the message passing features.
Definition: basic_block.h:45
@ TPP_DONT
Definition: block_gateway.h:47
@ TPP_ONE_TO_ONE
Definition: block_gateway.h:49
@ TPP_CUSTOM
Definition: block_gateway.h:50
@ TPP_ALL_TO_ALL
Definition: block_gateway.h:48
void * logger_ptr
Definition: logger.h:696
std::vector< block_sptr >::iterator block_viter_t
Definition: block.h:888
std::ostream & operator<<(std::ostream &os, basic_block_sptr basic_block)
Definition: basic_block.h:427
std::vector< block_sptr > block_vector_t
Definition: block.h:887
@ WORK_CALLED_PRODUCE
Definition: block_gateway.h:45
@ WORK_DONE
Definition: block_gateway.h:45
boost::intrusive_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost....
Definition: pmt.h:56
#define PMT_F
Definition: pmt.h:105
uint64_t offset
the item tag occurred at (as a uint64_t)
Definition: tags.h:33
pmt::pmt_t srcid
the source ID of tag (as a PMT)
Definition: tags.h:42
pmt::pmt_t value
the value of tag (as a PMT)
Definition: tags.h:39
pmt::pmt_t key
the key of tag (as a PMT symbol)
Definition: tags.h:36
Definition: cc_common.h:45