GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
gr::block_detail Class Reference

Implementation details to support the signal processing abstractionThis class contains implementation detail that should be "out of sight" of almost all users of GNU Radio. This decoupling also means that we can make changes to the guts without having to recompile everything. More...

#include <gnuradio/block_detail.h>

Public Member Functions

 ~block_detail ()
 
int ninputs () const
 
int noutputs () const
 
bool sink_p () const
 
bool source_p () const
 
void set_done (bool done)
 
bool done () const
 
void set_input (unsigned int which, buffer_reader_sptr reader)
 
buffer_reader_sptr input (unsigned int which)
 
void set_output (unsigned int which, buffer_sptr buffer)
 
buffer_sptr output (unsigned int which)
 
void consume (int which_input, int how_many_items)
 Tell the scheduler how_many_items of input stream which_input were consumed. More...
 
void consume_each (int how_many_items)
 Tell the scheduler how_many_items were consumed on each input stream. More...
 
void produce (int which_output, int how_many_items)
 Tell the scheduler how_many_items were produced on output stream which_output. More...
 
void produce_each (int how_many_items)
 Tell the scheduler how_many_items were produced on each output stream. More...
 
uint64_t nitems_read (unsigned int which_input)
 
uint64_t nitems_written (unsigned int which_output)
 
void reset_nitem_counters ()
 
void clear_tags ()
 
void add_item_tag (unsigned int which_output, const tag_t &tag)
 Adds a new tag to the given output stream. More...
 
void remove_item_tag (unsigned int which_input, const tag_t &tag, long id)
 Removes a tag from the given input stream. More...
 
void get_tags_in_range (std::vector< tag_t > &v, unsigned int which_input, uint64_t abs_start, uint64_t abs_end, long id)
 Given a [start,end), returns a vector of all tags in the range. More...
 
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, long id)
 Given a [start,end), returns a vector of all tags in the range with a given key. More...
 
void set_processor_affinity (const std::vector< int > &mask)
 Set core affinity of block to the cores in the vector mask. More...
 
void unset_processor_affinity ()
 Unset core affinity. More...
 
int thread_priority ()
 Get the current thread priority. More...
 
int set_thread_priority (int priority)
 Set the current thread priority. More...
 
void start_perf_counters ()
 
void stop_perf_counters (int noutput_items, int nproduced)
 
void reset_perf_counters ()
 
float pc_noutput_items ()
 
float pc_nproduced ()
 
float pc_input_buffers_full (size_t which)
 
std::vector< float > pc_input_buffers_full ()
 
float pc_output_buffers_full (size_t which)
 
std::vector< float > pc_output_buffers_full ()
 
float pc_work_time ()
 
float pc_noutput_items_avg ()
 
float pc_nproduced_avg ()
 
float pc_input_buffers_full_avg (size_t which)
 
std::vector< float > pc_input_buffers_full_avg ()
 
float pc_output_buffers_full_avg (size_t which)
 
std::vector< float > pc_output_buffers_full_avg ()
 
float pc_work_time_avg ()
 
float pc_throughput_avg ()
 
float pc_noutput_items_var ()
 
float pc_nproduced_var ()
 
float pc_input_buffers_full_var (size_t which)
 
std::vector< float > pc_input_buffers_full_var ()
 
float pc_output_buffers_full_var (size_t which)
 
std::vector< float > pc_output_buffers_full_var ()
 
float pc_work_time_var ()
 
float pc_work_time_total ()
 
int consumed () const
 

Public Attributes

bool threaded
 
gr::thread::gr_thread_t thread
 
tpb_detail d_tpb
 
int d_produce_or
 

Friends

struct tpb_detail
 
GR_RUNTIME_API block_detail_sptr make_block_detail (unsigned int ninputs, unsigned int noutputs)
 

Detailed Description

Implementation details to support the signal processing abstraction

This class contains implementation detail that should be "out of sight" of almost all users of GNU Radio. This decoupling also means that we can make changes to the guts without having to recompile everything.

Constructor & Destructor Documentation

◆ ~block_detail()

