11#ifndef INCLUDED_GR_RUNTIME_BLOCK_DETAIL_H
12#define INCLUDED_GR_RUNTIME_BLOCK_DETAIL_H
42 bool sink_p()
const {
return d_noutputs == 0; }
43 bool source_p()
const {
return d_ninputs == 0; }
46 bool done()
const {
return d_done; }
48 void set_input(
unsigned int which, buffer_reader_sptr reader);
49 buffer_reader_sptr
input(
unsigned int which)
51 if (which >= d_ninputs)
52 throw std::invalid_argument(
"block_detail::input");
53 return d_input[which];
57 buffer_sptr
output(
unsigned int which)
59 if (which >= d_noutputs)
60 throw std::invalid_argument(
"block_detail::output");
61 return d_output[which];
68 void consume(
int which_input,
int how_many_items);
80 void produce(
int which_output,
int how_many_items);
141 unsigned int which_input,
166 unsigned int which_input,
205 for (
int i = 0; i < noutputs(); i++)
206 output(i)->decrement_active();
207 for (
int i = 0; i < ninputs(); i++)
208 input(i)->buffer()->decrement_active();
258 unsigned int d_ninputs;
259 unsigned int d_noutputs;
260 std::vector<buffer_reader_sptr> d_input;
261 std::vector<buffer_sptr> d_output;
266 float d_ins_noutput_items;
267 float d_avg_noutput_items;
268 float d_var_noutput_items;
269 float d_total_noutput_items;
272 float d_ins_nproduced;
273 float d_avg_nproduced;
274 float d_var_nproduced;
275 std::vector<float> d_ins_input_buffers_full;
276 std::vector<float> d_avg_input_buffers_full;
277 std::vector<float> d_var_input_buffers_full;
278 std::vector<float> d_ins_output_buffers_full;
279 std::vector<float> d_avg_output_buffers_full;
280 std::vector<float> d_var_output_buffers_full;
282 float d_ins_work_time;
283 float d_avg_work_time;
284 float d_var_work_time;
285 float d_total_work_time;
286 float d_avg_throughput;
289 block_detail(
unsigned int ninputs,
unsigned int noutputs);
294 unsigned int noutputs);
298 unsigned int noutputs);
Implementation details to support the signal processing abstraction.
Definition: block_detail.h:36
float pc_work_time_total()
bool threaded
Definition: block_detail.h:211
void set_processor_affinity(const std::vector< int > &mask)
Set core affinity of block to the cores in the vector mask.
friend GR_RUNTIME_API block_detail_sptr make_block_detail(unsigned int ninputs, unsigned int noutputs)
bool done() const
Definition: block_detail.h:46
void remove_item_tag(unsigned int which_input, const tag_t &tag, long id)
Removes a tag from the given input stream.
float pc_noutput_items_avg()
float pc_input_buffers_full_avg(size_t which)
int thread_priority()
Get the current thread priority.
buffer_reader_sptr input(unsigned int which)
Definition: block_detail.h:49
tpb_detail d_tpb
Definition: block_detail.h:246
void start_perf_counters()
float pc_output_buffers_full_avg(size_t which)
gr::logger_ptr d_debug_logger
Definition: block_detail.h:253
void set_output(unsigned int which, buffer_sptr buffer)
void produce_each(int how_many_items)
Tell the scheduler how_many_items were produced on each output stream.
bool sink_p() const
Definition: block_detail.h:42
std::vector< float > pc_output_buffers_full_var()
float pc_output_buffers_full(size_t which)
int noutputs() const
Definition: block_detail.h:41
float pc_noutput_items_var()
uint64_t nitems_written(unsigned int which_output)
std::vector< float > pc_input_buffers_full()
std::vector< float > pc_output_buffers_full()
uint64_t nitems_read(unsigned int which_input)
void add_item_tag(unsigned int which_output, const tag_t &tag)
Adds a new tag to the given output stream.
float pc_input_buffers_full(size_t which)
std::vector< float > pc_input_buffers_full_var()
void consume(int which_input, int how_many_items)
Tell the scheduler how_many_items of input stream which_input were consumed.
int d_produce_or
Definition: block_detail.h:247
std::vector< float > pc_output_buffers_full_avg()
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.
void consume_each(int how_many_items)
Tell the scheduler how_many_items were consumed on each input stream.
bool source_p() const
Definition: block_detail.h:43
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.
gr::thread::gr_thread_t thread
Definition: block_detail.h:212
std::vector< float > pc_input_buffers_full_avg()
float pc_output_buffers_full_var(size_t which)
int set_thread_priority(int priority)
Set the current thread priority.
void produce(int which_output, int how_many_items)
Tell the scheduler how_many_items were produced on output stream which_output.
void set_input(unsigned int which, buffer_reader_sptr reader)
void reset_perf_counters()
float pc_throughput_avg()
void reset_nitem_counters()
buffer_sptr output(unsigned int which)
Definition: block_detail.h:57
void unset_processor_affinity()
Unset core affinity.
float pc_input_buffers_full_var(size_t which)
void stop_perf_counters(int noutput_items, int nproduced)
void post_work_cleanup()
Definition: block_detail.h:202
int ninputs() const
Definition: block_detail.h:40
Single writer, multiple reader fifo.
Definition: buffer.h:67
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
pthread_t gr_thread_t
a system-dependent typedef for the underlying thread type.
Definition: thread.h:50
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::shared_ptr< logger > logger_ptr
Definition: logger.h:225
GR_RUNTIME_API block_detail_sptr make_block_detail(unsigned int ninputs, unsigned int noutputs)
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:40
GR_RUNTIME_API long block_detail_ncurrently_allocated()
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83
used by thread-per-block scheduler
Definition: tpb_detail.h:26
Definition: cc_common.h:35