From: VMware, Inc <> Date: Thu, 17 Jun 2010 21:37:31 +0000 (-0700) Subject: lib/lock: use the new lock routines X-Git-Tag: 2010.06.16-268169~96 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90bf2232d5422676cd85ce87a1bafd9ec92916f2;p=thirdparty%2Fopen-vm-tools.git lib/lock: use the new lock routines Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/lock/ulExcl.c b/open-vm-tools/lib/lock/ulExcl.c index 7bc975c04..82f0ccb9b 100644 --- a/open-vm-tools/lib/lock/ulExcl.c +++ b/open-vm-tools/lib/lock/ulExcl.c @@ -279,7 +279,7 @@ MXUser_AcquireExclLock(MXUserExclLock *lock) // IN/OUT: MXUserAcquisitionTracking(&lock->header, TRUE); #if defined(MXUSER_STATS) - begin = MXUserReadTimerNS(); + begin = Hostinfo_SystemTimerNS(); contended = #endif @@ -287,7 +287,7 @@ MXUser_AcquireExclLock(MXUserExclLock *lock) // IN/OUT: MXRecLockAcquire(&lock->recursiveLock, GetReturnAddress()); #if defined(MXUSER_STATS) - value = MXUserReadTimerNS() - begin; + value = Hostinfo_SystemTimerNS() - begin; MXUserAcquisitionSample(&lock->acquisitionStats, contended, value); @@ -305,7 +305,7 @@ MXUser_AcquireExclLock(MXUserExclLock *lock) // IN/OUT: } #if defined(MXUSER_STATS) - lock->holdStart = MXUserReadTimerNS(); + lock->holdStart = Hostinfo_SystemTimerNS(); #endif } @@ -337,7 +337,7 @@ MXUser_ReleaseExclLock(MXUserExclLock *lock) // IN/OUT: ASSERT(lock && (lock->header.lockSignature == MXUSER_EXCL_SIGNATURE)); #if defined(MXUSER_STATS) - value = MXUserReadTimerNS() - lock->holdStart; + value = Hostinfo_SystemTimerNS() - lock->holdStart; MXUserBasicStatsSample(&lock->heldStats, value); @@ -400,14 +400,14 @@ MXUser_TryAcquireExclLock(MXUserExclLock *lock) // IN/OUT: } #if defined(MXUSER_STATS) - begin = MXUserReadTimerNS(); + begin = Hostinfo_SystemTimerNS(); #endif success = MXRecLockTryAcquire(&lock->recursiveLock, GetReturnAddress()); if (success) { #if defined(MXUSER_STATS) - uint64 end = MXUserReadTimerNS(); + uint64 end = Hostinfo_SystemTimerNS(); #endif MXUserAcquisitionTracking(&lock->header, FALSE); diff --git a/open-vm-tools/lib/lock/ulInt.h b/open-vm-tools/lib/lock/ulInt.h index 5d66083aa..bba7d9a77 100644 --- a/open-vm-tools/lib/lock/ulInt.h +++ b/open-vm-tools/lib/lock/ulInt.h @@ -38,6 +38,7 @@ typedef pthread_t MXThreadID; #include "vm_basic_types.h" #include "vthreadBase.h" +#include "hostinfo.h" #if defined(MXUSER_STATS) #include "circList.h" @@ -495,7 +496,6 @@ typedef struct { MXUserBasicStats basicStats; // total held statistics } MXUserReleaseStats; -uint64 MXUserReadTimerNS(void); uint32 MXUserAllocID(void); void MXUserAddToList(MXUserHeader *header); void MXUserRemoveFromList(MXUserHeader *header); diff --git a/open-vm-tools/lib/lock/ulRW.c b/open-vm-tools/lib/lock/ulRW.c index 5a57596e5..3f2d32771 100644 --- a/open-vm-tools/lib/lock/ulRW.c +++ b/open-vm-tools/lib/lock/ulRW.c @@ -622,7 +622,7 @@ MXUserAcquisition(MXUserRWLock *lock, // IN/OUT: } #if defined(MXUSER_STATS) - begin = MXUserReadTimerNS(); + begin = Hostinfo_SystemTimerNS(); #endif contended = lock->useNative ? MXUserNativeRWAcquire(&lock->nativeLock, @@ -635,7 +635,7 @@ MXUserAcquisition(MXUserRWLock *lock, // IN/OUT: } #if defined(MXUSER_STATS) - value = MXUserReadTimerNS() - begin; + value = Hostinfo_SystemTimerNS() - begin; /* The statistics are not atomically safe so protect them when necessary */ if (forRead && lock->useNative) { @@ -663,7 +663,7 @@ MXUserAcquisition(MXUserRWLock *lock, // IN/OUT: myContext->state = forRead ? RW_LOCKED_FOR_READ : RW_LOCKED_FOR_WRITE; #if defined(MXUSER_STATS) - myContext->holdStart = MXUserReadTimerNS(); + myContext->holdStart = Hostinfo_SystemTimerNS(); #endif } @@ -783,7 +783,7 @@ MXUser_ReleaseRWLock(MXUserRWLock *lock) // IN/OUT: HolderContext *myContext; #if defined(MXUSER_STATS) - uint64 holdEnd = MXUserReadTimerNS(); + uint64 holdEnd = Hostinfo_SystemTimerNS(); uint64 duration; MXUserHisto *histo; #endif diff --git a/open-vm-tools/lib/lock/ulRec.c b/open-vm-tools/lib/lock/ulRec.c index d99926630..9158a90f3 100644 --- a/open-vm-tools/lib/lock/ulRec.c +++ b/open-vm-tools/lib/lock/ulRec.c @@ -309,7 +309,7 @@ MXUser_AcquireRecLock(MXUserRecLock *lock) // IN/OUT: MXUserAcquisitionTracking(&lock->header, TRUE); #if defined(MXUSER_STATS) - begin = MXUserReadTimerNS(); + begin = Hostinfo_SystemTimerNS(); contended = #endif @@ -319,7 +319,7 @@ MXUser_AcquireRecLock(MXUserRecLock *lock) // IN/OUT: #if defined(MXUSER_STATS) if (MXRecLockCount(&lock->recursiveLock) == 1) { MXUserHisto *histo; - uint64 value = MXUserReadTimerNS() - begin; + uint64 value = Hostinfo_SystemTimerNS() - begin; MXUserAcquisitionSample(&lock->acquisitionStats, contended, value); @@ -329,7 +329,7 @@ MXUser_AcquireRecLock(MXUserRecLock *lock) // IN/OUT: MXUserHistoSample(histo, value); } - lock->holdStart = MXUserReadTimerNS(); + lock->holdStart = Hostinfo_SystemTimerNS(); } #endif } @@ -363,7 +363,7 @@ MXUser_ReleaseRecLock(MXUserRecLock *lock) // IN/OUT: } else { #if defined(MXUSER_STATS) if (MXRecLockCount(&lock->recursiveLock) == 1) { - uint64 value = MXUserReadTimerNS() - lock->holdStart; + uint64 value = Hostinfo_SystemTimerNS() - lock->holdStart; MXUserHisto *histo = Atomic_ReadPtr(&lock->heldHisto); MXUserBasicStatsSample(&lock->heldStats, value); @@ -433,7 +433,7 @@ MXUser_TryAcquireRecLock(MXUserRecLock *lock) // IN/OUT: } #if defined(MXUSER_STATS) - begin = MXUserReadTimerNS(); + begin = Hostinfo_SystemTimerNS(); #endif success = MXRecLockTryAcquire(&lock->recursiveLock, GetReturnAddress()); @@ -442,7 +442,7 @@ MXUser_TryAcquireRecLock(MXUserRecLock *lock) // IN/OUT: #if defined(MXUSER_STATS) if (MXRecLockCount(&lock->recursiveLock) == 1) { MXUserAcquisitionSample(&lock->acquisitionStats, FALSE, - MXUserReadTimerNS() - begin); + Hostinfo_SystemTimerNS() - begin); } #endif