diff options
author | Tim O'Shea <tim.oshea753@gmail.com> | 2013-06-06 18:10:52 -0400 |
---|---|---|
committer | Tim O'Shea <tim.oshea753@gmail.com> | 2013-06-06 18:10:52 -0400 |
commit | cc073d26de6ad088f5580582b5d28d064336c530 (patch) | |
tree | 885e2d8a8b2c5675f5bafa302c90fc93a5fa5b90 /gnuradio-runtime | |
parent | 9d90ffb56631f9a85f60d13b6e32b4a1c354ffe9 (diff) |
runtime: fix for timer issue that was causing qtgui components to not plot
Diffstat (limited to 'gnuradio-runtime')
-rw-r--r-- | gnuradio-runtime/include/gnuradio/high_res_timer.h | 21 | ||||
-rw-r--r-- | gnuradio-runtime/lib/block_detail.cc | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/gnuradio-runtime/include/gnuradio/high_res_timer.h b/gnuradio-runtime/include/gnuradio/high_res_timer.h index 7ec51602b..ce11cd8eb 100644 --- a/gnuradio-runtime/include/gnuradio/high_res_timer.h +++ b/gnuradio-runtime/include/gnuradio/high_res_timer.h @@ -51,6 +51,9 @@ namespace gr { //! Get the current time in ticks high_res_timer_type high_res_timer_now(void); + //! Get the current time in ticks - for performance monitoring + high_res_timer_type high_res_timer_now_perfmon(void); + //! Get the number of ticks per second high_res_timer_type high_res_timer_tps(void); @@ -68,6 +71,12 @@ namespace gr { #ifdef GNURADIO_HRT_USE_CLOCK_GETTIME inline gr::high_res_timer_type gr::high_res_timer_now(void){ timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return ts.tv_sec*high_res_timer_tps() + ts.tv_nsec; + } + + inline gr::high_res_timer_type gr::high_res_timer_now_perfmon(void){ + timespec ts; clock_gettime(high_res_timer_source, &ts); return ts.tv_sec*high_res_timer_tps() + ts.tv_nsec; } @@ -85,6 +94,10 @@ namespace gr { return mach_absolute_time(); } + inline gr::high_res_timer_type gr::high_res_timer_now_perfmon(void){ + return gr::high_res_timer_now(); + } + inline gr::high_res_timer_type gr::high_res_timer_tps(void){ mach_timebase_info_data_t info; mach_timebase_info(&info); @@ -102,6 +115,10 @@ namespace gr { return counts.QuadPart; } + inline gr::high_res_timer_type gr::high_res_timer_now_perfmon(void){ + return gr::high_res_timer_now(); + } + inline gr::high_res_timer_type gr::high_res_timer_tps(void){ LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); @@ -118,6 +135,10 @@ namespace gr { return (boost::posix_time::microsec_clock::universal_time() - epoch).ticks(); } + inline gr::high_res_timer_type gr::high_res_timer_now_perfmon(void){ + return gr::high_res_timer_now(); + } + inline gr::high_res_timer_type gr::high_res_timer_tps(void){ return boost::posix_time::time_duration::ticks_per_second(); } diff --git a/gnuradio-runtime/lib/block_detail.cc b/gnuradio-runtime/lib/block_detail.cc index 0be22bf5b..fd1240ae5 100644 --- a/gnuradio-runtime/lib/block_detail.cc +++ b/gnuradio-runtime/lib/block_detail.cc @@ -259,13 +259,13 @@ namespace gr { void block_detail::start_perf_counters() { - d_start_of_work = gr::high_res_timer_now(); + d_start_of_work = gr::high_res_timer_now_perfmon(); } void block_detail::stop_perf_counters(int noutput_items, int nproduced) { - d_end_of_work = gr::high_res_timer_now(); + d_end_of_work = gr::high_res_timer_now_perfmon(); gr::high_res_timer_type diff = d_end_of_work - d_start_of_work; if(d_pc_counter == 0) { |