diff options
author | Martin Pales <m.pales@gmail.com> | 2010-10-14 16:31:58 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-10-14 16:31:58 +0200 |
commit | 03a18c27ace49cbcbb0c495e4c575c34b8f862a4 (patch) | |
tree | 8e051afac2612bed983ec28d681e5c591f46d747 /src | |
parent | b7386f5b5031b2e75fb4370069935d7f6a0eedbb (diff) |
zmq::clock_t : return correct value in rdtsc() on solaris
Function clock_t::rdtsc() now returns correct value when compiled
with sunstudio 12 compiler.
Signed-off-by: Martin Pales <m.pales@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/clock.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/clock.cpp b/src/clock.cpp index 8eb5fd8..2fa23d0 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -94,6 +94,14 @@ uint64_t zmq::clock_t::rdtsc () uint32_t low, high; __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high)); return (uint64_t) high << 32 | low; +#elif (defined __SUNPRO_CC && (__SUNPRO_CC >= 0x5100) && (defined __i386 || \ + defined __amd64 || defined __x86_64)) + union { + uint64_t u64val; + uint32_t u32val [2]; + } tsc; + asm("rdtsc" : "=a" (tsc.u32val [0]), "=d" (tsc.u32val [1])); + return tsc.u64val; #else return 0; #endif |