GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
probe_rate.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2005,2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_BLOCKS_PROBE_RATE_H
12 #define INCLUDED_BLOCKS_PROBE_RATE_H
13 
14 #include <gnuradio/blocks/api.h>
15 #include <gnuradio/sync_block.h>
16 #include <string_view>
17 
18 namespace gr {
19 namespace blocks {
20 
21 /*!
22  * \brief throughput measurement
23  * \ingroup measurement_tools_blk
24  */
25 class BLOCKS_API probe_rate : virtual public sync_block
26 {
27 public:
28  // gr::blocks::probe_rate::sptr
29  typedef std::shared_ptr<probe_rate> sptr;
30 
31  /*!
32  * \brief Make a throughput measurement block
33  * \param itemsize size of each stream item
34  * \param update_rate_ms minimum update time in milliseconds
35  * \param alpha gain for running average filter
36  * \param name name for this probe (used in generated dictionaries)
37  *
38  * If the name is empty, the "name" field in the emitted dictionaries is
39  * omitted.
40  */
41  static sptr make(size_t itemsize,
42  double update_rate_ms = 500.0,
43  double alpha = 0.0001,
44  std::string_view name = "");
45 
46  /*!
47  * \brief Set the decay of the exponential rate average
48  */
49  virtual void set_alpha(double alpha) = 0;
50 
51  /*!
52  * \brief Set the name of this probe
53  * Used in the emitted dictionaries if not empty
54  */
55  virtual void set_name(std::string_view name) = 0;
56 
57  virtual double rate() = 0;
58 
59  bool start() override = 0;
60  bool stop() override = 0;
61 };
62 
63 } /* namespace blocks */
64 } /* namespace gr */
65 
66 #endif /* INCLUDED_BLOCKS_PROBE_RATE_H */
throughput measurement
Definition: probe_rate.h:26
static sptr make(size_t itemsize, double update_rate_ms=500.0, double alpha=0.0001, std::string_view name="")
Make a throughput measurement block.
virtual double rate()=0
bool start() override=0
Called to enable drivers, etc for i/o devices.
bool stop() override=0
Called to disable drivers, etc for i/o devices.
std::shared_ptr< probe_rate > sptr
Definition: probe_rate.h:29
virtual void set_alpha(double alpha)=0
Set the decay of the exponential rate average.
virtual void set_name(std::string_view name)=0
Set the name of this probe Used in the emitted dictionaries if not empty.
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GR_RUNTIME_API size_t itemsize(types::vector_type type)
GNU Radio logging wrapper.
Definition: basic_block.h:29