28 #include <IceUtil/Time.h>
32 namespace rt_timing::constants
36 static constexpr
const std::int64_t nanoSeconds2MicroSeconds = 1000;
42 using namespace rt_timing::constants;
44 clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
46 ts.tv_nsec / nanoSeconds2MicroSeconds);
50 #define RT_TIMING_START(name) auto name = armarx::rtNow();
53 #define RT_TIMING_END_COMMENT(name, comment) \
54 printf("%s - duration: %.3f ms \n", comment, (armarx::rtNow() - name).toMilliSecondsDouble());
57 #define RT_TIMING_END(name) RT_TIMING_END_COMMENT(name, #name)
60 #define RT_TIMING_CEND_COMMENT(name, comment, thresholdMs) \
61 if ((armarx::rtNow() - name).toMilliSecondsDouble() >= thresholdMs) \
62 RT_TIMING_END_COMMENT(name, comment)
65 #define RT_TIMING_CEND(name, thresholdMs) RT_TIMING_CEND_COMMENT(name, #name, thresholdMs)