GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
time_delta.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2021 NTESS LLC.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  */
9 
10 #ifndef INCLUDED_PDU_TIME_DELTA_H
11 #define INCLUDED_PDU_TIME_DELTA_H
12 
13 #include <gnuradio/block.h>
14 #include <gnuradio/pdu/api.h>
15 
16 namespace gr {
17 namespace pdu {
18 
19 /*!
20  * \brief Compute system time differences and provide statistics upon completion.
21  * \ingroup debug_tools_blk
22  * \ingroup pdu_blk
23  *
24  * This block computes the difference between the current system time and a defined PDU
25  * key previously added (e.g.: by by the add_system_time block). This is useful for
26  * benchmarking PDU operations. The block also maintains running estimates of mean and
27  * variance, accessible by getters and printed when the flowgraph is stopped.
28  */
29 class PDU_API time_delta : virtual public gr::block
30 {
31 public:
32  typedef std::shared_ptr<time_delta> sptr;
33 
34  /*!
35  * \brief Return a shared_ptr to a new instance of pdu::time_delta.
36  *
37  * @param delta_key - key to use for time delta metadata field
38  * @param time_key - key to use as reference time for delta
39  */
40  static sptr make(const pmt::pmt_t delta_key, const pmt::pmt_t time_key);
41 
42  virtual double get_variance(void) = 0;
43  virtual double get_mean(void) = 0;
44  virtual void reset_stats(void) = 0;
45 };
46 
47 } // namespace pdu
48 } // namespace gr
49 
50 #endif /* INCLUDED_PDU_TIME_DELTA_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Compute system time differences and provide statistics upon completion.
Definition: time_delta.h:30
static sptr make(const pmt::pmt_t delta_key, const pmt::pmt_t time_key)
Return a shared_ptr to a new instance of pdu::time_delta.
virtual double get_variance(void)=0
virtual double get_mean(void)=0
std::shared_ptr< time_delta > sptr
Definition: time_delta.h:32
virtual void reset_stats(void)=0
#define PDU_API
Definition: gr-pdu/include/gnuradio/pdu/api.h:18
GR_RUNTIME_API const pmt::pmt_t pdu()
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83