Skip to content

Commit

Permalink
zmq::clock_t : return correct value in rdtsc() on solaris
Browse files Browse the repository at this point in the history
Function clock_t::rdtsc() now returns correct value when compiled
with sunstudio 12 compiler.

Signed-off-by: Martin Pales <m.pales@gmail.com>
  • Loading branch information
martinpales authored and sustrik committed Oct 14, 2010
1 parent b7386f5 commit 03a18c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 03a18c2

Please sign in to comment.