Index: trunk/src/VBox/Devices/Audio/DrvAudio.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 76725)
+++ trunk/src/VBox/Devices/Audio/DrvAudio.cpp	(revision 76726)
@@ -695,29 +695,33 @@
     if (pCfgGuest->enmDir == PDMAUDIODIR_IN)
     {
-        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/BytesElapsed", pStream->szName);
-        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.BytesElapsed,
-                                  szStatName, STAMUNIT_BYTES, "Elapsed bytes read.");
-
-        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/BytesRead", pStream->szName);
-        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.BytesTotalRead,
-                                  szStatName, STAMUNIT_BYTES, "Total bytes read.");
-
-        RTStrPrintf(szStatName, sizeof(szStatName), "Host/%s/FramesCaptured", pStream->szName);
-        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.FramesCaptured,
-                                  szStatName, STAMUNIT_COUNT, "Total frames captured.");
+        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesCaptured", pStream->szName);
+        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.TotalFramesCaptured,
+                                  szStatName, STAMUNIT_COUNT, "Total frames played.");
+        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesCaptured", pStream->szName);
+        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.TotalTimesCaptured,
+                                  szStatName, STAMUNIT_COUNT, "Total number of playbacks.");
+        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesRead", pStream->szName);
+        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.TotalFramesRead,
+                                  szStatName, STAMUNIT_COUNT, "Total frames read.");
+        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesRead", pStream->szName);
+        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.TotalTimesRead,
+                                  szStatName, STAMUNIT_COUNT, "Total number of reads.");
     }
     else if (pCfgGuest->enmDir == PDMAUDIODIR_OUT)
     {
-        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/BytesElapsed", pStream->szName);
-        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.BytesElapsed,
-                                  szStatName, STAMUNIT_BYTES, "Elapsed bytes written.");
-
-        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/BytesWritten", pStream->szName);
-        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.BytesTotalWritten,
-                                  szStatName, STAMUNIT_BYTES, "Total bytes written.");
-
-        RTStrPrintf(szStatName, sizeof(szStatName), "Host/%s/FramesPlayed", pStream->szName);
-        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.FramesPlayed,
+        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesPlayed", pStream->szName);
+        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.TotalFramesPlayed,
                                   szStatName, STAMUNIT_COUNT, "Total frames played.");
+
+        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesPlayed", pStream->szName);
+        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.TotalTimesPlayed,
+                                  szStatName, STAMUNIT_COUNT, "Total number of playbacks.");
+        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesWritten", pStream->szName);
+        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.TotalFramesWritten,
+                                  szStatName, STAMUNIT_COUNT, "Total frames written.");
+
+        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesWritten", pStream->szName);
+        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.TotalTimesWritten,
+                                  szStatName, STAMUNIT_COUNT, "Total number of writes.");
     }
     else
@@ -874,13 +878,15 @@
     if (pStream->enmDir == PDMAUDIODIR_IN)
     {
-        STAM_COUNTER_RESET(&pStream->In.Stats.BytesElapsed);
-        STAM_COUNTER_RESET(&pStream->In.Stats.BytesTotalRead);
-        STAM_COUNTER_RESET(&pStream->In.Stats.FramesCaptured);
+        STAM_COUNTER_RESET(&pStream->In.Stats.TotalFramesCaptured);
+        STAM_COUNTER_RESET(&pStream->In.Stats.TotalFramesRead);
+        STAM_COUNTER_RESET(&pStream->In.Stats.TotalTimesCaptured);
+        STAM_COUNTER_RESET(&pStream->In.Stats.TotalTimesRead);
     }
     else if (pStream->enmDir == PDMAUDIODIR_OUT)
     {
-        STAM_COUNTER_RESET(&pStream->Out.Stats.BytesElapsed);
-        STAM_COUNTER_RESET(&pStream->Out.Stats.BytesTotalWritten);
-        STAM_COUNTER_RESET(&pStream->Out.Stats.FramesPlayed);
+        STAM_COUNTER_RESET(&pStream->Out.Stats.TotalFramesPlayed);
+        STAM_COUNTER_RESET(&pStream->Out.Stats.TotalFramesWritten);
+        STAM_COUNTER_RESET(&pStream->Out.Stats.TotalTimesPlayed);
+        STAM_COUNTER_RESET(&pStream->Out.Stats.TotalTimesWritten);
     }
     else
@@ -975,7 +981,4 @@
             DrvAudioHlpFileWrite(pStream->Out.Dbg.pFileStreamWrite, pvBuf, cbToWrite, 0 /* fFlags */);
 
-#ifdef VBOX_WITH_STATISTICS
-        STAM_COUNTER_ADD(&pThis->Stats.TotalFramesWritten, cfGstWritten);
-#endif
         uint32_t cfGstMixed = 0;
         if (cfGstWritten)
