diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-02-23 16:53:13 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-02-23 16:53:13 +0000 |
commit | 5dea92890e2082a35e9fafa6ec8aff55f96651cc (patch) | |
tree | 6d1031dcf5325a861498aa51bc9692b884fb556a | |
parent | bded654ecb810bd559783b971b2abe71f83a1891 (diff) | |
download | ATCD-5dea92890e2082a35e9fafa6ec8aff55f96651cc.tar.gz |
use local variables in ACE_OS::gethrtime () on linux
-rw-r--r-- | ace/OS.cpp | 6 | ||||
-rw-r--r-- | ace/OS.i | 13 |
2 files changed, 4 insertions, 15 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp index dffde548e8d..9ab48a4cf36 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -294,12 +294,6 @@ ACE_Countdown_Time::~ACE_Countdown_Time (void) this->stop (); } -#if defined (ACE_HAS_PENTIUM) && defined (linux) - // see comments in OS.i in ACE_OS::gethrtime () definition - unsigned long ACE_OS_gethrtime_least; - unsigned long ACE_OS_gethrtime_most; -#endif /* ACE_HAS_PENTIUM && linux */ - #if defined(ACE_MT_SAFE) && defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) int ACE_OS::netdb_mutex_inited_ = 0; @@ -5771,18 +5771,13 @@ ACE_OS::gethrtime (void) #elif defined (ACE_HAS_PENTIUM) && defined (linux) // see comments for ACE_HAS_PENTIUM below - // These are declared in OS.cpp. The easiest way to interface - // with the assembly instructions is via these two global variables. - // No, it's not thread safe. If someone knows how to do this with - // local variables, that would be _much_ better! - extern unsigned long ACE_OS_gethrtime_least; - extern unsigned long ACE_OS_gethrtime_most; + unsigned long least, most; asm ("rdtsc"); - asm ("movl %eax, ACE_OS_gethrtime_least"); - asm ("movl %edx, ACE_OS_gethrtime_most"); + asm ("movl %eax, -4(%ebp)"); // least + asm ("movl %edx, -8(%ebp)"); // most - return ACE_OS_gethrtime_most << 32 | ACE_OS_gethrtime_least; + return (unsigned long long) most << 32 | least; #elif defined (ACE_HAS_PENTIUM) // for WIN32 only . . . // Issue the RDTSC assembler instruction to get the number of clock |