gr::block_detail::~block_detail ( )

Member Function Documentation

◆ add_item_tag()

void gr::block_detail::add_item_tag ( unsigned int  which_output,
const tag_t tag 
)

Adds a new tag to the given output stream.

Calls gr::buffer::add_item_tag(), which appends the tag onto its deque.

Parameters
which_outputan integer of which output stream to attach the tag
tagthe tag object to add

◆ clear_tags()

void gr::block_detail::clear_tags ( )

◆ consume()

void gr::block_detail::consume ( int  which_input,
int  how_many_items 
)

Tell the scheduler how_many_items of input stream which_input were consumed.

◆ consume_each()

void gr::block_detail::consume_each ( int  how_many_items)

Tell the scheduler how_many_items were consumed on each input stream.

◆ consumed()

int gr::block_detail::consumed ( ) const

◆ done()

bool gr::block_detail::done ( ) const
inline

◆ get_tags_in_range() [1/2]

void gr::block_detail::get_tags_in_range ( std::vector< tag_t > &  v,
unsigned int  which_input,
uint64_t  abs_start,
uint64_t  abs_end,
long  id 
)

Given a [start,end), returns a vector of all tags in the range.

Pass-through function to gr::buffer_reader to get a vector of tags in given range. Range of counts is from start to end-1.

Tags are tuples of: (item count, source id, key, value)

Parameters
va vector reference to return tags into
which_inputan integer of which input stream to pull from
abs_starta uint64 count of the start of the range of interest
abs_enda uint64 count of the end of the range of interest
idBlock ID

◆ get_tags_in_range() [2/2]

void gr::block_detail::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,
long  id 
)

Given a [start,end), returns a vector of all tags in the range with a given key.

Calls get_tags_in_range(which_input, abs_start, abs_end) to get a vector of tags from the buffers. This function then provides a secondary filter to the tags to extract only tags with the given 'key'.

Tags are tuples of: (item count, source id, key, value)

Parameters
va vector reference to return tags into
which_inputan integer of which input stream to pull from
abs_starta uint64 count of the start of the range of interest
abs_enda uint64 count of the end of the range of interest
keya PMT symbol to select only tags of this key
idBlock ID

◆ input()

buffer_reader_sptr gr::block_detail::input ( unsigned int  which)
inline

◆ ninputs()

int gr::block_detail::ninputs ( ) const
inline

◆ nitems_read()

uint64_t gr::block_detail::nitems_read ( unsigned int  which_input)

◆ nitems_written()

uint64_t gr::block_detail::nitems_written ( unsigned int  which_output)

◆ noutputs()

int gr::block_detail::noutputs ( ) const
inline

◆ output()

buffer_sptr gr::block_detail::output ( unsigned int  which)
inline

◆ pc_input_buffers_full() [1/2]

float gr::block_detail::pc_input_buffers_full ( size_t  which)

◆ pc_input_buffers_full() [2/2]

std::vector<float> gr::block_detail::pc_input_buffers_full ( )

◆ pc_input_buffers_full_avg() [1/2]

float gr::block_detail::pc_input_buffers_full_avg ( size_t  which)

◆ pc_input_buffers_full_avg() [2/2]

std::vector<float> gr::block_detail::pc_input_buffers_full_avg ( )

◆ pc_input_buffers_full_var() [1/2]

float gr::block_detail::pc_input_buffers_full_var ( size_t  which)

◆ pc_input_buffers_full_var() [2/2]

std::vector<float> gr::block_detail::pc_input_buffers_full_var ( )

◆ pc_noutput_items()

float gr::block_detail::pc_noutput_items ( )

◆ pc_noutput_items_avg()

float gr::block_detail::pc_noutput_items_avg ( )

◆ pc_noutput_items_var()

float gr::block_detail::pc_noutput_items_var ( )

◆ pc_nproduced()

float gr::block_detail::pc_nproduced ( )

◆ pc_nproduced_avg()

float gr::block_detail::pc_nproduced_avg ( )

◆ pc_nproduced_var()

