Index: /trunk/src/VBox/VMM/VMMR3/STAM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/STAM.cpp	(revision 80650)
+++ /trunk/src/VBox/VMM/VMMR3/STAM.cpp	(revision 80651)
@@ -141,7 +141,5 @@
 *   Internal Functions                                                                                                           *
 *********************************************************************************************************************************/
-#ifdef STAM_WITH_LOOKUP_TREE
 static void                 stamR3LookupDestroyTree(PSTAMLOOKUP pRoot);
-#endif
 static int                  stamR3RegisterU(PUVM pUVM, void *pvSample, PFNSTAMR3CALLBACKRESET pfnReset,
                                             PFNSTAMR3CALLBACKPRINT pfnPrint, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
@@ -289,5 +287,4 @@
     RTListInit(&pUVM->stam.s.List);
 
-#ifdef STAM_WITH_LOOKUP_TREE
     /*
      * Initialize the root node.
@@ -311,6 +308,4 @@
 
     pUVM->stam.s.pRoot = pRoot;
-#endif
-
 
     /*
@@ -349,14 +344,10 @@
     RTListForEachSafe(&pUVM->stam.s.List, pCur, pNext, STAMDESC, ListEntry)
     {
-#ifdef STAM_WITH_LOOKUP_TREE
         pCur->pLookup->pDesc = NULL;
-#endif
         RTMemFree(pCur);
     }
 
-#ifdef STAM_WITH_LOOKUP_TREE
     stamR3LookupDestroyTree(pUVM->stam.s.pRoot);
     pUVM->stam.s.pRoot = NULL;
-#endif
 
     Assert(pUVM->stam.s.RWSem != NIL_RTSEMRW);
@@ -674,6 +665,4 @@
 #endif /* VBOX_STRICT */
 
-
-#ifdef STAM_WITH_LOOKUP_TREE
 
 /**
@@ -1451,7 +1440,4 @@
 }
 
-#endif /* STAM_WITH_LOOKUP_TREE */
-
-
 
 /**
@@ -1488,5 +1474,4 @@
      * Look up the tree location, populating the lookup tree as we walk it.
      */
-#ifdef STAM_WITH_LOOKUP_TREE
     PSTAMLOOKUP pLookup = pUVM->stam.s.pRoot; Assert(pLookup);
     uint32_t    offName = 1;
@@ -1531,22 +1516,4 @@
 
     PSTAMDESC pCur = stamR3LookupFindNextWithDesc(pLookup);
-
-#else
-    PSTAMDESC pCur;
-    RTListForEach(&pUVM->stam.s.List, pCur, STAMDESC, ListEntry)
-    {
-        int iDiff = strcmp(pCur->pszName, pszName);
-        /* passed it */
-        if (iDiff > 0)
-            break;
-        /* found it. */
-        if (!iDiff)
-        {
-            STAM_UNLOCK_WR(pUVM);
-            AssertMsgFailed(("Duplicate sample name: %s\n", pszName));
-            return VERR_ALREADY_EXISTS;
-        }
-    }
-#endif
 
     /*
@@ -1645,9 +1612,7 @@
             RTListAppend(&pUVM->stam.s.List, &pNew->ListEntry);
 
-#ifdef STAM_WITH_LOOKUP_TREE
         pNew->pLookup       = pLookup;
         pLookup->pDesc      = pNew;
         stamR3LookupIncUsage(pLookup);
-#endif
 
         stamR3ResetOne(pNew, pUVM->pVM);
@@ -1671,9 +1636,7 @@
 {
     RTListNodeRemove(&pCur->ListEntry);
-#ifdef STAM_WITH_LOOKUP_TREE
     pCur->pLookup->pDesc = NULL; /** @todo free lookup nodes once it's working. */
     stamR3LookupDecUsage(pCur->pLookup);
     stamR3LookupMaybeFree(pCur->pLookup);
-#endif
     RTMemFree(pCur);
 
@@ -2851,5 +2814,5 @@
  * @param   pUVM            Pointer to the user mode VM structure.
  * @param   pszPat          Pattern.
- * @param   fUpdateRing0    Update the ring-0 .
+ * @param   fUpdateRing0    Update the stats residing in ring-0.
  * @param   pfnCallback     Callback function which shall be called for matching nodes.
  *                          If it returns anything but VINF_SUCCESS the enumeration is
@@ -2860,12 +2823,15 @@
                        int (*pfnCallback)(PSTAMDESC pDesc, void *pvArg), void *pvArg)
 {
-    int         rc                = VINF_SUCCESS;
-    uint64_t    bmRefreshedGroups = 0;
-    PSTAMDESC   pCur;
+    size_t const cchPat            = pszPat ? strlen(pszPat) : 0;
+    int          rc                = VINF_SUCCESS;
+    uint64_t     bmRefreshedGroups = 0;
+    PSTAMDESC    pCur;
 
     /*
      * All.
      */
-    if (!pszPat || !*pszPat || !strcmp(pszPat, "*"))
+    if (   cchPat < 1
+        || (   cchPat == 1
+            && *pszPat == '*'))
     {
         STAM_LOCK_RD(pUVM);
@@ -2884,11 +2850,10 @@
      * Single expression pattern.
      */
-    else if (!strchr(pszPat, '|'))
-    {
-        STAM_LOCK_RD(pUVM);
-#ifdef STAM_WITH_LOOKUP_TREE
-        size_t const cchPat      = strlen(pszPat);
+    else if (memchr(pszPat, '|', cchPat) == NULL)
+    {
         const char  *pszAsterisk = (const char *)memchr(pszPat, '*',  cchPat);
         const char  *pszQuestion = (const char *)memchr(pszPat, '?',  cchPat);
+
+        STAM_LOCK_RD(pUVM);
         if (!pszAsterisk && !pszQuestion)
         {
@@ -2955,17 +2920,4 @@
                 Assert(!pLast);
         }
-#else
-        RTListForEach(&pUVM->stam.s.List, pCur, STAMDESC, ListEntry)
-        {
-            if (RTStrSimplePatternMatch(pszPat, pCur->pszName))
-            {
-                if (fUpdateRing0)
-                    stamR3Refresh(pUVM, pCur, &bmRefreshedGroups);
-                rc = pfnCallback(pCur, pvArg);
-                if (rc)
-                    break;
-            }
-        }
-#endif
         STAM_UNLOCK_RD(pUVM);
     }
Index: /trunk/src/VBox/VMM/include/STAMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/STAMInternal.h	(revision 80650)
+++ /trunk/src/VBox/VMM/include/STAMInternal.h	(revision 80651)
@@ -39,9 +39,4 @@
  * @{
  */
-
-/** Enables the lookup tree.
- * This is an optimization for speeding up registration as well as query. */
-#define STAM_WITH_LOOKUP_TREE
-
 
 /** Pointer to sample descriptor. */
