]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: improved MXUser acquisition statistics
authorVMware, Inc <>
Mon, 26 Jul 2010 18:09:20 +0000 (11:09 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 26 Jul 2010 18:09:20 +0000 (11:09 -0700)
We can now see the data from try operations (including timed ones)
and semaphores.

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/ulRec.c
open-vm-tools/lib/lock/ulSema.c

index edf8eeb547734f6fa465b061970201cc9f40e048..6cc68ae3b883f2512d9e9983ece2c73fc6599d58 100644 (file)
@@ -405,11 +405,11 @@ MXUser_TryAcquireExclLock(MXUserExclLock *lock)  // IN/OUT:
                             "%s: Acquire on an acquired exclusive lock\n",
                             __FUNCTION__);
       }
+   }
 
 #if defined(MXUSER_STATS)
-      MXUserAcquisitionSample(&lock->acquisitionStats, success, FALSE, 0ULL);
+   MXUserAcquisitionSample(&lock->acquisitionStats, success, !success, 0ULL);
 #endif
-   }
 
    return success;
 }
index d7a10cd973a08536e1cada4771ef9cb7a93cb1fc..083d8e2015359a8044ceda377f48bab7657060b3 100644 (file)
@@ -487,10 +487,11 @@ typedef struct {
 } MXUserBasicStats;
 
 typedef struct {
-   uint64            numContended;     // Number of contended acquires
-   uint64            timeContended;    // Time spent contended on acquires
-   uint64            numUncontended;   // Number of uncontended acquires
-   uint64            timeUncontended;  // Time spent uncontended on acquires
+   uint64            numAttempts;
+   uint64            numSuccesses;
+   uint64            numSuccessesContended;
+   uint64            successContentionTime;
+   uint64            totalContentionTime;
 
    MXUserBasicStats  basicStats;
 } MXUserAcquisitionStats;
index 71c68cfceab190fca21eaaef829e68cda035c956..9f4406e92082d0dc12d74fdf97cd111c99f74405 100644 (file)
@@ -431,15 +431,13 @@ MXUser_TryAcquireRecLock(MXUserRecLock *lock)  // IN/OUT:
       success = MXRecLockTryAcquire(&lock->recursiveLock, GetReturnAddress());
 
       if (success) {
-#if defined(MXUSER_STATS)
-         if (MXRecLockCount(&lock->recursiveLock) == 1) {
-            MXUserAcquisitionSample(&lock->acquisitionStats, success, FALSE,
-                                    0ULL);
-         }
-#endif
-
          MXUserAcquisitionTracking(&lock->header, FALSE);
       }
+
+#if defined(MXUSER_STATS)
+      MXUserAcquisitionSample(&lock->acquisitionStats, success,
+                              !success, 0ULL);
+#endif
    }
 
    return success;
index edabc98a10e3fba185165315829ec56aacb3ef38..e063a7a15e7e683f4b31265cfd6f23a9c8446df7 100644 (file)
@@ -770,6 +770,11 @@ MXUser_TryDownSemaphore(MXUserSemaphore *sema)  // IN/OUT:
                          __FUNCTION__, err);
    }
 
+#if defined(MXUSER_STATS)
+   MXUserAcquisitionSample(&sema->acquisitionStats, downOccurred,
+                           !downOccurred, 0ULL);
+#endif
+
    Atomic_Dec(&sema->activeUserCount);
 
    return downOccurred;
@@ -782,7 +787,7 @@ MXUser_TryDownSemaphore(MXUserSemaphore *sema)  // IN/OUT:
  * MXUser_UpSemaphore --
  *
  *      Perform an up (V; verhogen; "increase") operation on a semaphore.
- *
+ * 
  * Results:
  *      The semaphore count is incremented. Any thread waiting on the
  *      semaphore is awoken.