float gr::block_detail::pc_nproduced_var ( )

◆ pc_output_buffers_full() [1/2]

float gr::block_detail::pc_output_buffers_full ( size_t  which)

◆ pc_output_buffers_full() [2/2]

std::vector<float> gr::block_detail::pc_output_buffers_full ( )

◆ pc_output_buffers_full_avg() [1/2]

float gr::block_detail::pc_output_buffers_full_avg ( size_t  which)

◆ pc_output_buffers_full_avg() [2/2]

std::vector<float> gr::block_detail::pc_output_buffers_full_avg ( )

◆ pc_output_buffers_full_var() [1/2]

float gr::block_detail::pc_output_buffers_full_var ( size_t  which)

◆ pc_output_buffers_full_var() [2/2]

std::vector<float> gr::block_detail::pc_output_buffers_full_var ( )

◆ pc_throughput_avg()

float gr::block_detail::pc_throughput_avg ( )

◆ pc_work_time()

float gr::block_detail::pc_work_time ( )

◆ pc_work_time_avg()

float gr::block_detail::pc_work_time_avg ( )

◆ pc_work_time_total()

float gr::block_detail::pc_work_time_total ( )

◆ pc_work_time_var()

float gr::block_detail::pc_work_time_var ( )

◆ produce()

void gr::block_detail::produce ( int  which_output,
int  how_many_items 
)

Tell the scheduler how_many_items were produced on output stream which_output.

◆ produce_each()

void gr::block_detail::produce_each ( int  how_many_items)

Tell the scheduler how_many_items were produced on each output stream.

◆ remove_item_tag()

void gr::block_detail::remove_item_tag ( unsigned int  which_input,
const tag_t tag,
long  id 
)

Removes a tag from the given input stream.

Calls gr::buffer::remove_item_tag(). The tag in question will then no longer appear on subsequent calls of get_tags_in_range().

Parameters
which_inputan integer of which input stream to remove the tag from
tagthe tag object to add
idThe unique block ID (use gr::block::unique_id())

◆ reset_nitem_counters()

void gr::block_detail::reset_nitem_counters ( )

◆ reset_perf_counters()

void gr::block_detail::reset_perf_counters ( )

◆ set_done()

void gr::block_detail::set_done ( bool  done)

◆ set_input()

void gr::block_detail::set_input ( unsigned int  which,
buffer_reader_sptr  reader 
)

◆ set_output()

void gr::block_detail::set_output ( unsigned int  which,
buffer_sptr  buffer 
)

◆ set_processor_affinity()

void gr::block_detail::set_processor_affinity ( const std::vector< int > &  mask)

Set core affinity of block to the cores in the vector mask.

Parameters
maska vector of ints of the core numbers available to this block.

◆ set_thread_priority()

int gr::block_detail::set_thread_priority ( int  priority)

Set the current thread priority.

Parameters
prioritythe new thread priority to set

◆ sink_p()

bool gr::block_detail::sink_p ( ) const
inline

◆ source_p()

bool gr::block_detail::source_p ( ) const
inline

◆ start_perf_counters()

void gr::block_detail::start_perf_counters ( )

◆ stop_perf_counters()

void gr::block_detail::stop_perf_counters ( int  noutput_items,
int  nproduced 
)

◆ thread_priority()

int gr::block_detail::thread_priority ( )

Get the current thread priority.

◆ unset_processor_affinity()

void gr::block_detail::unset_processor_affinity ( )

Unset core affinity.

Friends And Related Function Documentation

◆ make_block_detail

GR_RUNTIME_API block_detail_sptr make_block_detail ( unsigned int  ninputs,
unsigned int  noutputs 
)
friend

◆ tpb_detail

friend struct tpb_detail
friend

Member Data Documentation

◆ d_produce_or

int gr::block_detail::d_produce_or

◆ d_tpb

tpb_detail gr::block_detail::d_tpb

◆ thread

gr::thread::gr_thread_t gr::block_detail::thread

◆ threaded

bool gr::block_detail::threaded

The documentation for this class was generated from the following file: