Index: /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp	(revision 82377)
+++ /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp	(revision 82378)
@@ -57,4 +57,5 @@
 VMMDECL(VBOXSTRICTRC) IOMIOPortRead(PVMCC pVM, PVMCPU pVCpu, RTIOPORT Port, uint32_t *pu32Value, size_t cbValue)
 {
+    STAM_COUNTER_INC(&pVM->iom.s.StatIoPortIn);
     Assert(pVCpu->iom.s.PendingIOPortWrite.cbValue == 0);
 
@@ -115,24 +116,28 @@
             PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
 
-            if (rcStrict == VINF_SUCCESS)
+#ifndef IN_RING3
+            if (rcStrict == VINF_IOM_R3_IOPORT_READ)
+                STAM_COUNTER_INC(&pStats->InRZToR3);
+            else
+#endif
+            {
                 STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In));
-#ifndef IN_RING3
-            else if (rcStrict == VINF_IOM_R3_IOPORT_READ)
-                STAM_COUNTER_INC(&pStats->InRZToR3);
-#endif
-            else if (rcStrict == VERR_IOM_IOPORT_UNUSED)
-            {
-                /* make return value */
-                rcStrict = VINF_SUCCESS;
-                switch (cbValue)
+                STAM_COUNTER_INC(&iomIoPortGetStats(pVM, pRegEntry, 0)->Total);
+                if (rcStrict == VERR_IOM_IOPORT_UNUSED)
                 {
-                    case 1: *(uint8_t  *)pu32Value = 0xff; break;
-                    case 2: *(uint16_t *)pu32Value = 0xffff; break;
-                    case 4: *(uint32_t *)pu32Value = UINT32_C(0xffffffff); break;
-                    default:
-                        AssertMsgFailedReturn(("Invalid I/O port size %d. Port=%d\n", cbValue, Port), VERR_IOM_INVALID_IOPORT_SIZE);
+                    /* make return value */
+                    rcStrict = VINF_SUCCESS;
+                    switch (cbValue)
+                    {
+                        case 1: *(uint8_t  *)pu32Value = 0xff; break;
+                        case 2: *(uint16_t *)pu32Value = 0xffff; break;
+                        case 4: *(uint32_t *)pu32Value = UINT32_C(0xffffffff); break;
+                        default:
+                            AssertMsgFailedReturn(("Invalid I/O port size %d. Port=%d\n", cbValue, Port), VERR_IOM_INVALID_IOPORT_SIZE);
+                    }
                 }
-            }
+           }
             Log3(("IOMIOPortRead: Port=%RTiop *pu32=%08RX32 cb=%d rc=%Rrc\n", Port, *pu32Value, cbValue, VBOXSTRICTRC_VAL(rcStrict)));
+            STAM_COUNTER_INC(&iomIoPortGetStats(pVM, pRegEntry, 0)->Total);
         }
         else
@@ -179,4 +184,5 @@
                                                void *pvDst, uint32_t *pcTransfers, unsigned cb)
 {
+    STAM_COUNTER_INC(&pVM->iom.s.StatIoPortInS);
     Assert(pVCpu->iom.s.PendingIOPortWrite.cbValue == 0);
 
@@ -279,10 +285,13 @@
 
 #ifdef VBOX_WITH_STATISTICS
-            if (rcStrict == VINF_SUCCESS && pStats)
+# ifndef IN_RING3
+            if (rcStrict == VINF_IOM_R3_IOPORT_READ)
+                STAM_COUNTER_INC(&pStats->InRZToR3);
+            else
+# endif
+            {
                 STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In));
-# ifndef IN_RING3
-            else if (rcStrict == VINF_IOM_R3_IOPORT_READ && pStats)
-                STAM_COUNTER_INC(&pStats->InRZToR3);
-# endif
+                STAM_COUNTER_INC(&iomIoPortGetStats(pVM, pRegEntry, 0)->Total);
+            }
 #endif
             Log3(("IOMIOPortReadStr: uPort=%RTiop pvDst=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=%Rrc\n",
@@ -349,4 +358,5 @@
 VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVMCC pVM, PVMCPU pVCpu, RTIOPORT Port, uint32_t u32Value, size_t cbValue)
 {
+    STAM_COUNTER_INC(&pVM->iom.s.StatIoPortOut);
 #ifndef IN_RING3
     Assert(pVCpu->iom.s.PendingIOPortWrite.cbValue == 0);
@@ -408,6 +418,11 @@
 
 #ifdef VBOX_WITH_STATISTICS
-            if (rcStrict == VINF_SUCCESS)
+# ifndef IN_RING3
+            if (rcStrict != VINF_IOM_R3_IOPORT_WRITE)
+# endif
+            {
                 STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out));
+                STAM_COUNTER_INC(&iomIoPortGetStats(pVM, pRegEntry, 0)->Total);
+            }
 #endif
             Log3(("IOMIOPortWrite: Port=%RTiop u32=%08RX32 cb=%d rc=%Rrc\n", Port, u32Value, cbValue, VBOXSTRICTRC_VAL(rcStrict)));
@@ -454,4 +469,5 @@
                                                 uint32_t *pcTransfers, unsigned cb)
 {
+    STAM_COUNTER_INC(&pVM->iom.s.StatIoPortOutS);
     Assert(pVCpu->iom.s.PendingIOPortWrite.cbValue == 0);
     Assert(cb == 1 || cb == 2 || cb == 4);
@@ -549,10 +565,13 @@
 
 #ifdef VBOX_WITH_STATISTICS
-            if (rcStrict == VINF_SUCCESS)
+# ifndef IN_RING3
+            if (rcStrict == VINF_IOM_R3_IOPORT_WRITE)
+                STAM_COUNTER_INC(&pStats->OutRZToR3);
+            else
+# endif
+            {
                 STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out));