@@ -996,7 +999,4 @@
 
                 pStream->tsLastReadWrittenNs = RTTimeNanoTS();
-#ifdef DEBUG
-                pStream->Out.Dbg.cfWrittenSinceLastPlay += AUDIOMIXBUF_F2F_RATIO(&pStream->Guest.MixBuf, cfGstMixed);
-#endif
                 /* Keep going. */
             }
@@ -1008,9 +1008,12 @@
 
 #ifdef VBOX_WITH_STATISTICS
-            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesMixedOut,     cfGstMixed);
+            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesWritten,  cfGstWritten);
+            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesMixedOut, cfGstMixed);
             Assert(cfGstWritten >= cfGstMixed);
-            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesLostOut,      cfGstWritten - cfGstMixed);
-            STAM_COUNTER_ADD(&pThis->Stats.TotalBytesWritten,       cbWrittenTotal);
-            STAM_COUNTER_ADD(&pStream->Out.Stats.BytesTotalWritten, cbWrittenTotal);
+            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesLostOut,  cfGstWritten - cfGstMixed);
+            STAM_COUNTER_ADD(&pThis->Stats.TotalBytesWritten,   cbWrittenTotal);
+
+            STAM_COUNTER_ADD(&pStream->Out.Stats.TotalFramesWritten, cfGstWritten);
+            STAM_COUNTER_INC(&pStream->Out.Stats.TotalTimesWritten);
 #endif
         }
@@ -1547,10 +1550,4 @@
 
                 pStream->tsLastPlayedCapturedNs = RTTimeNanoTS();
-#ifdef DEBUG
-                Log3Func(("[%s] Dbg: cfWrittenSinceLastPlay=%RU64 (%RU64ms)\n",
-                          pStream->szName,
-                          pStream->Out.Dbg.cfWrittenSinceLastPlay, DrvAudioHlpFramesToMilli(pStream->Out.Dbg.cfWrittenSinceLastPlay, &pStream->Host.Cfg.Props)));
-                pStream->Out.Dbg.cfWrittenSinceLastPlay = 0;
-#endif
             }
 
@@ -1576,5 +1573,7 @@
             STAM_COUNTER_ADD     (&pThis->Stats.TotalFramesOut, cfPlayedTotal);
             STAM_PROFILE_ADV_STOP(&pThis->Stats.DelayOut, out);
-            STAM_COUNTER_ADD     (&pStream->Out.Stats.FramesPlayed, cfPlayedTotal);
+
+            STAM_COUNTER_ADD     (&pStream->Out.Stats.TotalFramesPlayed, cfPlayedTotal);
+            STAM_COUNTER_INC     (&pStream->Out.Stats.TotalTimesPlayed);
 #endif
         }
@@ -1852,6 +1851,7 @@
 
 #ifdef VBOX_WITH_STATISTICS
-            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesIn,       cfCaptured);
-            STAM_COUNTER_ADD(&pStream->In.Stats.FramesCaptured, cfCaptured);
+            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesIn,            cfCaptured);
+
+            STAM_COUNTER_ADD(&pStream->In.Stats.TotalFramesCaptured, cfCaptured);
 #endif
         }
@@ -2349,6 +2349,8 @@
             const uint32_t cbRead = AUDIOMIXBUF_F2B(&pStream->Guest.MixBuf, cfRead);
 
-            STAM_COUNTER_ADD(&pThis->Stats.TotalBytesRead,      cbRead);
-            STAM_COUNTER_ADD(&pStream->In.Stats.BytesTotalRead, cbRead);
+            STAM_COUNTER_ADD(&pThis->Stats.TotalBytesRead,       cbRead);
+
+            STAM_COUNTER_ADD(&pStream->In.Stats.TotalFramesRead, cfRead);
+            STAM_COUNTER_INC(&pStream->In.Stats.TotalTimesRead);
 #endif
             Assert(cfToRead >= cfRead);
@@ -3186,7 +3188,8 @@
     {
 #ifdef VBOX_WITH_STATISTICS
-        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.BytesElapsed);
-        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.BytesTotalRead);
-        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.FramesCaptured);
+        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.TotalFramesCaptured);
+        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.TotalTimesCaptured);
+        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.TotalFramesRead);
+        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.TotalTimesRead);
 #endif
         if (pThis->In.Cfg.Dbg.fEnabled)
@@ -3202,7 +3205,8 @@
     {
 #ifdef VBOX_WITH_STATISTICS
-        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.BytesElapsed);
-        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.BytesTotalWritten);
-        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.FramesPlayed);
+        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.TotalFramesPlayed);
+        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.TotalTimesPlayed);
+        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.TotalFramesWritten);
+        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.TotalTimesWritten);
 #endif
         if (pThis->Out.Cfg.Dbg.fEnabled)
