Skip to content
Snippets Groups Projects
Commit 92b89b2a authored by Christoph Pohl's avatar Christoph Pohl Committed by ARMAR-DE
Browse files

improve armarx::rtNow to use CLOCK_MONOTONIC_RAW

Signed-off-by: ARMAR-DE <>
parent 6884e491
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ namespace armarx ...@@ -40,7 +40,7 @@ namespace armarx
{ {
using namespace rt_timing::constants; using namespace rt_timing::constants;
struct timespec ts; struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
return IceUtil::Time::microSeconds(ts.tv_sec * seconds2MicroSeconds + return IceUtil::Time::microSeconds(ts.tv_sec * seconds2MicroSeconds +
ts.tv_nsec / nanoSeconds2MicroSeconds); ts.tv_nsec / nanoSeconds2MicroSeconds);
} }
...@@ -50,9 +50,8 @@ namespace armarx ...@@ -50,9 +50,8 @@ namespace armarx
//! \ingroup VirtualTime //! \ingroup VirtualTime
//! Prints duration with comment in front of it, yet only once per second. //! Prints duration with comment in front of it, yet only once per second.
#define RT_TIMING_END_COMMENT(name, comment) \ #define RT_TIMING_END_COMMENT(name, comment) \
ARMARX_RT_LOGF_INFO( \ printf( \
"%s - duration: %.3f ms", comment, (armarx::rtNow() - name).toMilliSecondsDouble()) \ "%s - duration: %.3f ms \n", comment, (armarx::rtNow() - name).toMilliSecondsDouble());
.deactivateSpam(1);
//! \ingroup VirtualTime //! \ingroup VirtualTime
//! Prints duration //! Prints duration
#define RT_TIMING_END(name) RT_TIMING_END_COMMENT(name, #name) #define RT_TIMING_END(name) RT_TIMING_END_COMMENT(name, #name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment