0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-16 20:41:18 +08:00

performance enhancement

use clock_gettime if there is no instruction to get cpu tick. It will take about 10% performance enhancement in AIX 7.1.
This commit is contained in:
Laughing 2016-10-14 20:33:27 +08:00 committed by GitHub
parent b031325996
commit c5b528fdcd

View File

@ -234,6 +234,8 @@ uint64_t zmq::clock_t::rdtsc ()
asm("\tstck\t%0\n" : "=Q" (tsc) : : "cc");
return(tsc);
#else
return 0;
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (uint64_t)(ts.tv_sec) * 1000000000 + ts.tv_nsec;
#endif
}