]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: report MXUserSemaphore timed wait success/failure
authorVMware, Inc <>
Mon, 26 Jul 2010 18:11:20 +0000 (11:11 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 26 Jul 2010 18:11:20 +0000 (11:11 -0700)
Only successes were being reported for statistics. We can now
properly handle success and failure reporting.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/lock/ulSema.c

index e063a7a15e7e683f4b31265cfd6f23a9c8446df7..b6698cca989a918be7df907be311132c38c3e828 100644 (file)
@@ -699,17 +699,18 @@ MXUser_TimedDownSemaphore(MXUserSemaphore *sema,  // IN/OUT:
                                   &downOccurred);
          }
 
-         if (LIKELY(err == 0) && downOccurred) {
-            MXUserHisto *histo;
+         if (LIKELY(err == 0)) {
             VmTimeType value = Hostinfo_SystemTimerNS() - begin;
 
             MXUserAcquisitionSample(&sema->acquisitionStats, downOccurred,
                                     !tryDownSuccess, value);
 
-            histo = Atomic_ReadPtr(&sema->acquisitionHisto);
+            if (downOccurred) {
+               MXUserHisto *histo = Atomic_ReadPtr(&sema->acquisitionHisto);
 
-            if (UNLIKELY(histo != NULL)) {
-               MXUserHistoSample(histo, value);
+               if (UNLIKELY(histo != NULL)) {
+                  MXUserHistoSample(histo, value);
+               }
             }
          }
       }