summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/include/gnuradio/high_res_timer.h
diff options
context:
space:
mode:
authorTim O'Shea <tim.oshea753@gmail.com>2013-06-06 18:10:52 -0400
committerTim O'Shea <tim.oshea753@gmail.com>2013-06-06 18:10:52 -0400
commitcc073d26de6ad088f5580582b5d28d064336c530 (patch)
tree885e2d8a8b2c5675f5bafa302c90fc93a5fa5b90 /gnuradio-runtime/include/gnuradio/high_res_timer.h
parent9d90ffb56631f9a85f60d13b6e32b4a1c354ffe9 (diff)
runtime: fix for timer issue that was causing qtgui components to not plot
Diffstat (limited to 'gnuradio-runtime/include/gnuradio/high_res_timer.h')
-rw-r--r--gnuradio-runtime/include/gnuradio/high_res_timer.h21
1 files changed, 21 insertions, 0 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();
}