-# ifndef IN_RING3
-            else if (rcStrict == VINF_IOM_R3_IOPORT_WRITE)
-                STAM_COUNTER_INC(&pStats->OutRZToR3);
-# endif
+                STAM_COUNTER_INC(&iomIoPortGetStats(pVM, pRegEntry, 0)->Total);
+            }
 #endif
             Log3(("IOMIOPortWriteStr: uPort=%RTiop pvSrc=%p pcTransfer=%p:{%#x->%#x} cb=%d rcStrict=%Rrc\n",
Index: /trunk/src/VBox/VMM/VMMR3/IOM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/IOM.cpp	(revision 82377)
+++ /trunk/src/VBox/VMM/VMMR3/IOM.cpp	(revision 82378)
@@ -176,4 +176,8 @@
      */
     STAM_REG(pVM, &pVM->iom.s.StatIoPortCommits,      STAMTYPE_COUNTER, "/IOM/IoPortCommits",                       STAMUNIT_OCCURENCES,     "Number of ring-3 I/O port commits.");
+    STAM_REG(pVM, &pVM->iom.s.StatIoPortIn,           STAMTYPE_PROFILE, "/IOM/IoPortIN",                            STAMUNIT_OCCURENCES,     "Number of IN instructions (attempts)");
+    STAM_REG(pVM, &pVM->iom.s.StatIoPortInS,          STAMTYPE_PROFILE, "/IOM/IoPortINS",                           STAMUNIT_OCCURENCES,     "Number of INS instructions (attempts)");
+    STAM_REG(pVM, &pVM->iom.s.StatIoPortOutS,         STAMTYPE_PROFILE, "/IOM/IoPortOUT",                           STAMUNIT_OCCURENCES,     "Number of OUT instructions (attempts)");
+    STAM_REG(pVM, &pVM->iom.s.StatIoPortOutS,         STAMTYPE_PROFILE, "/IOM/IoPortOUTS",                          STAMUNIT_OCCURENCES,     "Number of OUTS instructions (attempts)");
 
     STAM_REL_REG(pVM, &pVM->iom.s.StatMMIOStaleMappings, STAMTYPE_PROFILE, "/IOM/MMIOStaleMappings",                STAMUNIT_TICKS_PER_CALL, "Number of times iomMmioHandlerNew got a call for a remapped range at the old mapping.");
Index: /trunk/src/VBox/VMM/VMMR3/IOMR3IoPort.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/IOMR3IoPort.cpp	(revision 82377)
+++ /trunk/src/VBox/VMM/VMMR3/IOMR3IoPort.cpp	(revision 82378)
@@ -58,12 +58,12 @@
     size_t cchPrefix;
     if (uFirstPort < uEndPort - 1)
-        cchPrefix = RTStrPrintf(szName, sizeof(szName), "/IOM/NewPorts/%04x-%04x", uFirstPort, uEndPort - 1);
+        cchPrefix = RTStrPrintf(szName, sizeof(szName), "/IOM/IoPorts/%04x-%04x", uFirstPort, uEndPort - 1);
     else
-        cchPrefix = RTStrPrintf(szName, sizeof(szName), "/IOM/NewPorts/%04x", uPort);
+        cchPrefix = RTStrPrintf(szName, sizeof(szName), "/IOM/IoPorts/%04x", uPort);
     const char *pszDesc     = pRegEntry->pszDesc;
     char       *pszFreeDesc = NULL;
     if (pRegEntry->pDevIns && pRegEntry->pDevIns->iInstance > 0 && pszDesc)
         pszDesc = pszFreeDesc = RTStrAPrintf2("%u / %s", pRegEntry->pDevIns->iInstance, pszDesc);
-    int rc = STAMR3Register(pVM, &pRegEntry->idxSelf, STAMTYPE_U16, STAMVISIBILITY_ALWAYS, szName,
+    int rc = STAMR3Register(pVM, &pStats->Total, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, szName,
                             STAMUNIT_NONE, pRegEntry->pszDesc);
     AssertRC(rc);
@@ -132,7 +132,7 @@
     size_t cchPrefix;
     if (pRegEntry->cPorts > 1)
-        cchPrefix = RTStrPrintf(szPrefix, sizeof(szPrefix), "/IOM/NewPorts/%04x-%04x", uPort, uPort + pRegEntry->cPorts - 1);
+        cchPrefix = RTStrPrintf(szPrefix, sizeof(szPrefix), "/IOM/IoPorts/%04x-%04x", uPort, uPort + pRegEntry->cPorts - 1);
     else
-        cchPrefix = RTStrPrintf(szPrefix, sizeof(szPrefix), "/IOM/NewPorts/%04x", uPort);
+        cchPrefix = RTStrPrintf(szPrefix, sizeof(szPrefix), "/IOM/IoPorts/%04x", uPort);
     STAMR3DeregisterByPrefix(pVM->pUVM, szPrefix);
 }
Index: /trunk/src/VBox/VMM/include/IOMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/IOMInternal.h	(revision 82377)
+++ /trunk/src/VBox/VMM/include/IOMInternal.h	(revision 82378)
@@ -148,4 +148,7 @@
 typedef struct IOMIOPORTSTATSENTRY
 {
+    /** All accesses (only updated for the first port in a range). */
+    STAMCOUNTER                 Total;
+
     /** Number of INs to this port from R3. */
     STAMCOUNTER                 InR3;
@@ -447,13 +450,11 @@
 #endif
 
-#if 0 /* unused */
     /** @name I/O Port statistics.
      * @{ */
-    STAMCOUNTER                     StatInstIn;
-    STAMCOUNTER                     StatInstOut;
-    STAMCOUNTER                     StatInstIns;
-    STAMCOUNTER                     StatInstOuts;
+    STAMCOUNTER                     StatIoPortIn;
+    STAMCOUNTER                     StatIoPortOut;
+    STAMCOUNTER                     StatIoPortInS;
+    STAMCOUNTER                     StatIoPortOutS;
     /** @} */
-#endif
 
     /** @name MMIO statistics.
