|
a/src/utils/smallut.cpp |
|
b/src/utils/smallut.cpp |
|
... |
|
... |
674 |
((TV).tv_nsec - m_nsecs) / 1000000))
|
674 |
((TV).tv_nsec - m_nsecs) / 1000000))
|
675 |
#define MICROS(TV) ( (long)(((TV).tv_sec - m_secs) * 1000000L + \
|
675 |
#define MICROS(TV) ( (long)(((TV).tv_sec - m_secs) * 1000000L + \
|
676 |
((TV).tv_nsec - m_nsecs) / 1000))
|
676 |
((TV).tv_nsec - m_nsecs) / 1000))
|
677 |
#define NANOS(TV) ( (long long)(((TV).tv_sec - m_secs) * 1000000000LL + \
|
677 |
#define NANOS(TV) ( (long long)(((TV).tv_sec - m_secs) * 1000000000LL + \
|
678 |
((TV).tv_nsec - m_nsecs)))
|
678 |
((TV).tv_nsec - m_nsecs)))
|
|
|
679 |
|
|
|
680 |
// Using clock_gettime() is nice because it gives us ns res and it helps with
|
|
|
681 |
// computing threads work times, but it's also a pita because it forces linking
|
|
|
682 |
// with -lrt. So keep it optional. And not on the mac anyway
|
|
|
683 |
// #define USE_CLOCK_GETTIME
|
|
|
684 |
|
679 |
#ifdef __APPLE__
|
685 |
#ifdef __APPLE__
|
|
|
686 |
#undef USE_CLOCK_GETTIME
|
|
|
687 |
#endif
|
|
|
688 |
|
|
|
689 |
#ifndef USE_CLOCK_GETTIME
|
680 |
#include <sys/time.h>
|
690 |
#include <sys/time.h>
|
681 |
#endif
|
691 |
#endif
|
|
|
692 |
|
682 |
static void gettime(clockid_t clk_id, struct timespec *ts)
|
693 |
static void gettime(clockid_t clk_id, struct timespec *ts)
|
683 |
{
|
694 |
{
|
684 |
#ifdef __APPLE__
|
695 |
#ifndef USE_CLOCK_GETTIME
|
685 |
struct timeval tv;
|
696 |
struct timeval tv;
|
686 |
gettimeofday(&tv, 0);
|
697 |
gettimeofday(&tv, 0);
|
687 |
ts->tv_sec = tv.tv_sec;
|
698 |
ts->tv_sec = tv.tv_sec;
|
688 |
ts->tv_nsec = tv.tv_usec * 1000;
|
699 |
ts->tv_nsec = tv.tv_usec * 1000;
|
689 |
#else
|
700 |
#else
|