VirtualBox

Changeset 76726 in vbox for trunk


Ignore:
Timestamp:
Jan 9, 2019 10:02:07 AM (6 years ago)
Author:
vboxsync
Message:

Audio/DrvAudio: More STAM stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r76708 r76726  
    695695    if (pCfgGuest->enmDir == PDMAUDIODIR_IN)
    696696    {
    697         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/BytesElapsed", pStream->szName);
    698         PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.BytesElapsed,
    699                                   szStatName, STAMUNIT_BYTES, "Elapsed bytes read.");
    700 
    701         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/BytesRead", pStream->szName);
    702         PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.BytesTotalRead,
    703                                   szStatName, STAMUNIT_BYTES, "Total bytes read.");
    704 
    705         RTStrPrintf(szStatName, sizeof(szStatName), "Host/%s/FramesCaptured", pStream->szName);
    706         PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.FramesCaptured,
    707                                   szStatName, STAMUNIT_COUNT, "Total frames captured.");
     697        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesCaptured", pStream->szName);
     698        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.TotalFramesCaptured,
     699                                  szStatName, STAMUNIT_COUNT, "Total frames played.");
     700        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesCaptured", pStream->szName);
     701        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.TotalTimesCaptured,
     702                                  szStatName, STAMUNIT_COUNT, "Total number of playbacks.");
     703        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesRead", pStream->szName);
     704        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.TotalFramesRead,
     705                                  szStatName, STAMUNIT_COUNT, "Total frames read.");
     706        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesRead", pStream->szName);
     707        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->In.Stats.TotalTimesRead,
     708                                  szStatName, STAMUNIT_COUNT, "Total number of reads.");
    708709    }
    709710    else if (pCfgGuest->enmDir == PDMAUDIODIR_OUT)
    710711    {
    711         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/BytesElapsed", pStream->szName);
    712         PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.BytesElapsed,
    713                                   szStatName, STAMUNIT_BYTES, "Elapsed bytes written.");
    714 
    715         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/BytesWritten", pStream->szName);
    716         PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.BytesTotalWritten,
    717                                   szStatName, STAMUNIT_BYTES, "Total bytes written.");
    718 
    719         RTStrPrintf(szStatName, sizeof(szStatName), "Host/%s/FramesPlayed", pStream->szName);
    720         PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.FramesPlayed,
     712        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesPlayed", pStream->szName);
     713        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.TotalFramesPlayed,
    721714                                  szStatName, STAMUNIT_COUNT, "Total frames played.");
     715
     716        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesPlayed", pStream->szName);
     717        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.TotalTimesPlayed,
     718                                  szStatName, STAMUNIT_COUNT, "Total number of playbacks.");
     719        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesWritten", pStream->szName);
     720        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.TotalFramesWritten,
     721                                  szStatName, STAMUNIT_COUNT, "Total frames written.");
     722
     723        RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesWritten", pStream->szName);
     724        PDMDrvHlpSTAMRegCounterEx(pThis->pDrvIns, &pStream->Out.Stats.TotalTimesWritten,
     725                                  szStatName, STAMUNIT_COUNT, "Total number of writes.");
    722726    }
    723727    else
     
    874878    if (pStream->enmDir == PDMAUDIODIR_IN)
    875879    {
    876         STAM_COUNTER_RESET(&pStream->In.Stats.BytesElapsed);
    877         STAM_COUNTER_RESET(&pStream->In.Stats.BytesTotalRead);
    878         STAM_COUNTER_RESET(&pStream->In.Stats.FramesCaptured);
     880        STAM_COUNTER_RESET(&pStream->In.Stats.TotalFramesCaptured);
     881        STAM_COUNTER_RESET(&pStream->In.Stats.TotalFramesRead);
     882        STAM_COUNTER_RESET(&pStream->In.Stats.TotalTimesCaptured);
     883        STAM_COUNTER_RESET(&pStream->In.Stats.TotalTimesRead);
    879884    }
    880885    else if (pStream->enmDir == PDMAUDIODIR_OUT)
    881886    {
    882         STAM_COUNTER_RESET(&pStream->Out.Stats.BytesElapsed);
    883         STAM_COUNTER_RESET(&pStream->Out.Stats.BytesTotalWritten);
    884         STAM_COUNTER_RESET(&pStream->Out.Stats.FramesPlayed);
     887        STAM_COUNTER_RESET(&pStream->Out.Stats.TotalFramesPlayed);
     888        STAM_COUNTER_RESET(&pStream->Out.Stats.TotalFramesWritten);
     889        STAM_COUNTER_RESET(&pStream->Out.Stats.TotalTimesPlayed);
     890        STAM_COUNTER_RESET(&pStream->Out.Stats.TotalTimesWritten);
    885891    }
    886892    else
     
    975981            DrvAudioHlpFileWrite(pStream->Out.Dbg.pFileStreamWrite, pvBuf, cbToWrite, 0 /* fFlags */);
    976982
    977 #ifdef VBOX_WITH_STATISTICS
    978         STAM_COUNTER_ADD(&pThis->Stats.TotalFramesWritten, cfGstWritten);
    979 #endif
    980983        uint32_t cfGstMixed = 0;
    981984        if (cfGstWritten)
     
    996999
    9971000                pStream->tsLastReadWrittenNs = RTTimeNanoTS();
    998 #ifdef DEBUG
    999                 pStream->Out.Dbg.cfWrittenSinceLastPlay += AUDIOMIXBUF_F2F_RATIO(&pStream->Guest.MixBuf, cfGstMixed);
    1000 #endif
    10011001                /* Keep going. */
    10021002            }
     
    10081008
    10091009#ifdef VBOX_WITH_STATISTICS
    1010             STAM_COUNTER_ADD(&pThis->Stats.TotalFramesMixedOut,     cfGstMixed);
     1010            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesWritten,  cfGstWritten);
     1011            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesMixedOut, cfGstMixed);
    10111012            Assert(cfGstWritten >= cfGstMixed);
    1012             STAM_COUNTER_ADD(&pThis->Stats.TotalFramesLostOut,      cfGstWritten - cfGstMixed);
    1013             STAM_COUNTER_ADD(&pThis->Stats.TotalBytesWritten,       cbWrittenTotal);
    1014             STAM_COUNTER_ADD(&pStream->Out.Stats.BytesTotalWritten, cbWrittenTotal);
     1013            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesLostOut,  cfGstWritten - cfGstMixed);
     1014            STAM_COUNTER_ADD(&pThis->Stats.TotalBytesWritten,   cbWrittenTotal);
     1015
     1016            STAM_COUNTER_ADD(&pStream->Out.Stats.TotalFramesWritten, cfGstWritten);
     1017            STAM_COUNTER_INC(&pStream->Out.Stats.TotalTimesWritten);
    10151018#endif
    10161019        }
     
    15471550
    15481551                pStream->tsLastPlayedCapturedNs = RTTimeNanoTS();
    1549 #ifdef DEBUG
    1550                 Log3Func(("[%s] Dbg: cfWrittenSinceLastPlay=%RU64 (%RU64ms)\n",
    1551                           pStream->szName,
    1552                           pStream->Out.Dbg.cfWrittenSinceLastPlay, DrvAudioHlpFramesToMilli(pStream->Out.Dbg.cfWrittenSinceLastPlay, &pStream->Host.Cfg.Props)));
    1553                 pStream->Out.Dbg.cfWrittenSinceLastPlay = 0;
    1554 #endif
    15551552            }
    15561553
     
    15761573            STAM_COUNTER_ADD     (&pThis->Stats.TotalFramesOut, cfPlayedTotal);
    15771574            STAM_PROFILE_ADV_STOP(&pThis->Stats.DelayOut, out);
    1578             STAM_COUNTER_ADD     (&pStream->Out.Stats.FramesPlayed, cfPlayedTotal);
     1575
     1576            STAM_COUNTER_ADD     (&pStream->Out.Stats.TotalFramesPlayed, cfPlayedTotal);
     1577            STAM_COUNTER_INC     (&pStream->Out.Stats.TotalTimesPlayed);
    15791578#endif
    15801579        }
     
    18521851
    18531852#ifdef VBOX_WITH_STATISTICS
    1854             STAM_COUNTER_ADD(&pThis->Stats.TotalFramesIn,       cfCaptured);
    1855             STAM_COUNTER_ADD(&pStream->In.Stats.FramesCaptured, cfCaptured);
     1853            STAM_COUNTER_ADD(&pThis->Stats.TotalFramesIn,            cfCaptured);
     1854
     1855            STAM_COUNTER_ADD(&pStream->In.Stats.TotalFramesCaptured, cfCaptured);
    18561856#endif
    18571857        }
     
    23492349            const uint32_t cbRead = AUDIOMIXBUF_F2B(&pStream->Guest.MixBuf, cfRead);
    23502350
    2351             STAM_COUNTER_ADD(&pThis->Stats.TotalBytesRead,      cbRead);
    2352             STAM_COUNTER_ADD(&pStream->In.Stats.BytesTotalRead, cbRead);
     2351            STAM_COUNTER_ADD(&pThis->Stats.TotalBytesRead,       cbRead);
     2352
     2353            STAM_COUNTER_ADD(&pStream->In.Stats.TotalFramesRead, cfRead);
     2354            STAM_COUNTER_INC(&pStream->In.Stats.TotalTimesRead);
    23532355#endif
    23542356            Assert(cfToRead >= cfRead);
     
    31863188    {
    31873189#ifdef VBOX_WITH_STATISTICS
    3188         PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.BytesElapsed);
    3189         PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.BytesTotalRead);
    3190         PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.FramesCaptured);
     3190        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.TotalFramesCaptured);
     3191        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.TotalTimesCaptured);
     3192        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.TotalFramesRead);
     3193        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->In.Stats.TotalTimesRead);
    31913194#endif
    31923195        if (pThis->In.Cfg.Dbg.fEnabled)
     
    32023205    {
    32033206#ifdef VBOX_WITH_STATISTICS
    3204         PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.BytesElapsed);
    3205         PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.BytesTotalWritten);
    3206         PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.FramesPlayed);
     3207        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.TotalFramesPlayed);
     3208        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.TotalTimesPlayed);
     3209        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.TotalFramesWritten);
     3210        PDMDrvHlpSTAMDeregister(pThis->pDrvIns, &pStream->Out.Stats.TotalTimesWritten);
    32073211#endif
    32083212        if (pThis->Out.Cfg.Dbg.fEnabled)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette