summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/doxygen/other/perf_counters.dox19
-rw-r--r--gnuradio-runtime/include/gnuradio/block.h5
-rw-r--r--gnuradio-runtime/include/gnuradio/block_detail.h3
-rw-r--r--gnuradio-runtime/lib/block.cc18
-rw-r--r--gnuradio-runtime/lib/block_detail.cc8
-rw-r--r--gnuradio-runtime/swig/block.i1
6 files changed, 45 insertions, 9 deletions
diff --git a/docs/doxygen/other/perf_counters.dox b/docs/doxygen/other/perf_counters.dox
index 518b04e780..c09f17c029 100644
--- a/docs/doxygen/other/perf_counters.dox
+++ b/docs/doxygen/other/perf_counters.dox
@@ -5,7 +5,7 @@
Each block can have a set of Performance Counters that the schedule
keeps track of. These counters measure and store information about
different performance metrics of their operation. The concept is
-fairly extensible, but currently, GNU Radio defines five types of
+fairly extensible, but currently, GNU Radio defines the following
Performance Counters:
\li noutput_items: number of items the block can produce.
@@ -13,20 +13,21 @@ Performance Counters:
\li input_buffers_full: % of how full each input buffer is.
\li output_buffers_full: % of how full each output buffer is.
\li work_time: number of CPU ticks during the call to general_work().
+\li work_time_total: Accumulated sum of work_time.
-For each Performance Counter, we can retrieve the instantaneous,
-average, and variance from the block. Access to these counters is done
-through a simple set of functions added to every block in the
-flowgraph:
+For each Performance Counter except the work_time_total, we can
+retrieve the instantaneous, average, and variance from the
+block. Access to these counters is done through a simple set of
+functions added to every block in the flowgraph:
\code
float pc_<name>[_<type>]();
\endcode
-In the above, the \<name\> field is one of the five counters in the
-above list of counters. The optional \<type\> suffix is either 'avg' to
-get the average value or 'var' to get the variance. Without a suffix,
-the function returns the most recent instantaneous value.
+In the above, the \<name\> field is one of the counters in the above
+list of counters. The optional \<type\> suffix is either 'avg' to get
+the average value or 'var' to get the variance. Without a suffix, the
+function returns the most recent instantaneous value.
We can also reset the Performance Counters back to zero to remove any
history of the current average and variance calculations for a
diff --git a/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h
index b8cbcfc552..5cd5dbb4a4 100644
--- a/gnuradio-runtime/include/gnuradio/block.h
+++ b/gnuradio-runtime/include/gnuradio/block.h
@@ -461,6 +461,11 @@ namespace gr {
float pc_work_time_var();
/*!
+ * \brief Gets total clock cycles spent in work.
+ */
+ float pc_work_time_total();
+
+ /*!
* \brief Resets the performance counters
*/
void reset_perf_counters();
diff --git a/gnuradio-runtime/include/gnuradio/block_detail.h b/gnuradio-runtime/include/gnuradio/block_detail.h
index b7531baf6d..b336cb86f7 100644
--- a/gnuradio-runtime/include/gnuradio/block_detail.h
+++ b/gnuradio-runtime/include/gnuradio/block_detail.h
@@ -227,6 +227,8 @@ namespace gr {
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();
tpb_detail d_tpb; // used by thread-per-block scheduler
int d_produce_or;
@@ -257,6 +259,7 @@ namespace gr {
float d_ins_work_time;
float d_avg_work_time;
float d_var_work_time;
+ float d_total_work_time;
float d_pc_counter;
block_detail(unsigned int ninputs, unsigned int noutputs);
diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc
index 7a55e09561..e76daefe48 100644
--- a/gnuradio-runtime/lib/block.cc
+++ b/gnuradio-runtime/lib/block.cc
@@ -635,6 +635,17 @@ namespace gr {
}
}
+ float
+ block::pc_work_time_total()
+ {
+ if(d_detail) {
+ return d_detail->pc_work_time_total();
+ }
+ else {
+ return 0;
+ }
+ }
+
void
block::reset_perf_counters()
{
@@ -712,6 +723,13 @@ namespace gr {
DISPTIME | DISPOPTSTRIP)));
d_rpc_vars.push_back(
+ rpcbasic_sptr(new rpcbasic_register_get<block, float>(
+ alias(), "total work time", &block::pc_work_time_total,
+ pmt::mp(0), pmt::mp(1e9), pmt::mp(0),
+ "", "Total clock cycles in calls to work", RPC_PRIVLVL_MIN,
+ DISPTIME | DISPOPTSTRIP)));
+
+ d_rpc_vars.push_back(
rpcbasic_sptr(new rpcbasic_register_get<block, std::vector<float> >(
alias(), "input \% full", &block::pc_input_buffers_full,
pmt::make_c32vector(0,0), pmt::make_c32vector(0,1), pmt::make_c32vector(0,0),
diff --git a/gnuradio-runtime/lib/block_detail.cc b/gnuradio-runtime/lib/block_detail.cc
index fd1240ae56..1020916ec2 100644
--- a/gnuradio-runtime/lib/block_detail.cc
+++ b/gnuradio-runtime/lib/block_detail.cc
@@ -272,6 +272,7 @@ namespace gr {
d_ins_work_time = diff;
d_avg_work_time = diff;
d_var_work_time = 0;
+ d_total_work_time = diff;
d_ins_nproduced = nproduced;
d_avg_nproduced = nproduced;
d_var_nproduced = 0;
@@ -300,6 +301,7 @@ namespace gr {
d_ins_work_time = diff;
d_avg_work_time = d_avg_work_time + d/d_pc_counter;
d_var_work_time = d_var_work_time + d*d;
+ d_total_work_time += diff;
d = nproduced - d_avg_nproduced;
d_ins_nproduced = nproduced;
@@ -493,4 +495,10 @@ namespace gr {
return d_var_work_time/(d_pc_counter-1);
}
+ float
+ block_detail::pc_work_time_total()
+ {
+ return d_total_work_time;
+ }
+
} /* namespace gr */
diff --git a/gnuradio-runtime/swig/block.i b/gnuradio-runtime/swig/block.i
index 7b7ac8ee43..1f9b70ce0c 100644
--- a/gnuradio-runtime/swig/block.i
+++ b/gnuradio-runtime/swig/block.i
@@ -89,6 +89,7 @@ class gr::block : public gr::basic_block
float pc_work_time();
float pc_work_time_avg();
float pc_work_time_var();
+ float pc_work_time_total();
// Methods to manage processor affinity.
void set_processor_affinity(const std::vector<int> &mask);