summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime
diff options
context:
space:
mode:
authorTom Rondeau2013-02-16 15:41:56 -0500
committerTom Rondeau2013-02-16 15:41:56 -0500
commit1ddc990d1aded4cda9c1dfde596a1be2599aaf0d (patch)
treee20cae5887e93fcf18cea49e10c359e7ba588036 /gnuradio-core/src/lib/runtime
parent55028034dbad37c07c4675c88fccb460218ee924 (diff)
downloadgnuradio-1ddc990d1aded4cda9c1dfde596a1be2599aaf0d.tar.gz
gnuradio-1ddc990d1aded4cda9c1dfde596a1be2599aaf0d.tar.bz2
gnuradio-1ddc990d1aded4cda9c1dfde596a1be2599aaf0d.zip
core: only query preferences database once at start of block_executor.
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.cc11
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.h4
2 files changed, 11 insertions, 4 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
index 6258d99a8..e070f3c50 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
@@ -166,6 +166,11 @@ gr_block_executor::gr_block_executor (gr_block_sptr block, int max_noutput_items
<< d_block << std::endl;
}
+#ifdef GR_PERFORMANCE_COUNTERS
+ gr_prefs *prefs = gr_prefs::singleton();
+ d_use_pc = prefs->get_bool("PerfCounters", "on", false);
+#endif /* GR_PERFORMANCE_COUNTERS */
+
d_block->start(); // enable any drivers, etc.
}
@@ -180,8 +185,6 @@ gr_block_executor::~gr_block_executor ()
gr_block_executor::state
gr_block_executor::run_one_iteration()
{
- gr_prefs *prefs = gr_prefs::singleton();
-
int noutput_items;
int max_items_avail;
int max_noutput_items = d_max_noutput_items;
@@ -423,7 +426,7 @@ gr_block_executor::run_one_iteration()
d_start_nitems_read[i] = d->nitems_read(i);
#ifdef GR_PERFORMANCE_COUNTERS
- if(prefs->get_bool("PerfCounters", "on", false))
+ if(d_use_pc)
d->start_perf_counters();
#endif /* GR_PERFORMANCE_COUNTERS */
@@ -432,7 +435,7 @@ gr_block_executor::run_one_iteration()
d_input_items, d_output_items);
#ifdef GR_PERFORMANCE_COUNTERS
- if(prefs->get_bool("PerfCounters", "on", false))
+ if(d_use_pc)
d->stop_perf_counters(noutput_items, n);
#endif /* GR_PERFORMANCE_COUNTERS */
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h
index 0ae5affba..fb7f9c269 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.h
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h
@@ -53,6 +53,10 @@ protected:
std::vector<gr_tag_t> d_returned_tags;
int d_max_noutput_items;
+#ifdef GR_PERFORMANCE_COUNTERS
+ bool d_use_pc;
+#endif /* GR_PERFORMANCE_COUNTERS */
+
public:
gr_block_executor(gr_block_sptr block, int max_noutput_items=100000);
~gr_block_executor ();