There is query_performance_counter/query_performance_frequency functions, used by trace:
#if defined(WIN_NT)
...
#elif defined(HAVE_CLOCK_GETTIME)
// Use high-resolution clock
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) != 0)
return 0;
return static_cast<SINT64>(tp.tv_sec) * BILLION + tp.tv_nsec;
#else
// This is not safe because of possible wrapping and very imprecise
return clock();
#endif
But HAVE_CLOCK_GETTIME marco is not defined in POSIX (at least in CentOS 6.2, Mandriva 2010.2, OpenSuSE 11.1).
So trace use imprecise timer although high-resolution clock is available in http://librt.so.
Submitted by: @dmitry-starodubov
Assigned to: @dmitry-starodubov
There is query_performance_counter/query_performance_frequency functions, used by trace:
#if defined(WIN_NT)
...
#elif defined(HAVE_CLOCK_GETTIME)
// Use high-resolution clock
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) != 0)
return 0;
return static_cast<SINT64>(tp.tv_sec) * BILLION + tp.tv_nsec;
#else
// This is not safe because of possible wrapping and very imprecise
return clock();
#endif
But HAVE_CLOCK_GETTIME marco is not defined in POSIX (at least in CentOS 6.2, Mandriva 2010.2, OpenSuSE 11.1).
So trace use imprecise timer although high-resolution clock is available in http://librt.so.
I suppose to add in http://configure.in something like this:
AC_CHECK_LIB(rt, clock_gettime, XE_APPEND(-lrt, LIBS); AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
[Define this if clock_gettime works on the platform]))
Commits: 540390e
The text was updated successfully, but these errors were encountered: