GNU Radio 3.7.1 C++ API
|
The abstract base class for all 'terminal' processing blocks.A signal processing flow is constructed by creating a tree of hierarchical blocks, which at any level may also contain terminal nodes that actually implement signal processing functions. This is the base class for all such leaf nodes. More...
#include <block.h>
Inherits gr::basic_block.
Inherited by atsc_bit_timing_loop, atsc_field_sync_demux, atsc_field_sync_mux, gr::analog::ctcss_squelch_ff [virtual]
, gr::analog::pwr_squelch_cc [virtual]
, gr::analog::pwr_squelch_ff [virtual]
, gr::analog::squelch_base_cc [virtual]
, gr::analog::squelch_base_ff [virtual]
, gr::block_gateway [virtual]
, gr::blocks::copy [virtual]
, gr::blocks::delay [virtual]
, gr::blocks::keep_m_in_n [virtual]
, gr::blocks::keep_one_in_n [virtual]
, gr::blocks::message_debug [virtual]
, gr::blocks::message_strobe [virtual]
, gr::blocks::nop [virtual]
, gr::blocks::packed_to_unpacked_bb [virtual]
, gr::blocks::packed_to_unpacked_ii [virtual]
, gr::blocks::packed_to_unpacked_ss [virtual]
, gr::blocks::patterned_interleaver [virtual]
, gr::blocks::plateau_detector_fb [virtual]
, gr::blocks::random_pdu [virtual]
, gr::blocks::skiphead [virtual]
, gr::blocks::socket_pdu [virtual]
, gr::blocks::stream_mux [virtual]
, gr::blocks::tuntap_pdu [virtual]
, gr::blocks::unpacked_to_packed_bb [virtual]
, gr::blocks::unpacked_to_packed_ii [virtual]
, gr::blocks::unpacked_to_packed_ss [virtual]
, gr::blocks::vector_insert_b [virtual]
, gr::blocks::vector_insert_c [virtual]
, gr::blocks::vector_insert_f [virtual]
, gr::blocks::vector_insert_i [virtual]
, gr::blocks::vector_insert_s [virtual]
, gr::digital::clock_recovery_mm_cc [virtual]
, gr::digital::clock_recovery_mm_ff [virtual]
, gr::digital::constellation_decoder_cb [virtual]
, gr::digital::constellation_receiver_cb [virtual]
, gr::digital::header_payload_demux [virtual]
, gr::digital::mpsk_receiver_cc [virtual]
, gr::digital::ofdm_chanest_vcvc [virtual]
, gr::digital::ofdm_frame_acquisition [virtual]
, gr::digital::ofdm_insert_preamble [virtual]
, gr::digital::ofdm_sampler [virtual]
, gr::digital::pfb_clock_sync_ccf [virtual]
, gr::digital::pfb_clock_sync_fff [virtual]
, gr::digital::simple_correlator [virtual]
, gr::digital::simple_framer [virtual]
, gr::filter::fractional_interpolator_cc [virtual]
, gr::filter::fractional_interpolator_ff [virtual]
, gr::filter::fractional_resampler_cc [virtual]
, gr::filter::fractional_resampler_ff [virtual]
, gr::filter::pfb_arb_resampler_ccf [virtual]
, gr::filter::pfb_arb_resampler_fff [virtual]
, gr::filter::pfb_channelizer_ccf [virtual]
, gr::filter::rational_resampler_base_ccc [virtual]
, gr::filter::rational_resampler_base_ccf [virtual]
, gr::filter::rational_resampler_base_fcc [virtual]
, gr::filter::rational_resampler_base_fff [virtual]
, gr::filter::rational_resampler_base_fsf [virtual]
, gr::filter::rational_resampler_base_scc [virtual]
, gr::noaa::hrpt_deframer [virtual]
, gr::pager::flex_sync [virtual]
, gr::qtgui::sink_c [virtual]
, gr::qtgui::sink_f [virtual]
, gr::sync_block, gr::tagged_stream_block, gr::trellis::constellation_metrics_cf [virtual]
, gr::trellis::metrics_c [virtual]
, gr::trellis::metrics_f [virtual]
, gr::trellis::metrics_i [virtual]
, gr::trellis::metrics_s [virtual]
, gr::trellis::pccc_decoder_b [virtual]
, gr::trellis::pccc_decoder_combined_cb [virtual]
, gr::trellis::pccc_decoder_combined_ci [virtual]
, gr::trellis::pccc_decoder_combined_cs [virtual]
, gr::trellis::pccc_decoder_combined_fb [virtual]
, gr::trellis::pccc_decoder_combined_fi [virtual]
, gr::trellis::pccc_decoder_combined_fs [virtual]
, gr::trellis::pccc_decoder_i [virtual]
, gr::trellis::pccc_decoder_s [virtual]
, gr::trellis::sccc_decoder_b [virtual]
, gr::trellis::sccc_decoder_combined_cb [virtual]
, gr::trellis::sccc_decoder_combined_ci [virtual]
, gr::trellis::sccc_decoder_combined_cs [virtual]
, gr::trellis::sccc_decoder_combined_fb [virtual]
, gr::trellis::sccc_decoder_combined_fi [virtual]
, gr::trellis::sccc_decoder_combined_fs [virtual]
, gr::trellis::sccc_decoder_i [virtual]
, gr::trellis::sccc_decoder_s [virtual]
, gr::trellis::siso_combined_f [virtual]
, gr::trellis::siso_f [virtual]
, gr::trellis::viterbi_b [virtual]
, gr::trellis::viterbi_combined_cb [virtual]
, gr::trellis::viterbi_combined_ci [virtual]
, gr::trellis::viterbi_combined_cs [virtual]
, gr::trellis::viterbi_combined_fb [virtual]
, gr::trellis::viterbi_combined_fi [virtual]
, gr::trellis::viterbi_combined_fs [virtual]
, gr::trellis::viterbi_combined_ib [virtual]
, gr::trellis::viterbi_combined_ii [virtual]
, gr::trellis::viterbi_combined_is [virtual]
, gr::trellis::viterbi_combined_sb [virtual]
, gr::trellis::viterbi_combined_si [virtual]
, gr::trellis::viterbi_combined_ss [virtual]
, gr::trellis::viterbi_i [virtual]
, and gr::trellis::viterbi_s [virtual]
.
Public Types | |
enum | { WORK_CALLED_PRODUCE = -2, WORK_DONE = -1 } |
Magic return values from general_work. More... | |
enum | tag_propagation_policy_t { TPP_DONT = 0, TPP_ALL_TO_ALL = 1, TPP_ONE_TO_ONE = 2 } |
Public Member Functions | |
virtual | ~block () |
unsigned | history () const |
void | set_history (unsigned history) |
bool | fixed_rate () const |
Return true if this block has a fixed input to output rate. | |
virtual void | forecast (int noutput_items, gr_vector_int &ninput_items_required) |
Estimate input requirements given output request. | |
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 | |
virtual bool | start () |
Called to enable drivers, etc for i/o devices. | |
virtual bool | stop () |
Called to disable drivers, etc for i/o devices. | |
void | set_output_multiple (int multiple) |
Constrain the noutput_items argument passed to forecast and general_work. | |
int | output_multiple () const |
bool | output_multiple_set () const |
void | set_alignment (int multiple) |
Constrains buffers to work on a set item alignment (for SIMD) | |
int | alignment () const |
void | set_unaligned (int na) |
int | unaligned () const |
void | set_is_unaligned (bool u) |
bool | is_unaligned () const |
void | consume (int which_input, int how_many_items) |
Tell the scheduler how_many_items of input stream which_input were consumed. | |
void | consume_each (int how_many_items) |
Tell the scheduler how_many_items were consumed on each input stream. | |
void | produce (int which_output, int how_many_items) |
Tell the scheduler how_many_items were produced on output stream which_output . | |
void | set_relative_rate (double relative_rate) |
Set the approximate output rate / input rate. | |
double | relative_rate () const |
return the approximate output rate / input rate | |
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 defined if fixed_rate returns true. Generally speaking, you don't need to override this. | |
virtual int | fixed_rate_noutput_to_ninput (int noutput) |
Given noutput samples, return number of input samples required to produce noutput. N.B. this is only defined if fixed_rate returns true. Generally speaking, you don't need to override this. | |
uint64_t | nitems_read (unsigned int which_input) |
Return the number of items read on input stream which_input. | |
uint64_t | nitems_written (unsigned int which_output) |
Return the number of items written on output stream which_output. | |
tag_propagation_policy_t | tag_propagation_policy () |
Asks for the policy used by the scheduler to moved tags downstream. | |
void | set_tag_propagation_policy (tag_propagation_policy_t p) |
Set the policy by the scheduler to determine how tags are moved downstream. | |
int | min_noutput_items () const |
Return the minimum number of output items this block can produce during a call to work. | |
void | set_min_noutput_items (int m) |
Set the minimum number of output items this block can produce during a call to work. | |
int | max_noutput_items () |
Return the maximum number of output items this block will handle during a call to work. | |
void | set_max_noutput_items (int m) |
Set the maximum number of output items this block will handle during a call to work. | |
void | unset_max_noutput_items () |
Clear the switch for using the max_noutput_items value of this block. | |
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 call to work. | |
void | expand_minmax_buffer (int port) |
long | max_output_buffer (size_t i) |
Returns max buffer size on output port i . | |
void | set_max_output_buffer (long max_output_buffer) |
Sets max buffer size on all output ports. | |
void | set_max_output_buffer (int port, long max_output_buffer) |
Sets max buffer size on output port port . | |
long | min_output_buffer (size_t i) |
Returns min buffer size on output port i . | |
void | set_min_output_buffer (long min_output_buffer) |
Sets min buffer size on all output ports. | |
void | set_min_output_buffer (int port, long min_output_buffer) |
Sets min buffer size on output port port . | |
float | pc_noutput_items () |
Gets instantaneous noutput_items performance counter. | |
float | pc_noutput_items_avg () |
Gets average noutput_items performance counter. | |
float | pc_noutput_items_var () |
Gets variance of noutput_items performance counter. | |
float | pc_nproduced () |
Gets instantaneous num items produced performance counter. | |
float | pc_nproduced_avg () |
Gets average num items produced performance counter. | |
float | pc_nproduced_var () |
Gets variance of num items produced performance counter. | |
float | pc_input_buffers_full (int which) |
Gets instantaneous fullness of which input buffer. | |
float | pc_input_buffers_full_avg (int which) |
Gets average fullness of which input buffer. | |
float | pc_input_buffers_full_var (int which) |
Gets variance of fullness of which input buffer. | |
std::vector< float > | pc_input_buffers_full () |
Gets instantaneous fullness of all input buffers. | |
std::vector< float > | pc_input_buffers_full_avg () |
Gets average fullness of all input buffers. | |
std::vector< float > | pc_input_buffers_full_var () |
Gets variance of fullness of all input buffers. | |
float | pc_output_buffers_full (int which) |
Gets instantaneous fullness of which input buffer. | |
float | pc_output_buffers_full_avg (int which) |
Gets average fullness of which input buffer. | |
float | pc_output_buffers_full_var (int which) |
Gets variance of fullness of which input buffer. | |
std::vector< float > | pc_output_buffers_full () |
Gets instantaneous fullness of all output buffers. | |
std::vector< float > | pc_output_buffers_full_avg () |
Gets average fullness of all output buffers. | |
std::vector< float > | pc_output_buffers_full_var () |
Gets variance of fullness of all output buffers. | |
float | pc_work_time () |
Gets instantaneous clock cycles spent in work. | |
float | pc_work_time_avg () |
Gets average clock cycles spent in work. | |
float | pc_work_time_var () |
Gets average clock cycles spent in work. | |
void | reset_perf_counters () |
Resets the performance counters. | |
void | setup_pc_rpc () |
Sets up export of perf. counters to ControlPort. Only called by the scheduler. | |
bool | is_pc_rpc_set () |
Checks if this block is already exporting perf. counters to ControlPort. | |
void | no_pc_rpc () |
If the block calls this in its constructor, it's perf. counters will not be exported. | |
void | set_processor_affinity (const std::vector< int > &mask) |
Set the thread's affinity to processor core n . | |
void | unset_processor_affinity () |
Remove processor affinity to a specific core. | |
std::vector< int > | processor_affinity () |
Get the current processor affinity. | |
int | active_thread_priority () |
Get the current thread priority in use. | |
int | thread_priority () |
Get the current thread priority stored. | |
int | set_thread_priority (int priority) |
Set the current thread priority. | |
block_detail_sptr | detail () const |
void | set_detail (block_detail_sptr detail) |
Protected Member Functions | |
block (void) | |
block (const std::string &name, gr::io_signature::sptr input_signature, gr::io_signature::sptr output_signature) | |
void | set_fixed_rate (bool fixed_rate) |
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. | |
void | add_item_tag (unsigned int which_output, const tag_t &tag) |
Adds a new tag onto the given output buffer. | |
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) |
Removes a tag from the given input buffer. | |
void | remove_item_tag (unsigned int which_input, const tag_t &tag) |
Removes a tag from the given input buffer. | |
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 | 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. | |
Protected Attributes | |
std::vector< long > | d_max_output_buffer |
std::vector< long > | d_min_output_buffer |
gr::thread::mutex | d_setlock |
gr::logger_ptr | d_logger |
gr::logger_ptr | d_debug_logger |
The abstract base class for all 'terminal' processing blocks.
A signal processing flow is constructed by creating a tree of hierarchical blocks, which at any level may also contain terminal nodes that actually implement signal processing functions. This is the base class for all such leaf nodes.
Blocks have a set of input streams and output streams. The input_signature and output_signature define the number of input streams and output streams respectively, and the type of the data items in each stream.
Although blocks may consume data on each input stream at a different rate, all outputs streams must produce data at the same rate. That rate may be different from any of the input rates.
User derived blocks override two methods, forecast and general_work, to implement their signal processing behavior. forecast is called by the system scheduler to determine how many items are required on each input stream in order to produce a given number of output items.
general_work is called to perform the signal processing in the block. It reads the input items and writes the output items.
virtual gr::block::~block | ( | ) | [virtual] |
gr::block::block | ( | void | ) | [inline, protected] |
gr::block::block | ( | const std::string & | name, |
gr::io_signature::sptr | input_signature, | ||
gr::io_signature::sptr | output_signature | ||
) | [protected] |
Get the current thread priority in use.
void gr::block::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 |
||
) | [inline, protected] |
Adds a new tag onto the given output buffer.
which_output | an integer of which output stream to attach the tag |
abs_offset | a uint64 number of the absolute item number assicated with the tag. Can get from nitems_written. |
key | the tag key as a PMT symbol |
value | any PMT holding any value for the given key |
srcid | optional source ID specifier; defaults to PMT_F |
References gr::tag_t::key, gr::tag_t::offset, gr::tag_t::srcid, and gr::tag_t::value.
Referenced by gr::block_gateway::block__add_item_tag(), tag_source_demo::make_eob_tag(), tag_source_demo::make_sob_tag(), and tag_source_demo::make_time_tag().
void gr::block::add_item_tag | ( | unsigned int | which_output, |
const tag_t & | tag | ||
) | [protected] |
Adds a new tag onto the given output buffer.
which_output | an integer of which output stream to attach the tag |
tag | the tag object to add |
int gr::block::alignment | ( | ) | const [inline] |
void gr::block::consume | ( | int | which_input, |
int | how_many_items | ||
) |
Tell the scheduler how_many_items
of input stream which_input
were consumed.
Referenced by gr::block_gateway::block__consume().
void gr::block::consume_each | ( | int | how_many_items | ) |
Tell the scheduler how_many_items
were consumed on each input stream.
Referenced by gr::block_gateway::block__consume_each().
block_detail_sptr gr::block::detail | ( | ) | const [inline] |
void gr::block::expand_minmax_buffer | ( | int | port | ) |
bool gr::block::fixed_rate | ( | ) | const [inline] |
Return true if this block has a fixed input to output rate.
If true, then fixed_rate_in_to_out and fixed_rate_out_to_in may be called.
Referenced by gr::block_gateway::block__fixed_rate().
virtual int gr::block::fixed_rate_ninput_to_noutput | ( | int | ninput | ) | [virtual] |
Given ninput samples, return number of output samples that will be produced. N.B. this is only defined if fixed_rate returns true. Generally speaking, you don't need to override this.
Reimplemented in gr::sync_interpolator, gr::sync_decimator, and gr::sync_block.
virtual int gr::block::fixed_rate_noutput_to_ninput | ( | int | noutput | ) | [virtual] |
Given noutput samples, return number of input samples required to produce noutput. N.B. this is only defined if fixed_rate returns true. Generally speaking, you don't need to override this.
Reimplemented in gr::sync_interpolator, gr::sync_decimator, and gr::sync_block.
virtual void gr::block::forecast | ( | int | noutput_items, |
gr_vector_int & | ninput_items_required | ||
) | [virtual] |
Estimate input requirements given output request.
noutput_items | number of output items to produce |
ninput_items_required | number of input items required on each input stream |
Given a request to product noutput_items
, estimate the number of data items required on each input stream. The estimate doesn't have to be exact, but should be close.
Reimplemented in gr::tagged_stream_block, gr::sync_interpolator, atsc_bit_timing_loop, gr::sync_decimator, gr::sync_block, gr::fft::ctrlport_probe_psd_impl, atsc_equalizer, atsc_field_sync_demux, atsc_field_sync_mux, and atsc_pad.
virtual int gr::block::general_work | ( | int | noutput_items, |
gr_vector_int & | ninput_items, | ||
gr_vector_const_void_star & | input_items, | ||
gr_vector_void_star & | output_items | ||
) | [virtual] |
compute output items from input items
noutput_items | number of output items to write on each output stream |
ninput_items | number of input items available on each input stream |
input_items | vector of pointers to the input items, one entry per input stream |
output_items | vector of pointers to the output items, one entry per output stream |
general_work must call consume or consume_each to indicate how many items were consumed on each input stream.
Reimplemented in gr::tagged_stream_block, atsc_bit_timing_loop, gr::sync_interpolator, gr::sync_decimator, gr::sync_block, atsc_field_sync_demux, and atsc_field_sync_mux.
void gr::block::get_tags_in_range | ( | std::vector< tag_t > & | v, |
unsigned int | which_input, | ||
uint64_t | abs_start, | ||
uint64_t | abs_end | ||
) | [protected] |
Given a [start,end), returns a vector of all tags in the range.
Range of counts is from start to end-1.
Tags are tuples of: (item count, source id, key, value)
v | a vector reference to return tags into |
which_input | an integer of which input stream to pull from |
abs_start | a uint64 count of the start of the range of interest |
abs_end | a uint64 count of the end of the range of interest |
Referenced by gr::block_gateway::block__get_tags_in_range(), and tag_sink_demo::work().
void gr::block::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 | ||
) | [protected] |
Given a [start,end), returns a vector of all tags in the range with a given key.
Range of counts is from start to end-1.
Tags are tuples of: (item count, source id, key, value)
v | a vector reference to return tags into |
which_input | an integer of which input stream to pull from |
abs_start | a uint64 count of the start of the range of interest |
abs_end | a uint64 count of the end of the range of interest |
key | a PMT symbol key to filter only tags of this key |
unsigned gr::block::history | ( | ) | const [inline] |
Assume block computes y_i = f(x_i, x_i-1, x_i-2, x_i-3...) History is the number of x_i's that are examined to produce one y_i. This comes in handy for FIR filters, where we use history to ensure that our input contains the appropriate "history" for the filter. History should be equal to the number of filter taps.
Referenced by gr::block_gateway::block__history().
bool gr::block::is_pc_rpc_set | ( | ) | [inline] |
Checks if this block is already exporting perf. counters to ControlPort.
Ask the block if the flag is or is not set to use the internal value of max_noutput_items during a call to work.
bool gr::block::is_unaligned | ( | ) | const [inline] |
int gr::block::max_noutput_items | ( | ) |
Return the maximum number of output items this block will handle during a call to work.
long gr::block::max_output_buffer | ( | size_t | i | ) |
Returns max buffer size on output port i
.
int gr::block::min_noutput_items | ( | ) | const [inline] |
Return the minimum number of output items this block can produce during a call to work.
Should be 0 for most blocks. Useful if we're dealing with packets and the block produces one packet per call to work.
long gr::block::min_output_buffer | ( | size_t | i | ) |
Returns min buffer size on output port i
.
uint64_t gr::block::nitems_read | ( | unsigned int | which_input | ) |
Return the number of items read on input stream which_input.
Referenced by gr::block_gateway::block__nitems_read(), and tag_sink_demo::work().
uint64_t gr::block::nitems_written | ( | unsigned int | which_output | ) |
Return the number of items written on output stream which_output.
Referenced by gr::block_gateway::block__nitems_written(), and tag_source_demo::work().
void gr::block::no_pc_rpc | ( | ) | [inline] |
If the block calls this in its constructor, it's perf. counters will not be exported.
int gr::block::output_multiple | ( | ) | const [inline] |
Referenced by gr::block_gateway::block__output_multiple().
bool gr::block::output_multiple_set | ( | ) | const [inline] |
float gr::block::pc_input_buffers_full | ( | int | which | ) |
Gets instantaneous fullness of which
input buffer.
std::vector<float> gr::block::pc_input_buffers_full | ( | ) |
Gets instantaneous fullness of all input buffers.
float gr::block::pc_input_buffers_full_avg | ( | int | which | ) |
Gets average fullness of which
input buffer.
std::vector<float> gr::block::pc_input_buffers_full_avg | ( | ) |
Gets average fullness of all input buffers.
float gr::block::pc_input_buffers_full_var | ( | int | which | ) |
Gets variance of fullness of which
input buffer.
std::vector<float> gr::block::pc_input_buffers_full_var | ( | ) |
Gets variance of fullness of all input buffers.
float gr::block::pc_noutput_items | ( | ) |
Gets instantaneous noutput_items performance counter.
float gr::block::pc_noutput_items_avg | ( | ) |
Gets average noutput_items performance counter.
float gr::block::pc_noutput_items_var | ( | ) |
Gets variance of noutput_items performance counter.
float gr::block::pc_nproduced | ( | ) |
Gets instantaneous num items produced performance counter.
float gr::block::pc_nproduced_avg | ( | ) |
Gets average num items produced performance counter.
float gr::block::pc_nproduced_var | ( | ) |
Gets variance of num items produced performance counter.
float gr::block::pc_output_buffers_full | ( | int | which | ) |
Gets instantaneous fullness of which
input buffer.
std::vector<float> gr::block::pc_output_buffers_full | ( | ) |
Gets instantaneous fullness of all output buffers.
float gr::block::pc_output_buffers_full_avg | ( | int | which | ) |
Gets average fullness of which
input buffer.
std::vector<float> gr::block::pc_output_buffers_full_avg | ( | ) |
Gets average fullness of all output buffers.
float gr::block::pc_output_buffers_full_var | ( | int | which | ) |
Gets variance of fullness of which
input buffer.
std::vector<float> gr::block::pc_output_buffers_full_var | ( | ) |
Gets variance of fullness of all output buffers.
float gr::block::pc_work_time | ( | ) |
Gets instantaneous clock cycles spent in work.
float gr::block::pc_work_time_avg | ( | ) |
Gets average clock cycles spent in work.
float gr::block::pc_work_time_var | ( | ) |
Gets average clock cycles spent in work.
std::vector<int> gr::block::processor_affinity | ( | ) | [inline, virtual] |
Get the current processor affinity.
Reimplemented from gr::basic_block.
void gr::block::produce | ( | int | which_output, |
int | how_many_items | ||
) |
Tell the scheduler how_many_items
were produced on output stream which_output
.
If the block's general_work method calls produce, general_work
must return WORK_CALLED_PRODUCE.
Referenced by gr::block_gateway::block__produce().
double gr::block::relative_rate | ( | ) | const [inline] |
return the approximate output rate / input rate
Referenced by gr::block_gateway::block__relative_rate().
void gr::block::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 |
||
) | [inline, protected] |
Removes a tag from the given input buffer.
which_input | an integer of which input stream to remove the tag from |
abs_offset | a uint64 number of the absolute item number assicated with the tag. Can get from nitems_written. |
key | the tag key as a PMT symbol |
value | any PMT holding any value for the given key |
srcid | optional source ID specifier; defaults to PMT_F |
If no such tag is found, does nothing.
References gr::tag_t::key, gr::tag_t::offset, gr::tag_t::srcid, and gr::tag_t::value.
void gr::block::remove_item_tag | ( | unsigned int | which_input, |
const tag_t & | tag | ||
) | [protected] |
Removes a tag from the given input buffer.
If no such tag is found, does nothing.
which_input | an integer of which input stream to remove the tag from |
tag | the tag object to remove |
Resets the performance counters.
void gr::block::set_alignment | ( | int | multiple | ) |
Constrains buffers to work on a set item alignment (for SIMD)
set_alignment_multiple causes the scheduler to ensure that the noutput_items argument passed to forecast and general_work will be an integer multiple of
multiple | The default value is 1. |
This control is similar to the output_multiple setting, except that if the number of items passed to the block is less than the output_multiple, this value is ignored and the block can produce like normal. The d_unaligned value is set to the number of items the block is off by. In the next call to general_work, the noutput_items is set to d_unaligned or less until d_unaligned==0. The buffers are now aligned again and the aligned calls can be performed again.
void gr::block::set_detail | ( | block_detail_sptr | detail | ) | [inline] |
void gr::block::set_fixed_rate | ( | bool | fixed_rate | ) | [inline, protected] |
Referenced by gr::block_gateway::block__set_fixed_rate().
void gr::block::set_history | ( | unsigned | history | ) | [inline] |
Referenced by gr::block_gateway::block__set_history().
void gr::block::set_max_noutput_items | ( | int | m | ) |
Set the maximum number of output items this block will handle during a call to work.
m | the maximum noutput_items this block will handle. |
void gr::block::set_max_output_buffer | ( | long | max_output_buffer | ) |
Sets max buffer size on all output ports.
void gr::block::set_max_output_buffer | ( | int | port, |
long | max_output_buffer | ||
) |
Sets max buffer size on output port port
.
void gr::block::set_min_noutput_items | ( | int | m | ) | [inline] |
Set the minimum number of output items this block can produce during a call to work.
m | the minimum noutput_items this block can produce. |
void gr::block::set_min_output_buffer | ( | long | min_output_buffer | ) |
Sets min buffer size on all output ports.
void gr::block::set_min_output_buffer | ( | int | port, |
long | min_output_buffer | ||
) |
Sets min buffer size on output port port
.
void gr::block::set_output_multiple | ( | int | multiple | ) |
Constrain the noutput_items argument passed to forecast and general_work.
set_output_multiple causes the scheduler to ensure that the noutput_items argument passed to forecast and general_work will be an integer multiple of
multiple | The default value of output multiple is 1. |
Referenced by gr::block_gateway::block__set_output_multiple().
void gr::block::set_processor_affinity | ( | const std::vector< int > & | mask | ) | [virtual] |
Set the thread's affinity to processor core n
.
mask | a vector of ints of the core numbers available to this block. |
Reimplemented from gr::basic_block.
void gr::block::set_relative_rate | ( | double | relative_rate | ) |
Set the approximate output rate / input rate.
Provide a hint to the buffer allocator and scheduler. The default relative_rate is 1.0
decimators have relative_rates < 1.0 interpolators have relative_rates > 1.0
Referenced by gr::block_gateway::block__set_relative_rate().
Set the policy by the scheduler to determine how tags are moved downstream.
Referenced by gr::block_gateway::block__set_tag_propagation_policy().
int gr::block::set_thread_priority | ( | int | priority | ) |
Set the current thread priority.
void gr::block::set_unaligned | ( | int | na | ) |
Sets up export of perf. counters to ControlPort. Only called by the scheduler.
virtual bool gr::block::start | ( | ) | [virtual] |
Called to enable drivers, etc for i/o devices.
This allows a block to enable an associated driver to begin transfering data just before we start to execute the scheduler. The end result is that this reduces latency in the pipeline when dealing with audio devices, usrps, etc.
Reimplemented in gr::blocks::probe_rate.
virtual bool gr::block::stop | ( | ) | [virtual] |
Called to disable drivers, etc for i/o devices.
Reimplemented in gr::blocks::probe_rate.
Asks for the policy used by the scheduler to moved tags downstream.
Referenced by gr::block_gateway::block__tag_propagation_policy().
int gr::block::thread_priority | ( | ) |
Get the current thread priority stored.
int gr::block::unaligned | ( | ) | const [inline] |
Clear the switch for using the max_noutput_items value of this block.
When is_set_max_noutput_items() returns 'true', the scheduler will use the value returned by max_noutput_items() to limit the size of the number of items possible for this block's work function. If is_set_max_notput_items() returns 'false', then the scheduler ignores the internal value and uses the value set globally in the top_block.
Use this value to clear the 'is_set' flag so the scheduler will ignore this. Use the set_max_noutput_items(m) call to both set a new value for max_noutput_items and to reenable its use in the scheduler.
void gr::block::unset_processor_affinity | ( | ) | [virtual] |
Remove processor affinity to a specific core.
Reimplemented from gr::basic_block.
gr::logger_ptr gr::block::d_debug_logger [protected] |
gr::logger_ptr gr::block::d_logger [protected] |
Used by blocks to access the logger system.
std::vector<long> gr::block::d_max_output_buffer [protected] |
std::vector<long> gr::block::d_min_output_buffer [protected] |
gr::thread::mutex gr::block::d_setlock [protected] |
Used by block's setters and work functions to make setting/resetting of parameters thread-safe.
Used by calling gr::thread::scoped_lock l(d_setlock);