]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: use the new lock routines
authorVMware, Inc <>
Thu, 17 Jun 2010 21:37:31 +0000 (14:37 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 17 Jun 2010 21:37:31 +0000 (14:37 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/lock/ulExcl.c
open-vm-tools/lib/lock/ulInt.h
open-vm-tools/lib/lock/ulRW.c
open-vm-tools/lib/lock/ulRec.c

index 7bc975c04fcb6ee23256f169d24cf4649c52b944..82f0ccb9be93b60c61a43dd082af3f46446eb64a 100644 (file)
@@ -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);
index 5d66083aabe9a4b4aed78b94740fc380bc68a4c9..bba7d9a775e52307c95e69c5c34eea8c6b5cf06c 100644 (file)
@@ -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);
index 5a57596e55a916dbd523550d38650a0a784aa2ac..3f2d32771f35783dc32b106a8e694a078024a698 100644 (file)
@@ -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
index d99926630dab755a6edf9d479688ac5015ee6c21..9158a90f39da36cda8ddda4cdc9897873cc04daf 100644 (file)
@@ -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