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

Minor improvements for RtTiming

Signed-off-by: ARMAR-DE <>
parent abe54c44
No related branches found
No related tags found
No related merge requests found
......@@ -24,18 +24,25 @@
#pragma once
#include <chrono>
//#include <ArmarXCore/core/time/TimeUtil.h>
#include "ControlThreadOutputBuffer.h"
namespace armarx
{
namespace rt_timing::constants
{
inline constexpr const std::int64_t seconds2MicroSeconds = 1e6;
static constexpr const std::int64_t nanoSeconds2MicroSeconds = 1000;
} // namespace rt_timing::constants
inline IceUtil::Time
rtNow()
{
using namespace rt_timing::constants;
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return IceUtil::Time::microSeconds(ts.tv_sec * 1e6 + ts.tv_nsec / 1000);
return IceUtil::Time::microSeconds(ts.tv_sec * seconds2MicroSeconds +
ts.tv_nsec / nanoSeconds2MicroSeconds);
}
} // namespace armarx
......@@ -52,7 +59,7 @@ namespace armarx
//! \ingroup VirtualTime
//! Prints duration with comment in front of it if it took longer than threshold
#define RT_TIMING_CEND_COMMENT(name, comment, thresholdMs) \
if ((armarx::rtNow() - name).toMilliSeconds() >= thresholdMs) \
if ((armarx::rtNow() - name).toMilliSecondsDouble() >= thresholdMs) \
RT_TIMING_END_COMMENT(name, comment)
//! \ingroup VirtualTime
//! Prints duration if it took longer than thresholdMs
......
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